official-gcc.git
56 min agoSVE intrinsics: Fold svmul with all-zero operands to zero vectormastertrunk
Jennifer Schmitz [Tue, 17 Sep 2024 07:15:38 +0000 (17 00:15 -0700)]
SVE intrinsics: Fold svmul with all-zero operands to zero vector

As recently implemented for svdiv, this patch folds svmul to a zero
vector if one of the operands is a zero vector. This transformation is
applied if at least one of the following conditions is met:
- the first operand is all zeros or
- the second operand is all zeros, and the predicate is ptrue or the
predication is _x or _z.

In contrast to constant folding, which was implemented in a previous
patch, this transformation is applied as soon as one of the operands is
a zero vector, while the other operand can be a variable.

The patch was bootstrapped and regtested on aarch64-linux-gnu, no regression.
OK for mainline?

Signed-off-by: Jennifer Schmitz <jschmitz@nvidia.com>
gcc/
* config/aarch64/aarch64-sve-builtins-base.cc (svmul_impl::fold):
Add folding of all-zero operands to zero vector.

gcc/testsuite/
* gcc.target/aarch64/sve/const_fold_mul_1.c: Adjust expected
outcome.
* gcc.target/aarch64/sve/fold_mul_zero.c: New test.

63 min agoaarch64: Define l1_cache_line_size for -mcpu=neoverse-v2
Kyrylo Tkachov [Wed, 11 Sep 2024 13:58:35 +0000 (11 06:58 -0700)]
aarch64: Define l1_cache_line_size for -mcpu=neoverse-v2

This is a small patch that sets the L1 cache line size for Neoverse V2.
Unlike the other cache-related constants in there this value is not used just
for SW prefetch generation (which we want to avoid for Neoverse V2 presently).
It's also used to set std::hardware_destructive_interference_size.
See the links and recent discussions in PR116662 for reference.
Some CPU tunings in aarch64 set this value to something useful, but for
generic tuning we use the conservative 256, which forces 256-byte alignment
in such atomic structures.  Using a smaller value can decrease the size of such
structs during layout and should not present an ABI problem as
std::hardware_destructive_interference_size is not intended to be used for structs
in an external interface, and GCC warns about such uses.
Another place where the L1 cache line size is used is in phiopt for
-fhoist-adjacent-loads where conditional accesses to adjacent struct members
can be speculatively loaded as long as they are within the same L1 cache line.
e.g.
struct S { int i; int j; };

int
bar (struct S *x, int y)
{
  int r;
  if (y)
    r = x->i;
  else
    r = x->j;
  return r;
}

The Neoverse V2 L1 cache line is 64 bytes according to the TRM, so set it to
that. The rest of the prefetch parameters inherit from the generic tuning so
we don't do anything extra for software prefeteches.

Bootstrapped and tested on aarch64-none-linux-gnu.

Signed-off-by: Kyrylo Tkachov <ktkachov@nvidia.com>
* config/aarch64/tuning_models/neoversev2.h (neoversev2_prefetch_tune):
Define.
(neoversev2_tunings): Use it.

86 min agoi386: Add ssemov2, sseicvt2 for some load instructions that use memory on operand2
Hu, Lin1 [Wed, 11 Sep 2024 02:10:40 +0000 (11 10:10 +0800)]
i386: Add ssemov2, sseicvt2 for some load instructions that use memory on operand2

The memory attr of some instructions should be 'load', but these are
'none', currently.

gcc/ChangeLog:

* config/i386/i386.md: Add ssemov2, sseicvt2.
* config/i386/sse.md (sse2_cvtsi2sd): Apply sseicvt2.
(sse2_cvtsi2sdq<round_name>): Ditto.
(vec_set<mode>_0): Apply ssemov2 for 4, 6.

95 min agoMatch: Add interface match_cond_with_binary_phi for true/false arg
Pan Li [Thu, 19 Sep 2024 03:03:33 +0000 (19 11:03 +0800)]
Match: Add interface match_cond_with_binary_phi for true/false arg

When matching the cond with 2 args phi node, we need to figure out
which arg of phi node comes from the true edge of cond block, as
well as the false edge.  This patch would like to add interface
to perform the action and return the true and false arg in TREE type.

The below test suites are passed for this patch.
* The rv64gcv fully regression test.
* The x86 bootstrap test.
* The x86 fully regression test.

gcc/ChangeLog:

* gimple-match-head.cc (match_cond_with_binary_phi): Add new func
impl to match binary phi for true and false arg.

Signed-off-by: Pan Li <pan2.li@intel.com>
2 hours agodoc: Add more alias option and reorder Intel CPU -march documentation
Haochen Jiang [Wed, 18 Sep 2024 03:20:15 +0000 (18 11:20 +0800)]
doc: Add more alias option and reorder Intel CPU -march documentation

Since r15-3539, there are requests coming in to add other alias option
documentation. This patch will add all ot them, including corei7, corei7-avx,
core-avx-i, core-avx2, atom, slm, gracemont and emerarldrapids.

Also in the patch, I reordered that part of documentation, currently all
the CPUs/products are just all over the place. I regrouped them by
date-to-now products (since the very first CPU to latest Panther Lake), P-core
(since the clients become hybrid cores, starting from Sapphire Rapids) and
E-core (since Bonnell to latest Clearwater Forest).

And in the patch, I refined the product names in documentation.

gcc/ChangeLog:

* doc/invoke.texi: Add corei7, corei7-avx, core-avx-i,
core-avx2, atom, slm, gracemont and emerarldrapids. Reorder
the -march documentation by splitting them into date-to-now
products, P-core and E-core. Refine the product names in
documentation.

2 hours agoi386: Enhance AVX10.2 convert tests
Haochen Jiang [Thu, 5 Sep 2024 03:27:33 +0000 (5 11:27 +0800)]
i386: Enhance AVX10.2 convert tests

For AVX10.2 convert tests, all of them are missing mask tests
previously, this patch will add them in the tests.

gcc/testsuite/ChangeLog:

* gcc.target/i386/avx10_2-512-vcvt2ps2phx-2.c: Enhance mask test.
* gcc.target/i386/avx10_2-512-vcvtbiasph2bf8-2.c: Ditto.
* gcc.target/i386/avx10_2-512-vcvtbiasph2bf8s-2.c: Ditto.
* gcc.target/i386/avx10_2-512-vcvtbiasph2hf8-2.c: Ditto.
* gcc.target/i386/avx10_2-512-vcvtbiasph2hf8s-2.c: Ditto.
* gcc.target/i386/avx10_2-512-vcvthf82ph-2.c: Ditto.
* gcc.target/i386/avx10_2-512-vcvtne2ph2bf8-2.c: Ditto.
* gcc.target/i386/avx10_2-512-vcvtne2ph2bf8s-2.c: Ditto.
* gcc.target/i386/avx10_2-512-vcvtne2ph2hf8-2.c: Ditto.
* gcc.target/i386/avx10_2-512-vcvtne2ph2hf8s-2.c: Ditto.
* gcc.target/i386/avx10_2-512-vcvtneph2bf8-2.c: Ditto.
* gcc.target/i386/avx10_2-512-vcvtneph2bf8s-2.c: Ditto.
* gcc.target/i386/avx10_2-512-vcvtneph2hf8-2.c: Ditto.
* gcc.target/i386/avx10_2-512-vcvtneph2hf8s-2.c: Ditto.
* gcc.target/i386/avx512f-helper.h: Fix a typo in macro define.

2 hours agoi386: Add missing avx512f-mask-type.h include
Haochen Jiang [Sat, 14 Sep 2024 07:55:53 +0000 (14 15:55 +0800)]
i386: Add missing avx512f-mask-type.h include

Since commit r15-3594, we fixed the bugs in MASK_TYPE for AVX10.2
testcases, but we missed the following four.

The tests are not FAIL since the binutils part haven't been merged
yet, which leads to UNSUPPORTED test. But the avx512f-mask-type.h
needs to be included, otherwise, it will be compile error.

gcc/testsuite/ChangeLog:

* gcc.target/i386/avx10_2-512-vpdpbssd-2.c: Include
avx512f-mask-type.h.
* gcc.target/i386/avx10_2-vminmaxsd-2.c: Ditto.
* gcc.target/i386/avx10_2-vminmaxsh-2.c: Ditto.
* gcc.target/i386/avx10_2-vminmaxss-2.c: Ditto.

5 hours agotestsuite/gcc.dg/pr84877.c: Add machinery to stabilize stack aligmnent
Hans-Peter Nilsson [Thu, 5 Sep 2024 15:02:23 +0000 (5 17:02 +0200)]
testsuite/gcc.dg/pr84877.c: Add machinery to stabilize stack aligmnent

This test awkwardly "blinks"; xfails and xpasses apparently
randomly for cris-elf using the "gdb simulator".  On
inspection, I see that the stack address depends on the
number of environment variables, deliberately passed to the
simulator, each adding the size of a pointer.

This test is IMHO important enough not to be just skipped
just because it blinks (fixing the actual problem is a
different task).

I guess a random non-16 stack-alignment could happen for
other targets as well, so let's try and add a generic
machinery to "stabilize" the test as failing, by allocating
a dynamic amount to make sure it's misaligned.  The most
target-dependent item here is an offset between the incoming
stack-pointer value (within main in the added framework) and
outgoing (within "xmain" as called from main when setting up
the p0 parameter).  I know there are other wonderful stack
shapes, but such targets would fall under the "complicated
situations"-label and are no worse off than before.

* gcc.dg/pr84877.c: Try to make the test result consistent by
misaligning the stack.

8 hours agoDaily bump.
GCC Administrator [Thu, 19 Sep 2024 00:18:55 +0000 (19 00:18 +0000)]
Daily bump.

8 hours agoRISC-V: Fix signed SAT_ADD test case for int64_t
Pan Li [Fri, 13 Sep 2024 01:16:48 +0000 (13 09:16 +0800)]
RISC-V: Fix signed SAT_ADD test case for int64_t

The int8_t test for signed SAT_ADD is sat_s_add-1.c, the sat_s_add-4.c
should be for int64_t.  Thus, update sat_s_add-4.c for int64_t type.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/sat_s_add-4.c: Update test for int64_t
instead of int8_t.

Signed-off-by: Pan Li <pan2.li@intel.com>
10 hours agolibstdc++: add braces
Jason Merrill [Sun, 15 Sep 2024 09:48:46 +0000 (15 11:48 +0200)]
libstdc++: add braces

GCC compiles with -fno-exceptions, so __throw_exception_again is a no-op,
and compilation gives a -Wempty-body warning here, so let's wrap it as is
already done in a few other files.

libstdc++-v3/ChangeLog:

* include/bits/basic_ios.h: Add braces.

14 hours ago[PATCH] configure: fix typos
Andrew Kreimer [Wed, 18 Sep 2024 17:50:58 +0000 (18 11:50 -0600)]
[PATCH] configure: fix typos

/
* configure.ac: Fix typos.
* configure: Rebuilt.

14 hours agoc++: alias of decltype(lambda) is opaque [PR116714, PR107390]
Patrick Palka [Wed, 18 Sep 2024 17:50:43 +0000 (18 13:50 -0400)]
c++: alias of decltype(lambda) is opaque [PR116714, PR107390]

Here for

  using type = decltype([]{});
  static_assert(is_same_v<type, type>);

we strip the alias ahead of time during template argument coercion
which effectively transforms the template-id into

  is_same_v<decltype([]{}), decltype([]{})>

which is wrong because later substitution into the template-id will
produce two new lambdas with distinct types and cause is_same_v to
return false.

This demonstrates that such aliases should be considered opaque (a
notion that we recently introduced in r15-2331-g523836716137d0).
(An alternative solution might be to consider memoizing lambda-expr
substitution rather than always producing a new lambda, but this is
much simpler.)

PR c++/116714
PR c++/107390

gcc/cp/ChangeLog:

* pt.cc (dependent_opaque_alias_p): Also return true for a
decltype(lambda) alias.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/lambda-uneval18.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
16 hours agojit: Ensure ssize_t is defined
Francois-Xavier Coudert [Sat, 11 May 2024 15:08:05 +0000 (11 17:08 +0200)]
jit: Ensure ssize_t is defined

On some targets it seems that ssize_t is not defined by any of the
headers transitively included by <stdio.h>.  This leads to a bootstrap
fail when jit is enabled.

gcc/jit/ChangeLog:

* libgccjit.h: Include <sys/types.h>

17 hours agohppa: Add peephole2 optimizations for REG+D loads and stores
John David Anglin [Wed, 18 Sep 2024 15:02:32 +0000 (18 11:02 -0400)]
hppa: Add peephole2 optimizations for REG+D loads and stores

The PA 1.x architecture only supports long displacements in
integer loads and stores.  Floating-point loads and stores
only support short displacements.  As a result, we have to
wait until reload is complete before generating insns with
long displacements.

The PA 2.0 architecture supports long displacements in both
integer and floating-point loads and stores.

The peephole2 optimizations added in this change are only
enabled when 14-bit long displacements aren't supported for
floating-point loads and stores.

2024-09-18  John David Anglin  <danglin@gcc.gnu.org>

gcc/ChangeLog:

* config/pa/pa.h (GENERAL_REGNO_P): Define.
* config/pa/pa.md: Add SImode and SFmode peephole2
patterns to generate loads and stores with long
displacements.

17 hours ago[PATCH v3] RISC-V: Fixed incorrect semantic description in DF to DI pattern in the...
Jin Ma [Wed, 18 Sep 2024 14:56:23 +0000 (18 08:56 -0600)]
[PATCH v3] RISC-V: Fixed incorrect semantic description in DF to DI pattern in the Zfa extension on rv32.

gcc/ChangeLog:

* config/riscv/riscv.md: Change "truncate" to unspec for the Zfa extension on rv32.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/zfa-fmovh-fmovp-bug.c: New test.

17 hours agocontrib: Set check-params-in-docs.py to skip tables of values of a param
Filip Kastl [Wed, 18 Sep 2024 14:38:30 +0000 (18 16:38 +0200)]
contrib: Set check-params-in-docs.py to skip tables of values of a param

Currently check-params-in-docs.py reports extra params being listed in
invoke.texi.  However, those aren't actual params but items in a table of
possible values of the aarch64-autove-preference param.

This patch changes check-params-in-docs.py to ignore similar tables.

contrib/ChangeLog:

* check-params-in-docs.py: Skip tables of values of a param.
Remove code that skips items beginning with a number.

Signed-off-by: Filip Kastl <fkastl@suse.cz>
18 hours agoFail vectorization when not using SLP and --param vect-force-slp == 1
Richard Biener [Sun, 8 Sep 2024 09:21:19 +0000 (8 11:21 +0200)]
Fail vectorization when not using SLP and --param vect-force-slp == 1

The following adds --param vect-force-slp to enable the transition
to full SLP.  Full SLP is enforced during stmt analysis where it
detects failed SLP discovery and at loop analysis time where it
avoids analyzing a loop with SLP disabled.  Failure to SLP results
in vectorization to fail.

* params.opt (vect-force-slp): New param, default 0.
* doc/invoke.texi (--param vect-force-slp): Document.
* tree-vect-loop.cc (vect_analyze_loop_2): When analyzing
without SLP but --param vect-force-slp is 1 fail.
* tree-vect-stmts.cc (vect_analyze_stmt): Fail vectorization
for non-SLP stmts when --param vect-force-slp is 1.

18 hours ago[PATCH 1/2] RISC-V: Fix the outer_code when calculating the cost of SET expression.
Xianmiao Qu [Wed, 18 Sep 2024 13:35:12 +0000 (18 07:35 -0600)]
[PATCH 1/2] RISC-V: Fix the outer_code when calculating the cost of SET expression.

I think it is a typo. When calculating the 'SET_SRC (x)' cost,
outer_code should be set to SET.

gcc/
* config/riscv/riscv.cc (riscv_rtx_costs): Fix the outer_code
when calculating the cost of SET expression.

18 hours ago[PATCH] RISC-V: Fix th.extu operands exceeding range on rv32.
Xianmiao Qu [Wed, 18 Sep 2024 13:28:44 +0000 (18 07:28 -0600)]
[PATCH] RISC-V: Fix th.extu operands exceeding range on rv32.

The Combine Pass may generate zero_extract instructions that are out of range.
Drawing from other architectures like AArch64, we should impose restrictions
on the "*th_extu<mode>4" pattern.

gcc/
* config/riscv/thead.md (*th_extu<mode>4): Fix th.extu
operands exceeding range on rv32.

gcc/testsuite/
* gcc.target/riscv/xtheadbb-extu-4.c: New.

18 hours ago[PATCH] RISC-V: Allow zero operand for DI variants of vssubu.vx
Bohan Lei [Wed, 18 Sep 2024 13:20:23 +0000 (18 07:20 -0600)]
[PATCH] RISC-V: Allow zero operand for DI variants of vssubu.vx

The RISC-V vector machine description relies on the helper function
`sew64_scalar_helper` to emit actual insns for the DI variants of
vssub.vx and vssubu.vx.  This works with vssub.vx, but can cause
problems with vssubu.vx with the scalar operand being constant zero,
because `has_vi_variant_p` returns false, and the operand will be taken
without being loaded into a reg.  The attached testcases can cause an
internal compiler error as a result.

Allowing a constant zero operand in those insns seems to be a simple
solution that only affects minimum existing code.

gcc/ChangeLog:

* config/riscv/vector.md: Allow zero operand for DI variants of
vssubu.vx

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/base/vssubu-1.c: New test.
* gcc.target/riscv/rvv/base/vssubu-2.c: New test.

19 hours agoc++: -Wdangling-reference diagnostic
Jason Merrill [Mon, 16 Sep 2024 11:29:05 +0000 (16 13:29 +0200)]
c++: -Wdangling-reference diagnostic

The -Wdangling-reference diagnostic talks about the full-expression, but
prints one call, while the full-expression in a declaration is the entire
initialization.  It seems more useful to point out the temporary that the
compiler thinks we might be getting a dangling reference to.

gcc/cp/ChangeLog:

* call.cc (do_warn_dangling_reference): Return temporary
instead of the call it's passed to.
(maybe_warn_dangling_reference): Adjust diagnostic.

gcc/testsuite/ChangeLog:

* g++.dg/warn/Wdangling-reference1.C: Adjust diagnostic.

19 hours agoc++: -Wdangling-reference and empty class [PR115361]
Jason Merrill [Sun, 15 Sep 2024 11:50:04 +0000 (15 13:50 +0200)]
c++: -Wdangling-reference and empty class [PR115361]

We can't have a dangling reference to an empty class unless it's
specifically to that class or one of its bases.  This was giving a
false positive on the _ExtractKey pattern in libstdc++ hashtable.h.

This also adjusts the order of arguments to reference_related_p, which
is relevant for empty classes (unlike scalars).

Several of the classes in the testsuite needed to gain data members to
continue to warn.

PR c++/115361

gcc/cp/ChangeLog:

* call.cc (do_warn_dangling_reference): Check is_empty_class.

gcc/testsuite/ChangeLog:

* g++.dg/ext/attr-no-dangling6.C
* g++.dg/ext/attr-no-dangling7.C
* g++.dg/ext/attr-no-dangling8.C
* g++.dg/ext/attr-no-dangling9.C
* g++.dg/warn/Wdangling-reference1.C
* g++.dg/warn/Wdangling-reference2.C
* g++.dg/warn/Wdangling-reference3.C: Make classes non-empty.
* g++.dg/warn/Wdangling-reference23.C: New test.

21 hours agomatch.pd: Check trunc_mod vector obtap before folding.
Jennifer Schmitz [Thu, 5 Sep 2024 15:10:02 +0000 (5 08:10 -0700)]
match.pd: Check trunc_mod vector obtap before folding.

In the pattern X - (X / Y) * Y to X % Y, this patch guards the
simplification for vector types by a check for:
1) Support of the mod optab for vectors OR
2) Application before vector lowering for non-VL vectors.
This is to prevent reverting vectorization of modulo to div/mult/sub
if the target does not support vector mod optab.

The patch was bootstrapped and tested with no regression on
aarch64-linux-gnu and x86_64-linux-gnu.
OK for mainline?

Signed-off-by: Jennifer Schmitz <jschmitz@nvidia.com>
gcc/
PR tree-optimization/116569
* match.pd: Guard simplification to trunc_mod with check for
mod optab support.

gcc/testsuite/
PR tree-optimization/116569
* gcc.dg/torture/pr116569.c: New test.

23 hours agoreload1.cc: rtl-optimization/116326 - Use RELOAD_ELIMINABLE_REGS.
Georg-Johann Lay [Fri, 6 Sep 2024 09:23:06 +0000 (6 11:23 +0200)]
reload1.cc: rtl-optimization/116326 - Use RELOAD_ELIMINABLE_REGS.

The new macro is required because reload and LRA are using different
representations for a multi-register frame pointer.  As ELIMINABLE_REGS
is used to initialize static const objects, it can't depend on -mlra.

PR rtl-optimization/116326
gcc/
* reload1.cc (reg_eliminate_1): Initialize from
RELOAD_ELIMINABLE_REGS if defined.
* config/avr/avr.h (RELOAD_ELIMINABLE_REGS): Copy from ELIMINABLE_REGS.
(ELIMINABLE_REGS): Don't mention sub-regnos of the frame pointer.
* doc/tm.texi.in (Eliminating Frame Pointer and Arg Pointer)
<RELOAD_ELIMINABLE_REGS>: Add documentation.
* doc/tm.texi: Rebuild.
gcc/testsuite/
* gcc.target/avr/torture/lra-pr116324.c: New test.
* gcc.target/avr/torture/lra-pr116325.c: New test.

23 hours agoAVR: doc/install.texi - Update avr specific installation notes.
Georg-Johann Lay [Tue, 17 Sep 2024 09:26:19 +0000 (17 11:26 +0200)]
AVR: doc/install.texi - Update avr specific installation notes.

gcc/
* doc/install.texi (Host/Target specific installation notes for GCC)
[avr]: Update web links to AVR-LibC and AVR Options.
Remove outdated note about Binutils.

23 hours agotree-optimization/116585 - SSA corruption with split_constant_offset
Richard Biener [Wed, 18 Sep 2024 07:52:55 +0000 (18 09:52 +0200)]
tree-optimization/116585 - SSA corruption with split_constant_offset

split_constant_offset when looking through SSA defs can end up
picking SSA leafs that are subject to abnormal coalescing.  This
can lead to downstream consumers to insert code based on the
result (like from dataref analysis) in places that violate constraints
for abnormal coalescing.  It's best to not expand defs whose operands
are subject to abnormal coalescing - and not either do something when
a subexpression has operands like that already.

PR tree-optimization/116585
* tree-data-ref.cc (split_constant_offset_1): When either
operand is subject to abnormal coalescing do no further
processing.

* gcc.dg/torture/pr116585.c: New testcase.

25 hours agophiopt: C++ify cond_if_else_store_replacement
Andrew Pinski [Tue, 17 Sep 2024 22:03:21 +0000 (17 15:03 -0700)]
phiopt: C++ify cond_if_else_store_replacement

This C++ify cond_if_else_store_replacement by using range fors
and changing using a std::pair instead of 2 vecs.
I had a hard time understanding the code when there was 2 vecs
so having a vec of a pair makes it easier to understand the relationship
between the 2.

gcc/ChangeLog:

* tree-ssa-phiopt.cc (cond_if_else_store_replacement): Use
range fors and use one vec for then/else stores instead of 2.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
25 hours agophiopt: Add some details dump to cselim
Andrew Pinski [Tue, 17 Sep 2024 21:26:54 +0000 (17 14:26 -0700)]
phiopt: Add some details dump to cselim

While trying to debug PR 116747, I noticed there was no dump
saying what was done. So this adds the debug dump and it helps
debug what is going on in PR 116747 too.

Bootstrapped and tested on x86_64-linux-gnu.

gcc/ChangeLog:

* tree-ssa-phiopt.cc (cond_if_else_store_replacement_1): Add debug dump.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
30 hours agoRISC-V: Implement SAT_ADD for signed integer vector
Pan Li [Thu, 12 Sep 2024 02:43:46 +0000 (12 10:43 +0800)]
RISC-V: Implement SAT_ADD for signed integer vector

This patch would like to implement the ssadd for vector integer.  Aka
form 1 of ssadd vector.

Form 1:
  #define DEF_VEC_SAT_S_ADD_FMT_1(T, UT, MIN, MAX)                     \
  void __attribute__((noinline))                                       \
  vec_sat_s_add_##T##_fmt_1 (T *out, T *op_1, T *op_2, unsigned limit) \
  {                                                                    \
    unsigned i;                                                        \
    for (i = 0; i < limit; i++)                                        \
      {                                                                \
        T x = op_1[i];                                                 \
        T y = op_2[i];                                                 \
        T sum = (UT)x + (UT)y;                                         \
        out[i] = (x ^ y) < 0                                           \
          ? sum                                                        \
          : (sum ^ x) >= 0                                             \
            ? sum                                                      \
            : x < 0 ? MIN : MAX;                                       \
      }                                                                \
  }

DEF_VEC_SAT_S_ADD_FMT_1(int64_t, uint64_t, INT64_MIN, INT64_MAX)

Before this patch:
vec_sat_s_add_int64_t_fmt_1:
  ...
  vsetvli  t1,zero,e64,m1,ta,mu
  vadd.vv  v3,v1,v2
  vxor.vv  v0,v1,v3
  vmslt.vi v0,v0,0
  vxor.vv  v2,v1,v2
  vmsge.vi v2,v2,0
  vmand.mm v0,v0,v2
  vsra.vx  v1,v1,t3
  vxor.vv  v3,v1,v4,v0.t
  ...

After this patch:
vec_sat_s_add_int64_t_fmt_1:
  ...
  vsetvli  a6,zero,e64,m1,ta,ma
  vsadd.vv v1,v1,v2
  ...

The below test suites are passed for this patch.
* The rv64gcv fully regression test.

gcc/ChangeLog:

* config/riscv/autovec.md (ssadd<mode>3): Add new pattern for
signed integer vector SAT_ADD.
* config/riscv/riscv-protos.h (expand_vec_ssadd): Add new func
decl for vector ssadd expanding.
* config/riscv/riscv-v.cc (expand_vec_ssadd): Add new func impl
to expand vector ssadd pattern.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/binop/vec_sat_data.h: Add test
data for vector ssadd.
* gcc.target/riscv/rvv/autovec/vec_sat_arith.h: Add test helper
macros.
* gcc.target/riscv/rvv/autovec/binop/vec_sat_s_add-1.c: New test.
* gcc.target/riscv/rvv/autovec/binop/vec_sat_s_add-2.c: New test.
* gcc.target/riscv/rvv/autovec/binop/vec_sat_s_add-3.c: New test.
* gcc.target/riscv/rvv/autovec/binop/vec_sat_s_add-4.c: New test.
* gcc.target/riscv/rvv/autovec/binop/vec_sat_s_add-run-1.c: New test.
* gcc.target/riscv/rvv/autovec/binop/vec_sat_s_add-run-2.c: New test.
* gcc.target/riscv/rvv/autovec/binop/vec_sat_s_add-run-3.c: New test.
* gcc.target/riscv/rvv/autovec/binop/vec_sat_s_add-run-4.c: New test.

Signed-off-by: Pan Li <pan2.li@intel.com>
31 hours agoPR 89213: Add better support for shifting vectors with 64-bit elements
Michael Meissner [Wed, 18 Sep 2024 01:05:27 +0000 (17 21:05 -0400)]
PR 89213: Add better support for shifting vectors with 64-bit elements

This patch fixes PR target/89213 to allow better code to be generated to do
constant shifts of V2DI/V2DF vectors.  Previously GCC would do constant shifts
of vectors with 64-bit elements by using:

XXSPLTIB 32,4
VEXTSB2D 0,0
VSRAD 2,2,0

I.e., the PowerPC does not have a VSPLTISD instruction to load -15..14 for the
64-bit shift count in one instruction.  Instead, it would need to load a byte
and then convert it to 64-bit.

With this patch, GCC now realizes that the vector shift instructions will look
at the bottom 6 bits for the shift count, and it can use either a VSPLTISW or
XXSPLTIB instruction to load the shift count.

2024-09-17  Michael Meissner  <meissner@linux.ibm.com>

gcc/

PR target/89213
* config/rs6000/altivec.md (UNSPEC_VECTOR_SHIFT): New unspec.
(VSHIFT_MODE): New mode iterator.
(vshift_code): New code iterator.
(vshift_attr): New code attribute.
(altivec_<mode>_<vshift_attr>_const): New pattern to optimize
vector long long/int shifts by a constant.
(altivec_<mode>_shift_const): New helper insn to load up a
constant used by the shift operation.
* config/rs6000/predicates.md (vector_shift_constant): New
predicate.

gcc/testsuite/

PR target/89213
* gcc.target/powerpc/pr89213.c: New test.
* gcc.target/powerpc/vec-rlmi-rlnm.c: Update instruction count.

32 hours agoDaily bump.
GCC Administrator [Wed, 18 Sep 2024 00:16:55 +0000 (18 00:16 +0000)]
Daily bump.

35 hours agoc++: fix constexpr cast from void* diag issue [PR116741]aoliva/heads/testbase
Marek Polacek [Tue, 17 Sep 2024 18:34:30 +0000 (17 14:34 -0400)]
c++: fix constexpr cast from void* diag issue [PR116741]

The result of build_fold_indirect_ref can be a COMPONENT_REF in
which case using DECL_SOURCE_LOCATION will crash.  Look at its op1
instead.

PR c++/116741

gcc/cp/ChangeLog:

* constexpr.cc (cxx_eval_constant_expression) <case CONVERT_EXPR>: If
the result of build_fold_indirect_ref is a COMPONENT_REF, use its op1.
Check DECL_P before calling inform.

gcc/testsuite/ChangeLog:

* g++.dg/cpp26/constexpr-voidptr4.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
35 hours agoc++: ICE with -Wtautological-compare in template [PR116534]
Marek Polacek [Thu, 29 Aug 2024 14:40:50 +0000 (29 10:40 -0400)]
c++: ICE with -Wtautological-compare in template [PR116534]

Pre r14-4793, we'd call warn_tautological_cmp -> operand_equal_p
with operands wrapped in NON_DEPENDENT_EXPR, which works, since
o_e_p bails for codes it doesn't know.  But now we pass operands
not encapsulated in NON_DEPENDENT_EXPR, and crash, because the
template tree for &a[x] has null DECL_FIELD_OFFSET.

This patch extends r12-7797 to cover the case when DECL_FIELD_OFFSET
is null.

PR c++/116534

gcc/ChangeLog:

* fold-const.cc (operand_compare::operand_equal_p): If either
field's DECL_FIELD_OFFSET is null, compare the fields with ==.

gcc/testsuite/ChangeLog:

* g++.dg/warn/Wtautological-compare4.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
40 hours agoc++: crash with anon VAR_DECL [PR116676]
Marek Polacek [Mon, 16 Sep 2024 20:42:38 +0000 (16 16:42 -0400)]
c++: crash with anon VAR_DECL [PR116676]

r12-3495 added maybe_warn_about_constant_value which will crash if
it gets a nameless VAR_DECL, which is what happens in this PR.

We created this VAR_DECL in cp_parser_decomposition_declaration.

PR c++/116676

gcc/cp/ChangeLog:

* constexpr.cc (maybe_warn_about_constant_value): Check DECL_NAME.

gcc/testsuite/ChangeLog:

* g++.dg/cpp1z/constexpr-116676.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
2 days agoSVE intrinsics: Fold svdiv with all-zero operands to zero vector
Jennifer Schmitz [Mon, 2 Sep 2024 13:46:57 +0000 (2 06:46 -0700)]
SVE intrinsics: Fold svdiv with all-zero operands to zero vector

This patch folds svdiv where one of the operands is all-zeros to a zero
vector, if one of the following conditions holds:
- the dividend is all zeros or
- the divisor is all zeros, and the predicate is ptrue or the predication
is _x or _z.
This case was not covered by the recent patch that implemented constant
folding, because that covered only cases where both operands are
constant vectors. Here, the operation is folded as soon as one of the operands
is a constant zero vector.
Folding of divison by 0 to return 0 is in accordance with
the semantics of sdiv and udiv.

The patch was bootstrapped and regtested on aarch64-linux-gnu, no regression.
OK for mainline?

Signed-off-by: Jennifer Schmitz <jschmitz@nvidia.com>
gcc/
* config/aarch64/aarch64-sve-builtins-base.cc (svdiv_impl::fold):
Add folding of all-zero operands to zero vector.

gcc/testsuite/
* gcc.target/aarch64/sve/fold_div_zero.c: New test.
* gcc.target/aarch64/sve/const_fold_div_1.c: Adjust expected
outcome.

2 days agoDaily bump.
GCC Administrator [Tue, 17 Sep 2024 00:17:21 +0000 (17 00:17 +0000)]
Daily bump.

2 days agoaarch64: Improve vector constant generation using SVE INDEX instruction [PR113328]
Pengxuan Zheng [Wed, 11 Sep 2024 00:59:46 +0000 (10 17:59 -0700)]
aarch64: Improve vector constant generation using SVE INDEX instruction [PR113328]

SVE's INDEX instruction can be used to populate vectors by values starting from
"base" and incremented by "step" for each subsequent value. We can take
advantage of it to generate vector constants if TARGET_SVE is available and the
base and step values are within [-16, 15].

For example, with the following function:

typedef int v4si __attribute__ ((vector_size (16)));
v4si
f_v4si (void)
{
  return (v4si){ 0, 1, 2, 3 };
}

GCC currently generates:

f_v4si:
adrp    x0, .LC4
ldr     q0, [x0, #:lo12:.LC4]
ret

.LC4:
.word   0
.word   1
.word   2
.word   3

With this patch, we generate an INDEX instruction instead if TARGET_SVE is
available.

f_v4si:
index   z0.s, #0, #1
ret

PR target/113328

gcc/ChangeLog:

* config/aarch64/aarch64.cc (aarch64_simd_valid_immediate): Improve
handling of some ADVSIMD vectors by using SVE's INDEX if TARGET_SVE is
available.
(aarch64_output_simd_mov_immediate): Likewise.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/sve/acle/general/dupq_1.c: Update test to use
SVE's INDEX instruction.
* gcc.target/aarch64/sve/acle/general/dupq_2.c: Likewise.
* gcc.target/aarch64/sve/acle/general/dupq_3.c: Likewise.
* gcc.target/aarch64/sve/acle/general/dupq_4.c: Likewise.
* gcc.target/aarch64/sve/vec_init_3.c: New test.

Signed-off-by: Pengxuan Zheng <quic_pzheng@quicinc.com>
2 days agomodula2: gcc/m2/Make-lang.in fix includes during bootstrap build
Gaius Mulley [Mon, 16 Sep 2024 17:18:11 +0000 (16 18:18 +0100)]
modula2: gcc/m2/Make-lang.in fix includes during bootstrap build

This patch fixes the include directories used when building objects in
gm2-compiler-boot.  It adds the missing gm2-gcc directory and uses a
new variable GM2_BOOT_INCLUDES for all gm2-compiler-boot rules.

gcc/m2/ChangeLog:

* Make-lang.in (GM2_BOOT_INCLUDES): New variable.
(m2/gm2-compiler-boot/M2GCCDeclare.o): Rewrite to use
GM2_BOOT_INCLUDES.
(m2/gm2-compiler-boot/M2Error.o): Ditto.
(m2/gm2-compiler-boot/%.o): Ditto.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2 days agoAVR: Update weblinks to AVR-LibC.
Georg-Johann Lay [Mon, 16 Sep 2024 15:23:00 +0000 (16 17:23 +0200)]
AVR: Update weblinks to AVR-LibC.

AVR-LibC has moved to GitHub, adjust web links:
https://github.com/avrdudes/avr-libc (project)
https://avrdudes.github.io/avr-libc/avr-libc-user-manual (wwwdocs)

gcc/
* doc/invoke.texi (AVR Options): Update AVR-LibC weblink from
nongnu.org to https://github.com/avrdudes/avr-libc
* doc/extend.texi (AVR Named Address Spaces): Same.
(AVR Function Attributes): Same.
* doc/install.texi (Cross-Compiler-Specific Options, AVR): Same.

2 days agoaarch64: Emit ADD X, Y, Y instead of SHL X, Y, #1 for SVE instructions.
Soumya AR [Tue, 10 Sep 2024 08:48:44 +0000 (10 14:18 +0530)]
aarch64: Emit ADD X, Y, Y instead of SHL X, Y, #1 for SVE instructions.

On Neoverse V2, SVE ADD instructions have a throughput of 4, while shift
instructions like SHL have a throughput of 2. We can lean on that to emit code
like:
 add z31.b, z31.b, z31.b
instead of:
 lsl z31.b, z31.b, #1

The implementation of this change for SVE vectors is similar to a prior patch
<https://gcc.gnu.org/pipermail/gcc-patches/2024-August/659958.html> that adds
the above functionality for Neon vectors.

Here, the machine descriptor pattern is split up to separately accommodate left
and right shifts, so we can specifically emit an add for all left shifts by 1.

The patch was bootstrapped and regtested on aarch64-linux-gnu, no regression.
OK for mainline?

Signed-off-by: Soumya AR <soumyaa@nvidia.com>
gcc/ChangeLog:

* config/aarch64/aarch64-sve.md (*post_ra_v<optab><mode>3): Split pattern
to accomodate left and right shifts separately.
(*post_ra_v_ashl<mode>3): Matches left shifts with additional
constraint to check for shifts by 1.
(*post_ra_v_<optab><mode>3): Matches right shifts.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/sve/acle/asm/lsl_s16.c: Updated instances of lsl-1
with corresponding add.
* gcc.target/aarch64/sve/acle/asm/lsl_s32.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/lsl_s64.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/lsl_s8.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/lsl_u16.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/lsl_u32.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/lsl_u64.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/lsl_u8.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/lsl_wide_s16.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/lsl_wide_s32.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/lsl_wide_s8.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/lsl_wide_u16.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/lsl_wide_u32.c: Likewise.
* gcc.target/aarch64/sve/acle/asm/lsl_wide_u8.c: Likewise.
* gcc.target/aarch64/sve/adr_1.c: Likewise.
* gcc.target/aarch64/sve/adr_6.c: Likewise.
* gcc.target/aarch64/sve/cond_mla_7.c: Likewise.
* gcc.target/aarch64/sve/cond_mla_8.c: Likewise.
* gcc.target/aarch64/sve/shift_2.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ldnt1sh_gather_s64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ldnt1sh_gather_u64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ldnt1uh_gather_s64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/ldnt1uh_gather_u64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/rshl_s16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/rshl_s32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/rshl_s64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/rshl_s8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/rshl_u16.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/rshl_u32.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/rshl_u64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/rshl_u8.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/stnt1h_scatter_s64.c: Likewise.
* gcc.target/aarch64/sve2/acle/asm/stnt1h_scatter_u64.c: Likewise.
* gcc.target/aarch64/sve/sve_shl_add.c: New test.

2 days agoPR modula2/116181 Use GCC tree location_t and separate pointer types
Gaius Mulley [Mon, 16 Sep 2024 12:57:34 +0000 (16 13:57 +0100)]
PR modula2/116181 Use GCC tree location_t and separate pointer types

This patch fixes all remaining -Wodr warnings in the modula-2 front end.
It removes the m2 Tree and m2 Location definitions and uses tree and
location_t throughout.  This allows the bootstrap tool mc to pick up the
GCC definitions for these data types (for the C translation of m2 sources).

The patch introduces a new module CDataTypes which contain two pointer
types: CharStar and ConstCharStar.  These map onto their C counterparts
when processed by mc however currently gm2 treats them as ADDRESS.
It might be sensible to have the gm2 versions of these data types
implemented though a builtin module in the future.

gcc/m2/ChangeLog:

PR modula2/116181
* Make-lang.in (GM2-GCC-DEFS): Add gcctypes.def and
CDataTypes.def.
(MC-LIB-DEFS): Add CDataTypes.def.
* Make-maintainer.in (m2/gm2-pge-boot/$(SRC_PREFIX)M2RTS.o):
Change include path to pge-boot.
(m2/gm2-pge-boot/$(SRC_PREFIX)SymbolKey.o): Ditto.
(m2/gm2-pge-boot/$(SRC_PREFIX)NameKey.o): Ditto.
(m2/gm2-pge-boot/$(SRC_PREFIX)Lists.o): Ditto.
(m2/gm2-pge-boot/$(SRC_PREFIX)Output.o): Ditto.
(m2/gm2-pge-boot/$(SRC_PREFIX)bnflex.o): Ditto.
(m2/gm2-pge-boot/$(SRC_PREFIX)RTentity.h): Ditto.
(m2/gm2-pge-boot/$(SRC_PREFIX)RTentity.o): Ditto.
(m2/gm2-pge-boot/$(SRC_PREFIX)%.o): Ditto.
(GM2PATH): Add -I$(srcdir)/m2/gm2-gcc.
(m2/mc-boot-gen/$(SRC_PREFIX)%.h): Add -I$(srcdir)/m2/gm2-gcc.
(m2/mc-boot-gen/$(SRC_PREFIX)%.cc): Ditto.
* gm2-compiler/M2ALU.def (PushIntegerTree): Replace Tree with tree.
(PopIntegerTree): Ditto.
(PushRealTree): Ditto.
(PopRealTree): Ditto.
(PushComplexTree): Ditto.
(PopComplexTree): Ditto.
(PushSetTree): Ditto.
(PopSetTree): Ditto.
(PopConstructorTree): Ditto.
(ConstructSetConstant): Ditto.
(BuildRange): Ditto.
(CheckOrResetOverflow): Ditto.
(PushTypeOfTree): Ditto.
* gm2-compiler/M2ALU.mod (Tree): Replace with ...
(tree): ... this.
(gcctypes): Import location_t and tree.
(m2linemap): Remove import of location_t.
* gm2-compiler/M2Base.def (m2linemap): Replace with ...
(gcctypes): ... this.
* gm2-compiler/M2Base.mod (gcctypes): Import of location_t.
(m2linemap): Remove import of location_t.
* gm2-compiler/M2Bitset.mod (m2tree): Remove import of Tree.
* gm2-compiler/M2CaseList.mod (gcctypes): Import tree.
(m2tree): Remove import of Tree.
(Tree): Replace with ...
(tree): ... this.
* gm2-compiler/M2Emit.def (gcctypes): Import location_t.
* gm2-compiler/M2GCCDeclare.def (gcctypes): Import tree.
(PromoteToString): Replace Tree with tree.
(PromoteToCString): Ditto.
(ConstantKnownAndUsed): Ditto.
* gm2-compiler/M2GCCDeclare.mod (gcctypes): Import tree.
(m2tree): Remove import of Tree.
(Tree): Replace with ...
(tree): ... this.
* gm2-compiler/M2GenGCC.def (gcctypes): Import tree.
(m2tree): Remove import of Tree.
(Tree): Replace with ...
(tree): ... this.
(GetHighFromUnbounded): Replace Tree with tree.
(StringToChar): Ditto.
(LValueToGenericPtr): Ditto.
(ZConstToTypedConst): Ditto.
(PrepareCopyString): Ditto.
* gm2-compiler/M2GenGCC.mod (gcctypes): Import tree.
(m2tree): Remove import of Tree.
(Tree): Replace with ...
(tree): ... this.
* gm2-compiler/M2LangDump.def (gcctypes): Import tree.
(m2tree): Remove import of Tree.
(Tree): Replace with ...
(tree): ... this.
* gm2-compiler/M2LangDump.mod (Tree): Replace with ...
(tree): ... this.
* gm2-compiler/M2LexBuf.def (m2linemap): Replace with ...
(gcctypes): ... this.
* gm2-compiler/M2LexBuf.mod (m2linemap): Replace with ...
(gcctypes): ... this.
* gm2-compiler/M2Options.def (m2linemap): Replace with ...
(gcctypes): ... this.
* gm2-compiler/M2Options.mod (m2linemap): Replace with ...
(gcctypes): ... this.
* gm2-compiler/M2Range.def (m2linemap): Replace with ...
(gcctypes): ... this.
(CDataTypes): Import ConstCharStar.
(CodeErrorCheck): Replace Tree with tree.
(OverlapsRange): Ditto.
(IsEqual): Ditto.
(IsGreaterOrEqual): Ditto.
(IsGreater): Ditto.
(BuildIfCallWholeHandlerLoc): Replace Tree with tree.
Replace ADDRESS with ConstCharStar.
(BuildIfCallRealHandlerLoc): Ditto.
(GetMinMax): Ditto.
* gm2-compiler/M2Range.mod (m2tree): Remove Tree.
(CodeErrorCheck): Replace Tree with tree.
(OverlapsRange): Ditto.
(IsEqual): Ditto.
(IsGreaterOrEqual): Ditto.
(IsGreater): Ditto.
(GetMinMax): Ditto.
(BuildIfCallWholeHandlerLoc): Replace Tree with tree.
Replace ADDRESS with ConstCharStar.
(BuildIfCallRealHandlerLoc): Ditto.
* gm2-compiler/M2System.def (m2linemap): Replace with ...
(gcctypes): ... this.
* gm2-compiler/M2System.mod (m2linemap): Replace with ...
(gcctypes): ... this.
(CreateMinMaxFor): Replace Tree with tree.
(CreateType): Ditto.
(AttemptToCreateType): Ditto.
(CreateSetType): Ditto.
(AttemptToCreateSetType): Ditto.
* gm2-compiler/P2SymBuild.mod (m2linemap): Replace with ...
(gcctypes): ... this.
* gm2-compiler/SymbolConversion.def (m2tree): Replace with ...
(gcctypes): ... this.
(Mod2Gcc): Replace Tree with tree.
(Gcc2Mod): Ditto.
(AddModGcc): Ditto.
* gm2-compiler/SymbolConversion.mod (m2tree): Replace with ...
(gcctypes): ... this.
(Mod2Gcc): Replace Tree with tree.
(Gcc2Mod): Ditto.
(AddModGcc): Ditto.
(Mod2GccWithoutGCCPoison): Ditto.
* gm2-compiler/SymbolTable.def (m2tree): Replace with ...
(gcctypes): ... this.
(PutModuleFinallyFunction): Replace Tree with tree.
(GetModuleFinallyFunction): Ditto.
* gm2-compiler/SymbolTable.mod (m2tree): Replace with ...
(gcctypes): ... this.
(PutModuleFinallyFunction): Replace Tree with tree.
(GetModuleFinallyFunction): Ditto.
* gm2-compiler/m2flex.def (m2linemap): Replace with ...
(gcctypes): ... this.
* gm2-gcc/init.def (PerCompilationInit): Replace ADDRESS with ConstCharStar.
(CDataTypes): Import ConstCharStar.
* gm2-gcc/m2block.def (SYSTEM): Remove import.
(CDataTypes): Import ConstCharStar.
(m2linemap): Remove import.
(m2tree): Remove import.
(gcctypes): Import tree.
(global_constant): Replace Tree with tree.
(RememberInitModuleFunction): Ditto.
(DumpGlobalConstants): Ditto.
(RememberConstant): Ditto.
(RememberType): Ditto.
(pushDecl): Ditto.
(popFunctionScope): Ditto.
(pushFunctionScope): Ditto.
(finishFunctionCode): Ditto.
(finishFunctionDecl): Ditto.
(GetErrorNode): Ditto.
(includeDecl): Ditto.
(GetGlobals): Ditto.
(GetGlobalContext): Ditto.
(begin_statement_list): Ditto.
(push_statement_list): Ditto.
(pop_statement_list): Ditto.
(getLabel): Replace Tree with tree.
Replace ADDRESS with ConstCharStar.
* gm2-gcc/m2builtins.def (CDataTypes): Import ConstCharStar.
(GetBuiltinConst): Replace Tree with tree.
(GetBuiltinConstType): Ditto.
(GetBuiltinTypeInfoType): Ditto.
(GetBuiltinTypeInfo): Ditto.
(BuiltinExists): Ditto.
(BuildBuiltinTree): Ditto.
(BuiltinMemCopy): Ditto.
(BuiltinMemSet): Ditto.
(BuiltInAlloca): Ditto.
(BuiltInIsfinite): Ditto.
* gm2-gcc/m2convert.def (CDataTypes): Import ConstCharStar.
(ToWord): Ditto.
(ToCardinal): Ditto.
(ToInteger): Ditto.
(ToBitset): Ditto.
(ConvertToPtr): Ditto.
(BuildConvert): Ditto.
(ConvertConstantAndCheck): Ditto.
(ConvertString): Ditto.
(GenericToType): Ditto.
* gm2-gcc/m2decl.cc (m2decl_BuildParameterDeclaration): Add
const attribute.
* gm2-gcc/m2decl.def (CDataTypes): Import ConstCharStar.
(BuildModuleCtor): Ditto.
(DeclareModuleCtor): Ditto.
(DeclareM2linkForcedModuleInitOrder): Ditto.
(DeclareM2linkStaticInitialization): Ditto.
(BuildPtrToTypeString): Ditto.
(BuildIntegerConstant): Ditto.
(BuildStringConstantType): Ditto.
(DeclareKnownVariable): Ditto.
(DeclareKnownConstant): Ditto.
(BuildParameterDeclaration): Ditto.
(BuildEndFunctionDeclaration): Ditto.
(RememberVariables): Ditto.
(BuildConstLiteralNumber): Ditto.
(BuildStringConstant): Ditto.
(BuildCStringConstant): Ditto.
(GetDeclContext): Ditto.
* gm2-gcc/m2decl.h (m2decl_BuildParameterDeclaration): Add
const attribute.
* gm2-gcc/m2except.def (CDataTypes): Import ConstCharStar.
(BuildThrow): Ditto.
(BuildTryBegin): Ditto.
(BuildTryEnd): Ditto.
(BuildCatchBegin): Ditto.
(BuildCatchEnd): Ditto.
* gm2-gcc/m2expr.def (CDataTypes): Import ConstCharStar.
(CSTIntToString): Ditto.
(CSTIntToChar): Ditto.
(CheckConstStrZtypeRange): Ditto.
(CompareTrees): Ditto.
(GetPointerOne): Ditto.
(GetPointerZero): Ditto.
(GetWordOne): Ditto.
(GetWordZero): Ditto.
(GetIntegerOne): Ditto.
(GetIntegerZero): Ditto.
(GetCardinalOne): Ditto.
(GetCardinalZero): Ditto.
(GetSizeOfInBits): Ditto.
(GetSizeOf): Ditto.
(BuildLogicalRotate): Ditto.
(BuildLRRn): Ditto.
(BuildLRLn): Ditto.
(BuildMask): Ditto.
(BuildMult): Ditto.
(BuildMultCheck): Ditto.
(BuildLRR): Ditto.
(BuildLRL): Ditto.
(BuildLogicalShift): Ditto.
(BuildLSR): Ditto.
(BuildLSL): Ditto.
(BuildDivM2): Ditto.
(BuildDivM2Check): Ditto.
(BuildModM2): Ditto.
(BuildModM2Check): Ditto.
(BuildModFloor): Ditto.
(BuildDivCeil): Ditto.
(BuildModCeil): Ditto.
(BuildDivFloor): Ditto.
(BuildModTrunc): Ditto.
(BuildDivTrunc): Ditto.
(BuildDivTruncCheck): Ditto.
(BuildRDiv): Ditto.
(BuildSubCheck): Ditto.
(BuildAddCheck): Ditto.
(BuildSub): Ditto.
(BuildAdd): Ditto.
(FoldAndStrip): Ditto.
(StringLength): Ditto.
(TreeOverflow): Ditto.
(RemoveOverflow): Ditto.
(BuildCoerce): Ditto.
(BuildTrunc): Ditto.
(BuildNegate): Ditto.
(BuildNegateCheck): Ditto.
(BuildSetNegate): Ditto.
(BuildTBitSize): Ditto.
(BuildSize): Ditto.
(BuildAddr): Ditto.
(BuildOffset1): Ditto.
(BuildOffset): Ditto.
(BuildLogicalOrAddress): Ditto.
(BuildLogicalOr): Ditto.
(BuildLogicalAnd): Ditto.
(BuildSymmetricDifference): Ditto.
(BuildLogicalDifference): Ditto.
(BuildLessThan): Ditto.
(BuildGreaterThan): Ditto.
(BuildLessThanOrEqual): Ditto.
(BuildGreaterThanOrEqual): Ditto.
(BuildEqualTo): Ditto.
(BuildNotEqualTo): Ditto.
(BuildIsSuperset): Ditto.
(BuildIsNotSuperset): Ditto.
(BuildIsSubset): Ditto.
(BuildIsNotSubset): Ditto.
(BuildIfConstInVar): Ditto.
(BuildIfNotConstInVar): Ditto.
(BuildIfVarInVar): Ditto.
(BuildIfNotVarInVar): Ditto.
(BuildForeachWordInSetDoIfExpr): Ditto.
(BuildIfInRangeGoto): Ditto.
(BuildIfNotInRangeGoto): Ditto.
(BuildArray): Ditto.
(BuildComponentRef): Ditto.
(BuildIndirect): Ditto.
(IsTrue): Ditto.
(IsFalse): Ditto.
(GetCstInteger): Ditto.
(AreConstantsEqual): Ditto.
(AreRealOrComplexConstantsEqual): Ditto.
(DetermineSign): Ditto.
(BuildCap): Ditto.
(BuildAbs): Ditto.
(BuildRe): Ditto.
(BuildIm): Ditto.
(BuildCmplx): Ditto.
(BuildBinaryForeachWordDo): Ditto.
(BuildBinarySetDo): Ditto.
(ConstantExpressionWarning): Ditto.
(BuildAddAddress): Ditto.
(calcNbits): Ditto.
(OverflowZType): Ditto.
(BuildCondIfExpression): Ditto.
* gm2-gcc/m2linemap.def (CDataTypes): Import ConstCharStar.
* gm2-gcc/m2misc.def (m2tree): Replace with ...
(gcctypes): ... this.
(DebugTree): Replace Tree with tree.
* gm2-gcc/m2pp.def (m2tree): Replace with ...
(gcctypes): ... this.
(DumpGimpleFd): Replace Tree with tree.
* gm2-gcc/m2statement.cc (m2statement_BuildBuiltinCallTree):
Remove unused location parameter.
* gm2-gcc/m2statement.def (m2linemap): Replace with ...
(gcctypes): ... this.
(CDataTypes): Import CharStar.
(DoJump): Replace Tree with tree.
Replace ADDRESS with CharStar.
(BuildStartFunctionCode): Replace Tree with tree.
(BuildEndFunctionCode): Ditto.
(BuildReturnValueCode): Ditto.
(BuildAssignmentTree): Ditto.
(BuildAssignmentStatement): Ditto.
(BuildGoto): Ditto.
(DeclareLabel): Ditto.
(BuildIfThenDoEnd): Ditto.
(BuildIfThenElseEnd): Ditto.
(BuildParam): Ditto.
(BuildFunctionCallTree): Ditto.
(BuildProcedureCallTree): Ditto.
(BuildIndirectProcedureCallTree): Ditto.
(BuildFunctValue): Ditto.
(BuildCall2): Ditto.
(BuildCall3): Ditto.
(SetLastFunction): Ditto.
(GetLastFunction): Ditto.
(GetParamTree): Ditto.
(BuildTryFinally): Ditto.
(BuildCleanUp): Ditto.
(BuildAsm): Ditto.
(BuildUnaryForeachWordDo): Ditto.
(BuildExcludeVarConst): Ditto.
(BuildExcludeVarVar): Ditto.
(BuildIncludeVarConst): Ditto.
(BuildIncludeVarVar): Ditto.
(BuildStart): Ditto.
(BuildEnd): Ditto.
(BuildCallInner): Ditto.
(BuildBuiltinCallTree):  Remove unused location parameter.
* gm2-gcc/m2statement.h (m2statement_BuildBuiltinCallTree): Remove
unused location parameter.
* gm2-gcc/m2tree.def (gcctypes): Import tree.
(IsAConstant): Replace Tree with tree.
(IsOrdinal): Ditto.
(IsTreeOverflow): Ditto.
(skip_const_decl): Ditto.
(skip_type_decl): Ditto.
(is_type): Ditto.
(is_array): Ditto.
(is_var): Ditto.
(debug_tree): Ditto.
(IstreeOverflow): Ditto.
* gm2-gcc/m2treelib.def (m2linemap): Replace with ...
(gcctypes): ... this.
(get_set_address_if_var): Ditto.
(get_set_field_rhs): Ditto.
(get_set_field_lhs): Ditto.
(get_set_address): Ditto.
(get_set_value): Ditto.
(get_field_no): Ditto.
(get_rvalue): Ditto.
(DoCall): Ditto.
(build_modify_expr): Ditto.
(do_jump_if_bit): Ditto.
* gm2-gcc/m2type.def (m2linemap): Replace with ...
(gcctypes): ... this.
(m2tree): Remove.
(CDataTypes): Import ConstCharStar and charStar.
(ValueInTypeRange): Replace Tree with tree.
(ValueOutOfTypeRange): Ditto.
(ExceedsTypeRange): Ditto.
(WithinTypeRange): Ditto.
(BuildSubrangeType): Ditto.
(BuildCharConstant): Ditto.
(BuildCharConstantChar): Ditto.
(BuildArrayConstructorElement): Ditto.
(BuildEndArrayConstructor): Ditto.
(BuildStartArrayConstructor): Ditto.
(BuildRecordConstructorElement): Ditto.
(BuildEndRecordConstructor): Ditto.
(BuildStartRecordConstructor): Ditto.
(BuildEndSetConstructor): Ditto.
(BuildSetConstructorElement): Ditto.
(BuildStartSetConstructor): Ditto.
(BuildSetType): Ditto.
(BuildConstPointerType): Ditto.
(BuildPointerType): Ditto.
(BuildEnumerator): Ditto.
(BuildEndEnumeration): Ditto.
(BuildStartEnumeration): Ditto.
(BuildTypeDeclaration): Ditto.
(GetMaxFrom): Ditto.
(GetMinFrom): Ditto.
(GetDefaultType): Ditto.
(BuildEndType): Ditto.
(BuildStartType): Ditto.
(BuildVariableArrayAndDeclare): Ditto.
(BuildProcTypeParameterDeclaration): Ditto.
(BuildStartFunctionType): Ditto.
(BuildEndFunctionType): Ditto.
(GetTreeType): Ditto.
(DeclareKnownType): Ditto.
(GetM2ZType): Ditto.
(GetM2RType): Ditto.
(BuildSetTypeFromSubrange): Ditto.
(BuildSmallestTypeRange): Ditto.
(GetBooleanType): Ditto.
(GetBooleanFalse): Ditto.
(GetBooleanTrue): Ditto.
(GetPackedBooleanType): Ditto.
(GetCharType): Ditto.
(GetByteType): Ditto.
(GetVoidType): Ditto.
(GetBitnumType): Ditto.
(GetRealType): Ditto.
(GetLongRealType): Ditto.
(GetShortRealType): Ditto.
(GetLongIntType): Ditto.
(GetPointerType): Ditto.
(GetCardinalType): Ditto.
(GetIntegerType): Ditto.
(GetWordType): Ditto.
(GetM2CardinalType): Ditto.
(GetBitsetType): Ditto.
(GetM2CType): Ditto.
(GetProcType): Ditto.
(GetM2ComplexType): Ditto.
(GetM2LongComplexType): Ditto.
(GetM2ShortComplexType): Ditto.
(GetM2Complex128): Ditto.
(GetM2Complex96): Ditto.
(GetM2Complex64): Ditto.
(GetM2Complex32): Ditto.
(GetM2Real128): Ditto.
(GetM2Real96): Ditto.
(GetM2Real64): Ditto.
(GetM2Real32): Ditto.
(GetM2Bitset32): Ditto.
(GetM2Bitset16): Ditto.
(GetM2Bitset8): Ditto.
(GetM2Word64): Ditto.
(GetM2Word32): Ditto.
(GetM2Word16): Ditto.
(GetM2Cardinal64): Ditto.
(GetM2Cardinal32): Ditto.
(GetM2Cardinal16): Ditto.
(GetM2Cardinal8): Ditto.
(GetM2Integer64): Ditto.
(GetM2Integer32): Ditto.
(GetM2Integer16): Ditto.
(GetM2Integer8): Ditto.
(GetISOLocType): Ditto.
(GetISOByteType): Ditto.
(GetISOWordType): Ditto.
(GetShortCardType): Ditto.
(GetM2ShortCardType): Ditto.
(GetShortIntType): Ditto.
(GetM2ShortIntType): Ditto.
(GetM2LongCardType): Ditto.
(GetM2LongIntType): Ditto.
(GetM2LongRealType): Ditto.
(GetM2RealType): Ditto.
(GetM2ShortRealType): Ditto.
(GetM2IntegerType): Ditto.
(GetM2CharType): Ditto.
(GetCSizeTType): Ditto.
(GetCSSizeTType): Ditto.
(BuildArrayStringConstructor): Ditto.
(RealToTree): Ditto.
(BuildStartRecord): Ditto.
(BuildStartUnion): Ditto.
(BuildStartVarient): Ditto.
(BuildEndVarient): Ditto.
(BuildStartFieldVarient): Ditto.
(BuildEndFieldVarient): Ditto.
(BuildStartFieldRecord): Ditto.
(BuildFieldRecord): Ditto.
(ChainOn): Ditto.
(ChainOnParamValue): Ditto.
(AddStringToTreeList): Ditto.
(BuildEndRecord): Ditto.
(SetAlignment): Ditto.
(SetDeclPacked): Ditto.
(SetTypePacked): Ditto.
(SetRecordFieldOffset): Ditto.
(BuildPackedFieldRecord): Ditto.
(BuildNumberOfArrayElements): Ditto.
(AddStatement): Ditto.
(MarkFunctionReferenced): Ditto.
(BuildArrayIndexType): Ditto.
(GetArrayNoOfElements): Ditto.
(BuildEndArrayType): Ditto.
(PutArrayType): Ditto.
(BuildStartArrayType): Ditto.
(IsAddress): Ditto.
(SameRealType): Ditto.
* m2.flex (Gm2linemap.h): Include.
* mc-boot/GDynamicStrings.cc: Rebuild.
* mc-boot/GFIO.cc: Ditto.
* mc-boot/GIndexing.cc: Ditto.
* mc-boot/GM2Dependent.cc: Ditto.
* mc-boot/GSArgs.cc: Ditto.
* mc-boot/GStringConvert.cc: Ditto.
* mc-boot/Gdecl.cc: Ditto.
* mc-boot/Gdecl.h: Ditto.
* mc-boot/Gdtoa.h: Ditto.
* mc-boot/Gkeyc.cc: Ditto.
* mc-boot/Gkeyc.h: Ditto.
* mc-boot/Glibc.h: Ditto.
* mc-boot/GmcComp.cc: Ditto.
* mc-boot/GmcLexBuf.cc: Ditto.
* mc-boot/GmcPreprocess.cc: Ditto.
* mc-boot/GmcStream.cc: Ditto.
* mc-boot/Gmcp1.cc: Ditto.
* mc-boot/Gmcp3.cc: Ditto.
* mc-boot/Gmcp4.cc: Ditto.
* mc-boot/Gmcp5.cc: Ditto.
* mc-boot/GnameKey.cc: Ditto.
* mc-boot/Gvarargs.cc: Ditto.
* mc/decl.def (putDefUnqualified): New procedure function.
(isDefUnqualified): Ditto.
* mc/decl.mod (defT): Add unqualified field.
(charStarN): New variable.
(constCharStarN): Ditto.
(checkGccType): New procedure.
(checkCDataTypes): Ditto.
(import): Call checkGccType and checkCDataTypes.
(putDefUnqualified): New procedure function.
(isDefUnqualified): Ditto.
* mc/keyc.def (useGccTree): New procedure.
(useGccLocation): Ditto.
* mc/keyc.mod (checkGccConfigSystem): Call checkGccConfigSystem.
(useGccTree): New procedure.
(useGccLocation): Ditto.
* mc/mcp1.bnf (decl): Import putDefUnqualified.
(Export): Call putDefUnqualified.
* gm2-gcc/CDataTypes.def: New file.
* gm2-gcc/gcctypes.def: New file.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2 days agoAVR: Tweak >= and < compares with consts that are 0 mod 256.
Georg-Johann Lay [Sun, 15 Sep 2024 14:58:09 +0000 (15 16:58 +0200)]
AVR: Tweak >= and < compares with consts that are 0 mod 256.

The >= and < comparisons may skip comparing the lower bytes when
the according bytes of the constant are all zeros.  For example,

    uint16 >= 0x1200

is true iff

    hi8 (uint16) >= hi8 (0x1200)

and similar for uint16 < 0x1200.  Some comparisons against constants
that are an integral power of 256 where already handled in the split
preparation.  That code has been outsourced to new avr_maybe_cmp_lsr()
which may change the operands such that the resulting insns become
a comparison of the high bytes against 0 plus a EQ / NE branch.
For example,

    uint32 >= 0x10000

can be rewritten as

    (uint32 >> 16) != 0.

The according asm output is performed by new avr_out_cmp_lsr().

gcc/
* config/avr/avr-protos.h (avr_out_cmp_lsr, avr_maybe_cmp_lsr): New.
* config/avr/avr.cc (avr_maybe_cmp_lsr, avr_out_cmp_lsr): New functions.
(avr_out_compare) [GEU, LTU]: Start output at byte CTZ(xval) / 8.
(avr_adjust_insn_length) [ADJUST_LEN_CMP_LSR]: Handle case.
* config/avr/avr.md (adjust_len) <cmp_lsr>: New attr value.
(*cmp<mode>_lsr): New define_insn_and_split.
(cbranch<mode>4_insn): When splitting, run avr_maybe_cmp_lsr()
which may map the operands to *cmp<mode>_lsr.
gcc/testsuite/
* gcc.target/avr/torture/cmp-lsr-i32.c: New test.
* gcc.target/avr/torture/cmp-lsr-u16.c: New test.
* gcc.target/avr/torture/cmp-lsr-u24.c: New test.
* gcc.target/avr/torture/cmp-lsr-u32.c: New test.
* gcc.target/avr/torture/cmp-lsr-u64.c: New test.

2 days agoriscv: Fix duplicate assmbler label in @tlsdesc<mode> insn
Andreas Schwab [Thu, 12 Sep 2024 11:55:09 +0000 (12 13:55 +0200)]
riscv: Fix duplicate assmbler label in @tlsdesc<mode> insn

Use %= instead of maintaining a sequence number manually, so that it
doesn't result in a duplicate assembler label when the insn is duplicated.

PR target/116693
* config/riscv/riscv.cc (riscv_legitimize_tls_address): Don't pass
seqno to gen_tlsdesc and remove it.
* config/riscv/riscv.md (@tlsdesc<mode>): Remove operand 1.  Use
%= instead of %1 in template.

2 days agolibstdc++: Add .editorconfig files
Jonathan Wakely [Mon, 16 Sep 2024 09:04:40 +0000 (16 10:04 +0100)]
libstdc++: Add .editorconfig files

These config files set default formatting behaviour for a large number
of common editors, see https://editorconfig.org

The root=true setting in libstdc++-v3/.editorconfig prevents looking in
parent directories for additional settings. If we add a .editorconfig at
the top-level we might want to use root=true there instead, and allow
libstdc++-v3/.editorconfig to inherit some some settings from there (and
only override things we want to do differently).

libstdc++-v3/ChangeLog:

* .editorconfig: New file.
* include/std/.editorconfig: New file.

3 days agovect: Set pattern_stmt_p on the newly created stmt_vec_info
Andrew Pinski [Sun, 15 Sep 2024 23:43:24 +0000 (15 16:43 -0700)]
vect: Set pattern_stmt_p on the newly created stmt_vec_info

While adding simple_dce_worklist to the vectorizer, there was a regression
due to the slp patterns would create a SSA name but never free it even if it
never existed in the IR (this case as addsub but complex ones had the same issue).
The reason why it was never freed was the stmt_vec_info was not marked as a pattern stmt,
unlike the other pattern stmts that use vect_init_pattern_stmt instead of vec_info::add_pattern_stmt
(which is used for SLP patterns).

Bootstrapped and tested on x86_64-linux-gnu.

gcc/ChangeLog:

* tree-vectorizer.cc (vec_info::add_pattern_stmt): Set pattern_stmt_p.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
3 days agoAVR: Tidy up enum and struct tags.
Georg-Johann Lay [Sat, 14 Sep 2024 10:19:52 +0000 (14 12:19 +0200)]
AVR: Tidy up enum and struct tags.

Use "rtx_code" for RTX codes, not "enum rtx_code" and not "RTX_CODE".
Drop enum and struct tags if possible.

gcc/
* config/avr/avr.cc: Use rtx_code for RTX codes.
Drop enum and struct tags.
* config/avr/avr.md: Same.
* config/avr/avr-c.cc: Same.
* config/avr/avr-dimode.md: Same.
* config/avr/avr-passes.cc: Same.
* config/avr/avr-protos.h: Same.

3 days agoAVR: Partially revert r15-3623.
Georg-Johann Lay [Sun, 15 Sep 2024 18:37:48 +0000 (15 20:37 +0200)]
AVR: Partially revert r15-3623.

ADIW doesn't mix with CPC / SBIC because it's not only about
propagating the Z flag but also about carry.

gcc/
* config/avr/avr.cc (avr_out_compare): Don't mix ADIW with SBCI / CPC.

3 days agolibstdc++: Update link to installation docs
Gerald Pfeifer [Mon, 16 Sep 2024 01:02:55 +0000 (16 08:02 +0700)]
libstdc++: Update link to installation docs

libstdc++-v3:
* doc/xml/manual/intro.xml: Update link to installation docs.
* doc/html/manual/make.html: Regenerate.

3 days agoDaily bump.
GCC Administrator [Mon, 16 Sep 2024 00:17:42 +0000 (16 00:17 +0000)]
Daily bump.

3 days agofortran: Remove useless nested end of scalarization chain handling
Mikael Morin [Sun, 7 Jul 2024 09:00:51 +0000 (7 11:00 +0200)]
fortran: Remove useless nested end of scalarization chain handling

Remove the special handling of end of nested scalarization chains, which
advanced the chain to an element of a parent chain when the current one
was reaching its end.

That handling was superfluous as nested chains correspond to nested
scalarizations of subexpressions and the scalarizations don't extend beyond
their associated subexpression and don't use any scalarisation element from
the parent expression.

No change of behaviour, as the GFC_SE struct is supposed to be in its final
state anyway when the last element from the chain has been consumed.

gcc/fortran/ChangeLog:

* trans-expr.cc (gfc_advance_se_ss_chain): Don't use an element
from the parent scalarization chain when the current chain reaches
its end.

3 days agoc++: __extension__ and -Wconditionally-supported
Jason Merrill [Sun, 15 Sep 2024 09:34:43 +0000 (15 11:34 +0200)]
c++: __extension__ and -Wconditionally-supported

When we're explicitly choosing GCC extensions, we similarly shouldn't
complain about optional features that GCC provides.  This particular pattern
of cast between function and object pointer is used by gthr-posix.h on some
targets, including linux-gnu before glibc 2.34.

gcc/cp/ChangeLog:

* parser.cc (cp_parser_unary_expression) [RID_EXTENSION]: Also
suppress -Wconditionally-supported.

gcc/testsuite/ChangeLog:

* g++.dg/warn/Wconditionally-supported-1.C: Add __extension__ cases.

3 days agoc++: conversion location
Jason Merrill [Sun, 15 Sep 2024 14:02:13 +0000 (15 16:02 +0200)]
c++: conversion location

It seems more useful for a conversion to have the location of the source
expression rather than the enclosing expression, such as a call that might
convert multiple arguments in different ways.

As a result, in srcloc17.C the recorded location of 'e' when
copy-initialized became that of the initializer rather than the variable,
since the semantic was to convert the initializer (at its location) and then
initialize the variable from the resulting prvalue.  If we instead
direct-initialize the variable, the location of the constructor call is that
of the variable.

gcc/cp/ChangeLog:

* call.cc (convert_like_internal) [ck_user]: Use iloc_sentinel.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/srcloc17.C: Adjust initialization.

3 days agolibstdc++: Adjust std::span::iterator to be ADL-proof
Jonathan Wakely [Wed, 4 Sep 2024 20:31:58 +0000 (4 21:31 +0100)]
libstdc++: Adjust std::span::iterator to be ADL-proof

Because std::span<Incomplete> can be useful, it makes sense to define
std::span<Incomplete>::iterator such that Incomplete is not an
associated class, and so the compiler won't attempt to complete it when
doing ADL for span iterators (including during the definition of
std::span<Incomplete>::const_iterator which checks that iterator
satisfies std::input_or_output_iterator).

We can't make this change for std::vector<Incomplete> because it would
change the mangled name of std::vector<Incomplete>::iterator which would
affect the mangled names of templates and functions written by users.

We can do the same thing for std::basic_stacktrace<Alloc> just so that
Alloc is not an associated class. This is probably less beneficial, as
Alloc can't be incomplete, and using SomeAllocator<Incomplete> as the
allocator parameter doesn't seem useful. But simply making the
stacktrace iterator not use Alloc for ADL lookup seems worthwhile. This
is doable because std::stacktrace is part of C++23 so its ABI isn't
considered stable yet.

libstdc++-v3/ChangeLog:

* include/std/span (span::__iter_tag): Declare nested type.
(span::iterator): Use __iter_tag as second template argument.
* include/std/stacktrace (basic_stacktrace::iterator): Use _Impl
as second template argument.

3 days agolibstdc++: Enable most of <chrono> for freestanding
Jonathan Wakely [Mon, 15 Jan 2024 14:09:21 +0000 (15 14:09 +0000)]
libstdc++: Enable most of <chrono> for freestanding

This makes durations, time points and calendrical types available for
freestanding. The clocks and time zone utilities are disabled for
freestanding, as they require functions in the hosted lib.

Add support for a new macro _GLIBCXX_NO_FREESTANDING_CHRONO which can be
used to explicitly disable <chrono> for freestanding.

libstdc++-v3/ChangeLog:

* doc/xml/manual/using.xml (_GLIBCXX_NO_FREESTANDING_CHRONO):
Document macro.
* doc/html/*: Regenerate.
* include/bits/chrono.h [_GLIBCXX_NO_FREESTANDING_CHRONO]:
Only include <bits/require_hosted.h> when this macro is defined.
[_GLIBCXX_HOSTED]: Only define clocks for hosted.
* include/bits/version.def (chrono_udls): Remove hosted=yes.
* include/bits/version.h: Regenerate.
* include/std/chrono [_GLIBCXX_HOSTED]: Only define clocks and
time zone utilities for hosted.
* testsuite/std/time/freestanding.cc: New test.

3 days agolibstdc++: Add assertion for valid facet type arguments
Jonathan Wakely [Wed, 22 May 2024 15:49:31 +0000 (22 16:49 +0100)]
libstdc++: Add assertion for valid facet type arguments

LWG 436 confirmed that const-qualified types are valid arguments for
Facet template parameters, but volatile-qualified types are not.  Add an
assertion to locale::combine to check for valid types.

libstdc++-v3/ChangeLog:

* include/bits/locale_classes.h (__is_facet): New helper.
* include/bits/locale_classes.tcc (locale::combine): Check that
_Facet type is valid.

3 days agolibstdc++: Make PSTL algorithms accept C++20 iterators [PR110512]
Jonathan Wakely [Tue, 9 Jan 2024 23:39:14 +0000 (9 23:39 +0000)]
libstdc++: Make PSTL algorithms accept C++20 iterators [PR110512]

This is a step towards implementing the C++23 change P2408R5, "Ranges
iterators as inputs to non-Ranges algorithms". C++20 random access
iterators which do not meet the Cpp17RandomAccessIterator requirements
will now be recognized by the PSTL algorithms.

As noted by Patrick, P2408R5 only relaxes the requirements for
non-mutating algorithms, but this relaxes them for all parallel
algorithms. I believe that's OK. A call with a type which previously
didn't compile at all was undefined, so we're allowed to start accepting
those calls if the type satisfies std::random_access_iterator. However,
this also causes a change in behaviour for calls with arguments which
satisfy std::random_access_iterator and meet the Cpp17ForwardIterator
requirements but not the Cpp17RandomAccessIterator requirements. The
algorithms will dispatch to a different implementation now. I believe
that's also OK. The algorithms should give the same results whether
acting on forward iterators or random access iterators, just more
efficiently for the latter.

Additionally, we can optimize the C++17 implementation by using
std::__and_, and use std::__remove_cvref_t and std::__iter_category_t
for readability.  This diverges from the upstream PSTL, but since libc++
is no longer using that upstream (so we're the only consumer of this
code) I think it's reasonable to use libstdc++ extensions in localized
places like this. Rebasing this small header on upstream should not be
difficult.

libstdc++-v3/ChangeLog:

PR libstdc++/110512
* include/pstl/execution_impl.h (__are_random_access_iterators):
Recognize C++20 random access iterators, and use more efficient
implementations.
* testsuite/25_algorithms/pstl/110512.cc: New test.

4 days agoc++, coroutines: Fix handling of bool await_suspend() [PR115905].
Iain Sandoe [Fri, 6 Sep 2024 19:59:43 +0000 (6 20:59 +0100)]
c++, coroutines: Fix handling of bool await_suspend() [PR115905].

As noted in the PR the action of the existing implementation was to
treat a false value from await_suspend () as equivalent to "do not
suspend".  Actually it needs to be the equivalent of "resume" - and
we need to restart the dispatcher - since the await_suspend() body
could have already resumed the coroutine.
See also https://github.com/cplusplus/CWG/issues/601 (NAD) for more
discussion.

Since we need to amend the await expansion and the actor build, take
the opportunity to clean up and modernise the code there.  Note that
we need to make the jump back to the dispatcher without any scope
exit cleanups (so we have to use the .CO_SUSPN IFN to do this).

PR c++/115905

gcc/cp/ChangeLog:

* coroutines.cc (struct coro_aw_data): Add a member for the
restart dispatch label.
(expand_one_await_expression): Rework to modernise and to
handle the boolean await_suspend() case.
(build_actor_fn): Rework the dispatcher and allow for a jump
back to the dispatcher.

gcc/testsuite/ChangeLog:

* g++.dg/coroutines/torture/pr115905.C: New test.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
4 days agophi-opt: Improve heuristics for factoring out with constant (again) [PR116699]
Andrew Pinski [Fri, 13 Sep 2024 17:47:29 +0000 (13 10:47 -0700)]
phi-opt: Improve heuristics for factoring out with constant (again) [PR116699]

The heuristics for factoring out with a constant checks that the assignment statement
is the last statement of the basic block but sometimes there is a predicate or a nop statement
after the assignment. Rejecting this case does not make sense since both predicates and nop
statements are removed and don't contribute any instructions. So we should skip over them
when checking if the assignment statement was the last statement in the basic block.

phi-opt-factor-1.c's f0 is such an example where it should catch it at phiopt1 (before predicates are removed)
and should happen in a similar way as f1 (which uses a temporary variable rather than return).

Bootstrapped and tested on x86_64-linux-gnu.

PR tree-optimization/116699

gcc/ChangeLog:

* tree-ssa-phiopt.cc (factor_out_conditional_operation): Skip over nop/predicates
for seeing the assignment is the last statement.

gcc/testsuite/ChangeLog:

* gcc.dg/tree-ssa/phi-opt-factor-1.c: New test.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
4 days agovect: release defs of removed statement
Andrew Pinski [Sat, 14 Sep 2024 03:27:32 +0000 (13 20:27 -0700)]
vect: release defs of removed statement

While trying to add use of simple_dce_from_worklist
to the vectorizer so we don't need to run a full blown
DCE pass after the vectorizer, there was a crash noticed
due to a ssa name which has a stmt without a bb. This was
due to not calling release_defs after the call to gsi_remove.

Note the code to remove zero use statements should be able to
remove once the use of simple_dce_from_worklist has been added.
But in the meantime, fixing this bug will also improve memory
usage and a few other things which look through all ssa names.

gcc/ChangeLog:

* tree-vect-loop.cc (optimize_mask_stores): Call release_defs
after the call to gsi_remove with last argument of true.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
4 days agoMark the copy/move constructor/operator= of auto_bitmap as delete
Andrew Pinski [Sat, 14 Sep 2024 03:17:15 +0000 (13 20:17 -0700)]
Mark the copy/move constructor/operator= of auto_bitmap as delete

Since we are written in C++11, these should be marked as delete rather
than just private.

Bootstrapped and tested on x86_64-linux-gnu.

gcc/ChangeLog:

* bitmap.h (class auto_bitmap): Mark copy/move constructor/operator=
as deleted.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
4 days agoDaily bump.
GCC Administrator [Sun, 15 Sep 2024 00:16:32 +0000 (15 00:16 +0000)]
Daily bump.

4 days agotestsuite; Fix execute/pr52286.c for 16bit
Andrew Pinski [Sat, 14 Sep 2024 19:55:07 +0000 (14 12:55 -0700)]
testsuite; Fix execute/pr52286.c for 16bit

The code path which was added for 16bit had a broken inline-asm which would
only assign maybe half of the registers for the `long` type to 0.

Adding L to the input operand of the inline-asm fixes the issue by now assigning
the full 32bit value of the input register that would match up with the output register.

Fixes r0-115223-gb0408f13d4b317 which added the 16bit code path to fix the testcase for 16bit.

Pushed as obvious.

PR testsuite/116716

gcc/testsuite/ChangeLog:

* gcc.c-torture/execute/pr52286.c: Fix inline-asm for 16bit case.

4 days agoc++: avoid init_priority warning in system header
Jason Merrill [Sat, 14 Sep 2024 09:46:22 +0000 (14 11:46 +0200)]
c++: avoid init_priority warning in system header

We don't want a warning about a reserved init_priority in a system header
even with -Wsystem-headers.

gcc/cp/ChangeLog:

* tree.cc (handle_init_priority_attribute): Check
in_system_header_at.

4 days agoc++: Don't mix timevar_start and auto_cond_timevar for TV_NAME_LOOKUP [PR116681]
Simon Martin [Fri, 13 Sep 2024 14:40:22 +0000 (13 16:40 +0200)]
c++: Don't mix timevar_start and auto_cond_timevar for TV_NAME_LOOKUP [PR116681]

We currently ICE upon the following testcase when using -ftime-report

=== cut here ===
template < int> using __conditional_t = int;
template < typename _Iter >
concept random_access_iterator = requires { new _Iter; };
template < typename _Iterator >
struct reverse_iterator {
  using iterator_concept =
    __conditional_t< random_access_iterator< _Iterator>>;
};
void RemoveBottom() {
  int iter;
  for (reverse_iterator< int > iter;;)
      ;
}
=== cut here ===

The problem is that qualified_namespace_lookup does a plain start() of
the TV_NAME_LOOKUP timer (that asserts that the timer is not already
started). However this timer has already been cond_start()'d in the call
stack - by pushdecl - so the assert fails.

This patch simply ensures that we always conditionally start this timer
(which is done in all other places that use it).

PR c++/116681

gcc/cp/ChangeLog:

* name-lookup.cc (qualified_namespace_lookup): Use an
auto_cond_timer instead of using timevar_start and timevar_stop.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/concepts-pr116681.C: New test.

4 days agoAVR: Use rtx code copysign.
Georg-Johann Lay [Sat, 14 Sep 2024 08:12:54 +0000 (14 10:12 +0200)]
AVR: Use rtx code copysign.

gcc/
* config/avr/avr.md (UNSPEC_COPYSIGN): Remove define_enum.
(copysignsf3): Use copysign instead of UNSPEC_COPYSIGN.
Allow const_double for operand 2.

4 days agolibstdc++: Tweak localized formatting for floating-point types
Jonathan Wakely [Mon, 29 Apr 2024 17:16:29 +0000 (29 18:16 +0100)]
libstdc++: Tweak localized formatting for floating-point types

libstdc++-v3/ChangeLog:

* include/std/format (__formatter_fp::_M_localize): Add comments
and micro-optimize string copy.

4 days agolibstdc++: Refactor loops in std::__platform_semaphore
Jonathan Wakely [Mon, 2 Sep 2024 11:29:04 +0000 (2 12:29 +0100)]
libstdc++: Refactor loops in std::__platform_semaphore

Refactor the loops to all use the same form, and to not need explicit
'break' or 'continue' jumps. This also avoids a -Wunused-variable
warning with -Wsystem-headers.

Also fix a bug for absolute timeouts specified with a time that isn't
implicitly convertible to __clock_t::time_point, e.g. one with a higher
resolution such as picoseconds. Use chrono::ceil to round up to the next
time point representable by the clock.

libstdc++-v3/ChangeLog:

* include/bits/semaphore_base.h (__platform_semaphore): Refactor
loops to all use similar forms.
(__platform_semaphore::_M_try_acquire_until): Use chrono::ceil
to explicitly convert to __clock_t::time_point.
* testsuite/30_threads/semaphore/try_acquire_for.cc: Check that
using a very high resolution timeout compiles.
* testsuite/30_threads/semaphore/platform_try_acquire_for.cc:
New test.

4 days agotestsuite: adjust pragma-diag-17.c diagnostics
Jason Merrill [Fri, 13 Sep 2024 13:52:02 +0000 (13 15:52 +0200)]
testsuite: adjust pragma-diag-17.c diagnostics

The Linaro CI runs of this testcase pointed out that I need to check for DFP
support, as well.

gcc/testsuite/ChangeLog:

* c-c++-common/pragma-diag-17.c: Handle !dfp targets.

4 days agoc++: Fix g++.dg/ext/sve-sizeless-1.C regression
Jonathan Wakely [Fri, 13 Sep 2024 07:18:53 +0000 (13 08:18 +0100)]
c++: Fix g++.dg/ext/sve-sizeless-1.C regression

This aarch64-*-* test needs an update for the diagnostic I changed in
r15-3614-g9fe57e4879de93.

gcc/testsuite/ChangeLog:

* g++.dg/ext/sve-sizeless-1.C: Adjust dg-error string.

5 days agotestsuite: a few more hostedlib adjustments
Alexandre Oliva [Sat, 14 Sep 2024 00:42:41 +0000 (13 21:42 -0300)]
testsuite: a few more hostedlib adjustments

This adjusts some recently-added tests that won't compile without a
hostedlib libstdc++, missed in the patch that just went in, and also
an old test that I'd missed because it also failed in my baseline.

for  gcc/testsuite/ChangeLog

* g++.dg/coroutines/pr108620.C: Skip if !hostedlib because of
unavailable headers.
* g++.dg/other/profile1.C: Likewise.
* g++.dg/ext/pragma-unroll-lambda-lto.C: Skip if !hostedlib
because of unavailable declarations.

5 days agoDaily bump.
GCC Administrator [Sat, 14 Sep 2024 00:16:52 +0000 (14 00:16 +0000)]
Daily bump.

5 days agoAVR: Detect more skip opportunities.
Georg-Johann Lay [Fri, 13 Sep 2024 16:06:57 +0000 (13 18:06 +0200)]
AVR: Detect more skip opportunities.

The transparent call insns like "*parityhi2.libgcc" output a single
[R]CALL instruction that can be skipped by the skip instructions.
Such insns have attribute "type" of "xcall" and can therefore
be easily recognized.  Same applies when "adjust_len" is "call".

gcc/
* config/avr/avr.cc (avr_2word_insn_p): Return true for
transparent calls: When insn attribute "type" is "xcall"
or when "adjust_len" is "call".

5 days agoFix factor_out_conditional_operation heuristics for constants
Andrew Pinski [Thu, 12 Sep 2024 05:10:53 +0000 (11 22:10 -0700)]
Fix factor_out_conditional_operation heuristics for constants

While working on a different patch, I noticed the heuristics were not
doing the right thing if there was statements before the NOP/PREDICTs.
(LABELS don't have other statements before them).

This fixes that oversight which was added in r15-3334-gceda727dafba6e.

Bootstrapped and tested on x86_64-linux-gnu.

gcc/ChangeLog:

* tree-ssa-phiopt.cc (factor_out_conditional_operation): Instead
of just ignorning a NOP/PREDICT, skip over them before checking
the heuristics.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
5 days agoAVR: Use avr_byte instead of simplify_gen_subreg (QImode, ...
Georg-Johann Lay [Fri, 13 Sep 2024 10:50:31 +0000 (13 12:50 +0200)]
AVR: Use avr_byte instead of simplify_gen_subreg (QImode, ...

There are many places where asm output functions have to look at
the constituent bytes and words of the operands.  The function of
choice was simplify_gen_subreg (mode, ...) which can be replaced
by the more handy avr_byte (rtx, byte_num).

gcc/
* config/avr/avr.cc: Use functions like avr_byte,
avr_word, avr_[u]int8/16 if convenient.
(avr_uint16): New function.

5 days agoc++: -fimplicit-constexpr diagnostic improvement [PR116696]
Jason Merrill [Thu, 12 Sep 2024 20:22:02 +0000 (12 16:22 -0400)]
c++: -fimplicit-constexpr diagnostic improvement [PR116696]

PR116696 expressed surprise that explicit 'constexpr' was needed on one
function; this was because the function isn't 'inline', and
-fimplicit-constexpr doesn't try to promote non-inline functions.  Let's be
more helpful in that situation, and also help trace through functions that
were promoted.

PR c++/116696

gcc/cp/ChangeLog:

* constexpr.cc (explain_invalid_constexpr_fn): When
-fimplicit-constexpr, also explain inline functions, and point out
non-inline functions.

gcc/testsuite/ChangeLog:

* g++.dg/DRs/dr2478.C: Prune extra diagnostic.
* g++.dg/ext/fimplicit-constexpr1.C: New test.

5 days agoFortran: Fixes to OpenMP 'interop' directive parsing support
Tobias Burnus [Fri, 13 Sep 2024 14:48:57 +0000 (13 16:48 +0200)]
Fortran: Fixes to OpenMP 'interop' directive parsing support

Handle lists as argument to 'fr' and 'attr'; fix parsing corner cases.
Additionally, 'fr' values are now internally stored as integer, permitting
the diagnoses (warning) for values not defined in the OpenMP additional
definitions document.

PR fortran/116661

gcc/fortran/ChangeLog:

* gfortran.h (gfc_omp_namelist): Rename 'init' members for clarity.
* match.cc (gfc_free_omp_namelist): Handle renaming.
* dump-parse-tree.cc (show_omp_namelist): Update for new format
and features.
* openmp.cc (gfc_match_omp_prefer_type): Parse list to 'fr' and 'attr';
store 'fr' values as integer.
(gfc_match_omp_init): Rename variable names.

gcc/ChangeLog:

* omp-api.h (omp_get_fr_id_from_name, omp_get_name_from_fr_id): New
prototypes.
* omp-general.cc (omp_get_fr_id_from_name, omp_get_name_from_fr_id):
New.

include/ChangeLog:

* gomp-constants.h (GOMP_INTEROP_IFR_LAST,
GOMP_INTEROP_IFR_SEPARATOR, GOMP_INTEROP_IFR_NONE): New.

gcc/testsuite/ChangeLog:

* gfortran.dg/gomp/interop-1.f90: Extend, update dg-*.
* gfortran.dg/gomp/interop-2.f90: Update dg-error.
* gfortran.dg/gomp/interop-3.f90: Add dg-warning.

5 days agogcn/mkoffload.cc: Use #embed for including the generated ELF file
Tobias Burnus [Fri, 13 Sep 2024 14:18:46 +0000 (13 16:18 +0200)]
gcn/mkoffload.cc: Use #embed for including the generated ELF file

gcc/ChangeLog:

* config/gcn/mkoffload.cc (read_file): Remove.
(process_asm): Do not add '#include' to generated C file.
(process_obj): Generate C file that uses #embed and use
__SIZE_TYPE__ and __UINTPTR_TYPE__ instead the #include-defined
size_t and uintptr.
(main): Update call to it; remove no longer needed file I/O.

5 days agoc++: Don't emit deprecated/unavailable attribute diagnostics when creating cdtor...
Jakub Jelinek [Fri, 13 Sep 2024 14:13:01 +0000 (13 16:13 +0200)]
c++: Don't emit deprecated/unavailable attribute diagnostics when creating cdtor thunks [PR116678]

Another spot where we mark_used a function (in this case ctor or dtor)
even when it is just artificially used inside of thunks (emitted on mingw
with -Os for the testcase).

2024-09-13  Jakub Jelinek  <jakub@redhat.com>

PR c++/116678
* optimize.cc: Include decl.h.
(maybe_thunk_body): Temporarily change deprecated_state to
UNAVAILABLE_DEPRECATED_SUPPRESS.

* g++.dg/warn/deprecated-20.C: New test.

5 days agolibcpp: Fix up UB in finish_embed
Jakub Jelinek [Fri, 13 Sep 2024 14:11:05 +0000 (13 16:11 +0200)]
libcpp: Fix up UB in finish_embed

Jonathan reported on IRC that certain unnamed proprietary static analyzer
is unhappy about the new finish_embed function and it is actually right.
On a testcase like:
 #embed __FILE__ limit (0) if_empty (0)
params->if_empty.count is 1, limit is 0, so count is 0 (we need just
a single token and one fits into pfile->directive_result).  Because
count is 0, we don't allocate toks, so it stays NULL, and then in
1301      if (prefix->count)
1302        {
1303          *tok = *prefix->base_run.base;
1304          tok = toks;
1305          tokenrun *cur_run = &prefix->base_run;
1306          while (cur_run)
1307            {
1308              size_t cnt = (cur_run->next ? cur_run->limit
1309                            : prefix->cur_token) - cur_run->base;
1310              cpp_token *t = cur_run->base;
1311              if (cur_run == &prefix->base_run)
1312                {
1313                  t++;
1314                  cnt--;
1315                }
1316              memcpy (tok, t, cnt * sizeof (cpp_token));
1317              tok += cnt;
1318              cur_run = cur_run->next;
1319            }
1320        }
the *tok = *prefix->base_run.base; assignment will copy the only
token.  cur_run is still non-NULL, cnt will be initially 1 and
then decremented to 0, but we invoke UB because we do
memcpy (NULL, cur_run->base + 1, 0 * sizeof (cpp_token));
and then the loop stops because cur_run->next must be NULL.

As we don't really copy anything, toks can be anything non-NULL,
so the following patch fixes that by initializing toks also to
&pfile->directive_result (just something known to be non-NULL).
This should be harmless even for the
 #embed __FILE__ limit (1)
case (no non-empty prefix/suffix) where toks isn't allocated
either, but in that case prefix->count will be 0 and in the
1321      for (size_t i = 0; i < limit; ++i)
1322        {
1323          tok->src_loc = params->loc;
1324          tok->type = CPP_NUMBER;
1325          tok->flags = NO_EXPAND;
1326          if (i == 0)
1327            tok->flags |= PREV_WHITE;
1328          tok->val.str.text = s;
1329          tok->val.str.len = sprintf ((char *) s, "%d", buffer[i]);
1330          s += tok->val.str.len + 1;
1331          if (tok == &pfile->directive_result)
1332            tok = toks;
1333          else
1334            tok++;
1335          if (i < limit - 1)
1336            {
1337              tok->src_loc = params->loc;
1338              tok->type = CPP_COMMA;
1339              tok->flags = NO_EXPAND;
1340              tok++;
1341            }
1342        }
loop limit will be 1, so tok is initially &pfile->directive_result,
that is stilled in, then tok = toks; (previously setting tok to NULL,
now to &pfile->directive_result again) and because 0 < 1 - 1 is
false, nothing further will happen and the loop will finish (and as
params->suffix.count will be 0, nothing further will use tok).

2024-09-13  Jakub Jelinek  <jakub@redhat.com>

* files.cc (finish_embed): Initialize toks to tok rather
than NULL.

5 days agos390: Fix TF to FPRX2 conversion [PR115860]
Stefan Schulze Frielinghaus [Fri, 13 Sep 2024 13:09:55 +0000 (13 15:09 +0200)]
s390: Fix TF to FPRX2 conversion [PR115860]

Currently subregs originating from *tf_to_fprx2_0 and *tf_to_fprx2_1
survive register allocation.  This in turn leads to wrong register
renaming.  Keeping the current approach would mean we need two insns for
*tf_to_fprx2_0 and *tf_to_fprx2_1, respectively.  Something along the
lines

(define_insn "*tf_to_fprx2_0"
  [(set (subreg:DF (match_operand:FPRX2 0 "nonimmediate_operand" "=f") 0)
        (unspec:DF [(match_operand:TF 1 "general_operand" "v")]
                   UNSPEC_TF_TO_FPRX2_0))]
  "TARGET_VXE"
  "#")

(define_insn "*tf_to_fprx2_0"
  [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
        (unspec:DF [(match_operand:TF 1 "general_operand" "v")]
                   UNSPEC_TF_TO_FPRX2_0))]
  "TARGET_VXE"
  "vpdi\t%v0,%v1,%v0,1
  [(set_attr "op_type" "VRR")])

and similar for *tf_to_fprx2_1.  Note, pre register allocation operand 0
has mode FPRX2 and afterwards DF once subregs have been eliminated.

Since we always copy a whole vector register into a floating-point
register pair, another way to fix this is to merge *tf_to_fprx2_0 and
*tf_to_fprx2_1 into a single insn which means we don't have to use
subregs at all.  The downside of this is that the assembler template
contains two instructions, now.  The upside is that we don't have to
come up with some artificial insn before RA which might be more
readable/maintainable.  That is implemented by this patch.

In commit r11-4872-ge627cda5686592, the output operand specifier %V was
introduced which is used in tf_to_fprx2 only, now.  Instead of coming up
with its counterpart %F for floating-point registers, which would also
only be used in tf_to_fprx2, I print the operands directly.  This
renders %V unused which is why it is removed by this patch.

gcc/ChangeLog:

PR target/115860
* config/s390/s390.cc (print_operand): Remove operand specifier
%V.
* config/s390/s390.md (UNSPEC_TF_TO_FPRX2): New.
* config/s390/vector.md (*tf_to_fprx2_0): Remove.
(*tf_to_fprx2_1): Remove.
(tf_to_fprx2): New.

gcc/testsuite/ChangeLog:

* gcc.target/s390/vector/long-double-asm-abi.c: Adapt
scan-assembler directive.
* gcc.target/s390/vector/long-double-to-i64.c: Adapt
scan-assembler directive.
* gcc.target/s390/pr115860-1.c: New test.

5 days agos390: Fix AQ and AR constraints
Stefan Schulze Frielinghaus [Fri, 13 Sep 2024 13:05:33 +0000 (13 15:05 +0200)]
s390: Fix AQ and AR constraints

Ensure for AQ and AR constraints that the resulting displacement after
adding any positive offset less than the size of the object being
referenced is still valid.

gcc/ChangeLog:

* config/s390/s390.cc (s390_mem_constraint): Check displacement
for AQ and AR constraints.

5 days agolibstdc++: Do not use use memmove for 1-element ranges [PR108846,PR116471]
Giuseppe D'Angelo [Fri, 23 Aug 2024 13:05:54 +0000 (23 15:05 +0200)]
libstdc++: Do not use use memmove for 1-element ranges [PR108846,PR116471]

This commit ports the fixes already applied by r13-6372-g822a11a1e642e0
to the range-based versions of copy/move algorithms.

When doing so, a further bug (PR116471) was discovered in the
implementation of the range-based algorithms: although the algorithms
are already constrained by the indirectly_copyable/movable concepts,
there was a failing static_assert in the memmove path.

This static_assert checked that iterator's value type was assignable by
using the is_copy_assignable (move) type traits. However, this is a
problem, because the traits are too strict when checking for constness;
a type like

  struct S { S& operator=(S &) = default; };

is trivially copyable (and thus could benefit of the memmove path),
but it does not satisfy is_copy_assignable because the operator takes
by non-const reference.

Now, the reason for the check to be there is because a type with
a deleted assignment operator like

  struct E { E& operator=(const E&) = delete; };

is still trivially copyable, but not assignable. We don't want
algorithms like std::ranges::copy to compile because they end up
selecting the memmove path, "ignoring" the fact that E isn't even
copy assignable.

But the static_assert isn't needed here any longer: as noted before,
the ranges algorithms already have the appropriate constraints; and
even if they didn't, there's now a non-discarded codepath to deal with
ranges of length 1 where there is an explicit assignment operation.

Therefore, this commit removes it. (In fact, r13-6372-g822a11a1e642e0
removed the same static_assert from the non-ranges algorithms.)

libstdc++-v3/ChangeLog:

PR libstdc++/108846
PR libstdc++/116471
* include/bits/ranges_algobase.h (__assign_one): New helper
function.
(__copy_or_move): Remove a spurious static_assert; use
__assign_one for memcpyable ranges of length 1.
(__copy_or_move_backward): Likewise.
* testsuite/25_algorithms/copy/108846.cc: Extend to range-based
algorithms, and cover both memcpyable and non-memcpyable
cases.
* testsuite/25_algorithms/copy_backward/108846.cc: Likewise.
* testsuite/25_algorithms/copy_n/108846.cc: Likewise.
* testsuite/25_algorithms/move/108846.cc: Likewise.
* testsuite/25_algorithms/move_backward/108846.cc: Likewise.

Signed-off-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
5 days agoAVR: Rework avr_out_compare.
Georg-Johann Lay [Thu, 12 Sep 2024 12:24:53 +0000 (12 14:24 +0200)]
AVR: Rework avr_out_compare.

16-bit comparisons like R25:24 == -1 are currently performed like
    cpi R24, -1
    cpc R25, R24
Similar is possible for wider modes.  ADIW can be used like SBIW when
the compare code is EQ or NE because such comparisons are just about
(propagating) the Z flag.  The patch adds helper functions like avr_byte()
that may be useful in other functions than avr_out_compare().
Use new convenient helper functions that may be useful in
other output functions, too.

For example, with the patch

R24:SI == -1 (unused after)
    adiw r26,1
    sbci r25,hi8(-1)
    sbci r24,lo8(-1)

R18:SI == -1
    cpi r18,-1
    cpc r19,r18
    cpc r20,r18
    cpc r21,r18

Without the patch, we had:

R24:SI == -1 (unused after)
    cpi r24,-1
    sbci r25,-1
    sbci r26,-1
    sbci r27,-1

R18:SI == -1
    cpi r18,-1
    ldi r24,-1
    cpc r19,r24
    cpc r20,r24
    cpc r21,r24

gcc/
* config/avr/avr.cc (avr_chunk, avr_byte, avr_word)
(avr_int8, avr_uint8, avr_int16): New helper functions.
(avr_out_compare): Overhaul.

5 days agoAVR: Tweak 32-bit EQ and NE comparisons.
Georg-Johann Lay [Tue, 10 Sep 2024 15:51:58 +0000 (10 17:51 +0200)]
AVR: Tweak 32-bit EQ and NE comparisons.

The order in which multi-byte EQ and NE comparisons are performing
the byte comparisons does not matter, and there are situations where
using SBIW on the high word can save an instruction.

gcc/
* config/avr/avr.cc (avr_out_compare): Tweak 32-bit EQ and NE
comparisons that can use SBIW for the hi16 part.

5 days agoAVR: avr.cc - Reorder functions to require less forward decls.
Georg-Johann Lay [Tue, 10 Sep 2024 16:28:36 +0000 (10 18:28 +0200)]
AVR: avr.cc - Reorder functions to require less forward decls.

gcc/
* config/avr/avr.cc (avr_init_machine_status): Move code to...
(avr_option_override) <init_machine_status>: ...lambda.
(avr_insn_has_reg_unused_note_p): Move up.
(_reg_unused_after, reg_unused_after): Move up.
(output_reload_in_const): Move up.
(avr_c_mode_for_floating_type): Move down.

5 days agoMatch: Remove unnecessary types_match for case 1 of signed SAT_ADD
Pan Li [Fri, 13 Sep 2024 03:36:40 +0000 (13 11:36 +0800)]
Match: Remove unnecessary types_match for case 1 of signed SAT_ADD

Given all commutative binary operators requires types matching
for both operands.  Remove the types_match check for case 1 of
the signed SAT_ADD, because we have (bit_xor @0 @1), which ensure
the operands have the correct TREE type.

The below test suites are passed for this patch.
* The rv64gcv fully regression test.
* The x86 bootstrap test.
* The x86 fully regression test.

gcc/ChangeLog:

* match.pd: Remove the types_match check for signed SAT_ADD
case 1.

Signed-off-by: Pan Li <pan2.li@intel.com>
6 days agoFix endianness issue on unsigned_21.f90.
Thomas Koenig [Fri, 13 Sep 2024 05:47:24 +0000 (13 07:47 +0200)]
Fix endianness issue on unsigned_21.f90.

gcc/testsuite/ChangeLog:

PR fortran/116653
* gfortran.dg/unsigned_21.f90:
* gfortran.dg/unsigned_21_be.f90: New test.

6 days agoDaily bump.
GCC Administrator [Fri, 13 Sep 2024 00:18:06 +0000 (13 00:18 +0000)]
Daily bump.

6 days agotestsuite: introduce hostedlib effective target
Alexandre Oliva [Thu, 12 Sep 2024 22:03:59 +0000 (12 19:03 -0300)]
testsuite: introduce hostedlib effective target

Several C++ tests fail with --disable-hosted-libstdcxx, whether
because stdc++exp gets linked in despite not being built, because
standard headers are included but that are unavailable in this mode,
or because headers are (mistakenly?) expected to introduce
declarations such as for abort, malloc, etc, but in this mode they
don't.

This patch introduces an effective target for GCC test, equivalent to
one that's available in the libstdc++-v3 testsuite, and arranges for
all such tests to be skipped when libstdc++-v3 is not hosted.

Co-Authored-By: Olivier Hainque <hainque@adacore.com>
for  gcc/ChangeLog

* doc/sourcebuild.texi (hostedlib): New effective target.

for  gcc/testsuite/ChangeLog

* lib/target-supports.exp (check_effective_target_hostedlib):
New.
* g++.dg/contracts/contracts-access1.C: Skip if !hostedlib
because of libstdc++exp.
* g++.dg/contracts/contracts-assume3.C: Likewise.
* g++.dg/contracts/contracts-assume4.C: Likewise.
* g++.dg/contracts/contracts-config1.C: Likewise.
* g++.dg/contracts/contracts-constexpr1.C: Likewise.
* g++.dg/contracts/contracts-deduced2.C: Likewise.
* g++.dg/contracts/contracts-externC.C: Likewise.
* g++.dg/contracts/contracts-friend1.C: Likewise.
* g++.dg/contracts/contracts-multiline1.C: Likewise.
* g++.dg/contracts/contracts-nested-class2.C: Likewise.
* g++.dg/contracts/contracts-post2.C: Likewise.
* g++.dg/contracts/contracts-post3.C: Likewise.
* g++.dg/contracts/contracts-pre2a2.C: Likewise.
* g++.dg/contracts/contracts10.C: Likewise.
* g++.dg/contracts/contracts18.C: Likewise.
* g++.dg/contracts/contracts19.C: Likewise.
* g++.dg/contracts/contracts2.C: Likewise.
* g++.dg/contracts/contracts24.C: Likewise.
* g++.dg/contracts/contracts25.C: Likewise.
* g++.dg/contracts/contracts3.C: Likewise.
* g++.dg/contracts/contracts4.C: Likewise.
* g++.dg/contracts/contracts5.C: Likewise.
* g++.dg/contracts/contracts6.C: Likewise.
* g++.dg/contracts/contracts7.C: Likewise.
* g++.dg/contracts/contracts9.C: Likewise.
* g++.dg/contracts/pr110159.C: Likewise.
* g++.dg/contracts/pr115434.C: Likewise.  Adjust line numbers.
* c-c++-common/pr36513-2.c: Skip if !hostedlib because of
unavailable headers.
* c-c++-common/analyzer/pr93290.c: Likewise.
* g++.dg/analyzer/pr93212.C: Likewise.
* g++.dg/analyzer/vfunc-2.C: Likewise.
* g++.dg/cdce3.C: Likewise.  Adjust line numbers.
* g++.dg/concepts/expression.C: Likewise.
* g++.dg/concepts/fn3.C: Likewise.
* g++.dg/concepts/fn9.C: Likewise.
* g++.dg/concepts/generic-fn.C: Likewise.
* g++.dg/contracts/contracts-assume2.C: Likewise.
* g++.dg/contracts/contracts-ignore2.C: Likewise.
* g++.dg/contracts/contracts-post7.C: Likewise.
* g++.dg/contracts/contracts-pre10.C: Likewise.
* g++.dg/contracts/contracts-pre2.C: Likewise.
* g++.dg/contracts/contracts-pre3.C: Likewise.
* g++.dg/contracts/contracts-pre4.C: Likewise.
* g++.dg/contracts/contracts-pre5.C: Likewise.
* g++.dg/contracts/contracts-pre7.C: Likewise.
* g++.dg/contracts/contracts-pre9.C: Likewise.
* g++.dg/contracts/contracts-redecl3.C: Likewise.
* g++.dg/contracts/contracts-redecl4.C: Likewise.
* g++.dg/contracts/contracts-redecl6.C: Likewise.
* g++.dg/contracts/contracts-redecl7.C: Likewise.
* g++.dg/contracts/contracts-tmpl-spec1.C: Likewise.
* g++.dg/contracts/contracts-tmpl-spec2.C: Likewise.
* g++.dg/contracts/contracts-tmpl-spec3.C: Likewise.
* g++.dg/contracts/contracts14.C: Likewise.
* g++.dg/contracts/contracts15.C: Likewise.
* g++.dg/contracts/contracts16.C: Likewise.
* g++.dg/contracts/contracts17.C: Likewise.
* g++.dg/contracts/contracts22.C: Likewise.
* g++.dg/contracts/contracts35.C: Likewise.
* g++.dg/coroutines/pr100611.C: Likewise.
* g++.dg/coroutines/pr100772-b.C: Likewise.
* g++.dg/coroutines/pr101133.C: Likewise.
* g++.dg/coroutines/pr101367.C: Likewise.
* g++.dg/coroutines/pr101976.C: Likewise.
* g++.dg/coroutines/pr102454.C: Likewise.
* g++.dg/coroutines/pr104051.C: Likewise.
* g++.dg/coroutines/pr110635.C: Likewise.
* g++.dg/coroutines/pr110871.C: Likewise.  Adjust line numbers.
* g++.dg/coroutines/pr110872.C: Likewise.  Likewise.
* g++.dg/coroutines/pr94288.C: Likewise.
* g++.dg/coroutines/pr95520.C: Likewise.
* g++.dg/coroutines/pr95736.C: Likewise.
* g++.dg/coroutines/pr97587.C: Likewise.
* g++.dg/coroutines/pr99576_1.C: Likewise.
* g++.dg/coroutines/pr99576_2.C: Likewise.
* g++.dg/coroutines/ramp-return-a.C: Likewise.
* g++.dg/coroutines/ramp-return-b.C: Likewise.
* g++.dg/coroutines/ramp-return-c.C: Likewise.
* g++.dg/coroutines/symmetric-transfer-00-basic.C: Likewise.
* g++.dg/coroutines/torture/co-await-16-template-traits.C:
Likewise.
* g++.dg/coroutines/torture/co-ret-15-default-return_void.C:
Likewise.
* g++.dg/coroutines/torture/co-yield-04-complex-local-state.C:
Likewise.
* g++.dg/coroutines/torture/extern-c-coroutine.C: Likewise.
* g++.dg/coroutines/torture/func-params-08.C: Likewise.
* g++.dg/coroutines/torture/func-params-09-awaitable-parms.C:
Likewise.
* g++.dg/coroutines/torture/local-var-05-awaitable.C:
Likewise.
* g++.dg/coroutines/torture/pr95615-01.C: Likewise.
* g++.dg/coroutines/torture/pr95615-02.C: Likewise.
* g++.dg/coroutines/torture/pr95615-03.C: Likewise.
* g++.dg/coroutines/torture/pr95615-04.C: Likewise.
* g++.dg/coroutines/torture/pr95615-05.C: Likewise.
* g++.dg/coroutines/torture/pr98704.C: Likewise.
* g++.dg/cpp/pr80005.C: Likewise.
* g++.dg/cpp0x/Wliteral-suffix.C: Likewise.
* g++.dg/cpp0x/Wpessimizing-move2.C: Likewise.
* g++.dg/cpp0x/constexpr-70001-3.C: Likewise.
* g++.dg/cpp0x/constexpr-ice16.C: Likewise.
* g++.dg/cpp0x/dc5.C: Likewise.
* g++.dg/cpp0x/enum35.C: Likewise.
* g++.dg/cpp0x/enum36.C: Likewise.
* g++.dg/cpp0x/initlist-opt1.C: Likewise.
* g++.dg/cpp0x/initlist-vect2.C: Likewise.
* g++.dg/cpp0x/initlist13.C: Likewise.
* g++.dg/cpp0x/initlist15.C: Likewise.
* g++.dg/cpp0x/initlist25.C: Likewise.
* g++.dg/cpp0x/initlist54.C: Likewise.
* g++.dg/cpp0x/initlist92.C: Likewise.
* g++.dg/cpp0x/lambda/lambda-capture-const-ref-neg.C: Likewise.
* g++.dg/cpp0x/lambda/lambda-capture-const-ref.C: Likewise.
* g++.dg/cpp0x/lambda/lambda-const-neg.C: Likewise.
* g++.dg/cpp0x/lambda/lambda-const.C: Likewise.
* g++.dg/cpp0x/lambda/lambda-deduce.C: Likewise.
* g++.dg/cpp0x/lambda/lambda-in-class-neg.C: Likewise.
* g++.dg/cpp0x/lambda/lambda-in-class.C: Likewise.
* g++.dg/cpp0x/lambda/lambda-mixed.C: Likewise.
* g++.dg/cpp0x/lambda/lambda-mutable.C: Likewise.
* g++.dg/cpp0x/lambda/lambda-nested.C: Likewise.
* g++.dg/cpp0x/lambda/lambda-non-const.C: Likewise.
* g++.dg/cpp0x/lambda/lambda-nop.C: Likewise.
* g++.dg/cpp0x/lambda/lambda-nullptr.C: Likewise.
* g++.dg/cpp0x/lambda/lambda-pass.C: Likewise.
* g++.dg/cpp0x/lambda/lambda-recursive.C: Likewise.
* g++.dg/cpp0x/lambda/lambda-ref-default.C: Likewise.
* g++.dg/cpp0x/lambda/lambda-ref.C: Likewise.
* g++.dg/cpp0x/nullptr20.C: Likewise.
* g++.dg/cpp0x/pr61038.C: Likewise.
* g++.dg/cpp0x/rv-trivial-bug.C: Likewise.
* g++.dg/cpp0x/udlit-concat-neg.C: Likewise.
* g++.dg/cpp0x/udlit-concat.C: Likewise.
* g++.dg/cpp0x/udlit-embed-quote.C: Likewise.
* g++.dg/cpp0x/udlit-extended-id-1.C: Likewise.
* g++.dg/cpp0x/udlit-general.C: Likewise.
* g++.dg/cpp0x/udlit-namespace.C: Likewise.
* g++.dg/cpp0x/udlit-raw-op.C: Likewise.
* g++.dg/cpp0x/udlit-raw-str.C: Likewise.
* g++.dg/cpp0x/udlit-resolve-char8_t.C: Likewise.
* g++.dg/cpp0x/udlit-resolve.C: Likewise.
* g++.dg/cpp0x/udlit-sfinae.C: Likewise.
* g++.dg/cpp0x/udlit-string-literal.C: Likewise.
* g++.dg/cpp0x/udlit-suffix-neg.C: Likewise.
* g++.dg/cpp1y/udlit-userdef-string.C: Likewise.
* g++.dg/cpp0x/udlit-template.C: Likewise.
* g++.dg/cpp0x/variadic-bind.C: Likewise.
* g++.dg/cpp0x/variadic-function.C: Likewise.
* g++.dg/cpp0x/variadic-mem_fn.C: Likewise.
* g++.dg/cpp0x/variadic-tuple.C: Likewise.
* g++.dg/cpp1y/auto-fn45.C: Likewise.
* g++.dg/cpp1y/complex_literals1.C: Likewise.
* g++.dg/cpp1y/complex_literals1a.C: Likewise.
* g++.dg/cpp1y/constexpr-66093.C: Likewise.
* g++.dg/cpp1y/constexpr-assert1.C: Likewise.
* g++.dg/cpp1y/constexpr-assert2.C: Likewise.
* g++.dg/cpp1y/feat-cxx14.C: Likewise.
* g++.dg/cpp1y/lambda-generic-69078-2.C: Likewise.
* g++.dg/cpp1y/lambda-generic-x.C: Likewise.
* g++.dg/cpp1y/lambda-init8.C: Likewise.
* g++.dg/cpp1y/new2.C: Likewise.
* g++.dg/cpp1y/nsdmi-aggr12.C: Likewise.
* g++.dg/cpp1y/pr57640.C: Likewise.
* g++.dg/cpp1y/pr77786.C: Likewise.
* g++.dg/cpp1y/pr95226.C: Likewise.
* g++.dg/cpp1y/udlit-char-template-sfinae.C: Likewise.
* g++.dg/cpp1y/udlit-char-template-vs-std-literal-operator.C:
Likewise.
* g++.dg/cpp1z/class-deduction14.C: Likewise.
* g++.dg/cpp1z/constexpr-asm-1.C: Likewise.
* g++.dg/cpp1z/constexpr-asm-3.C: Likewise.
* g++.dg/cpp1z/decomp37.C: Likewise.
* g++.dg/cpp1z/eval-order2.C: Likewise.
* g++.dg/cpp1z/feat-cxx1z.C: Likewise.
* g++.dg/cpp1z/fold1.C: Likewise.
* g++.dg/cpp1z/init-statement6.C: Likewise.
* g++.dg/cpp1z/launder3.C: Likewise.
* g++.dg/cpp1z/launder4.C: Likewise.
* g++.dg/cpp1z/launder5.C: Likewise.
* g++.dg/cpp1z/launder6.C: Likewise.
* g++.dg/cpp1z/utf8.C: Likewise.
* g++.dg/cpp23/ext-floating12.C: Likewise.
* g++.dg/cpp23/feat-cxx2b.C: Likewise.
* g++.dg/cpp26/constexpr-voidptr1.C: Likewise.
* g++.dg/cpp26/feat-cxx26.C: Likewise.
* g++.dg/cpp2a/concepts-cmath.C: Likewise.
* g++.dg/cpp2a/concepts-explicit-spec1.C: Likewise.
* g++.dg/cpp2a/concepts-explicit-spec4.C: Likewise.
* g++.dg/cpp2a/concepts-explicit-spec5.C: Likewise.
* g++.dg/cpp2a/concepts-memfun.C: Likewise.
* g++.dg/cpp2a/concepts-pr67774.C: Likewise.
* g++.dg/cpp2a/cond-triv2.C: Likewise.
* g++.dg/cpp2a/feat-cxx2a.C: Likewise.
* g++.dg/cpp2a/nontype-float1.C: Likewise.
* g++.dg/diagnostic/disable.C: Likewise.
* g++.dg/diagnostic/missing-header-pr110164.C: Likewise.
* g++.dg/diagnostic/pr65923.C: Likewise.
* g++.dg/eh/arm-vfp-unwind.C: Likewise.
* g++.dg/eh/crossjump1.C: Likewise.
* g++.dg/eh/omit-frame-pointer.C: Likewise.
* g++.dg/eh/simd-3.C: Likewise.
* g++.dg/ext/bases.C: Likewise.
* g++.dg/ext/builtin-line1.C: Likewise.
* g++.dg/ext/builtin10.C: Likewise.
* g++.dg/ext/complex4.C: Likewise.
* g++.dg/ext/has_nothrow_assign.C: Likewise.
* g++.dg/ext/has_nothrow_assign_odr.C: Likewise.
* g++.dg/ext/has_nothrow_constructor.C: Likewise.
* g++.dg/ext/has_nothrow_constructor_odr.C: Likewise.
* g++.dg/ext/has_nothrow_copy-1.C: Likewise.
* g++.dg/ext/has_nothrow_copy-2.C: Likewise.
* g++.dg/ext/has_nothrow_copy-3.C: Likewise.
* g++.dg/ext/has_nothrow_copy-4.C: Likewise.
* g++.dg/ext/has_nothrow_copy-5.C: Likewise.
* g++.dg/ext/has_nothrow_copy-6.C: Likewise.
* g++.dg/ext/has_nothrow_copy-7.C: Likewise.
* g++.dg/ext/has_nothrow_copy_odr.C: Likewise.
* g++.dg/ext/has_trivial_assign.C: Likewise.
* g++.dg/ext/has_trivial_constructor.C: Likewise.
* g++.dg/ext/has_trivial_copy.C: Likewise.
* g++.dg/ext/has_trivial_destructor-1.C: Likewise.
* g++.dg/ext/has_virtual_destructor.C: Likewise.
* g++.dg/ext/is_abstract.C: Likewise.
* g++.dg/ext/is_aggregate.C: Likewise.
* g++.dg/ext/is_base_of.C: Likewise.
* g++.dg/ext/is_class.C: Likewise.
* g++.dg/ext/is_convertible2.C: Likewise.
* g++.dg/ext/is_empty.C: Likewise.
* g++.dg/ext/is_enum.C: Likewise.
* g++.dg/ext/is_pod.C: Likewise.
* g++.dg/ext/is_polymorphic.C: Likewise.
* g++.dg/ext/is_union.C: Likewise.
* g++.dg/ext/underlying_type10.C: Likewise.
* g++.dg/ext/underlying_type4.C: Likewise.
* g++.dg/gcov/gcov-14.C: Likewise.
* g++.dg/gcov/gcov-18.C: Likewise.
* g++.dg/gcov/pr88045.C: Likewise.
* g++.dg/gcov/pr88263-2.C: Likewise.
* g++.dg/gcov/pr88263.C: Likewise.
* g++.dg/gomp/has_device_addr-non-lvalue-1.C: Likewise.
* g++.dg/gomp/ind-base-3.C: Likewise.
* g++.dg/gomp/map-assignment-1.C: Likewise.
* g++.dg/gomp/map-lvalue-ref-1.C: Likewise.
* g++.dg/gomp/map-ptrmem-1.C: Likewise.
* g++.dg/gomp/map-ptrmem-2.C: Likewise.
* g++.dg/gomp/map-static-cast-lvalue-1.C: Likewise.
* g++.dg/gomp/map-ternary-1.C: Likewise.
* g++.dg/gomp/member-array-2.C: Likewise.
* g++.dg/gomp/pr71910.C: Likewise.
* g++.dg/gomp/pr91118-1.C: Likewise.
* g++.dg/gomp/sink-2.C: Likewise.
* g++.dg/gomp/target-this-3.C: Likewise.
* g++.dg/gomp/target-this-4.C: Likewise.
* g++.dg/gomp/tile-1.C: Likewise.
* g++.dg/gomp/tile-2.C: Likewise.
* g++.dg/gomp/unroll-1.C: Likewise.
* g++.dg/gomp/unroll-2.C: Likewise.
* g++.dg/gomp/unroll-3.C: Likewise.
* g++.dg/graphite/id-1.C: Likewise.
* g++.dg/graphite/pr42130.C: Likewise.
* g++.dg/inherit/virtual8.C: Likewise.
* g++.dg/init/array4.C: Likewise.
* g++.dg/init/new18.C: Likewise.
* g++.dg/init/new39.C: Likewise.
* g++.dg/init/new40.C: Likewise.
* g++.dg/ipa/devirt-29.C: Likewise.
* g++.dg/ipa/pr85549.C: Likewise.
* g++.dg/lookup/missing-std-include-3.C: Likewise.
* g++.dg/lookup/pr21802.C: Likewise.
* g++.dg/lto/20091022-2_0.C: Likewise.
* g++.dg/lto/20091219_0.C: Likewise.
* g++.dg/lto/pr80287_0.C: Likewise.
* g++.dg/lto/pr89358_0.C: Likewise.
* g++.dg/lto/pr89358_1.C: Likewise.
* g++.dg/modules/binding-1_a.H: Likewise.
* g++.dg/modules/binding-1_b.H: Likewise.
* g++.dg/modules/contracts-1_a.C: Likewise.
* g++.dg/modules/contracts-1_b.C: Likewise.
* g++.dg/modules/contracts-2_a.C: Likewise.
* g++.dg/modules/contracts-2_b.C: Likewise.
* g++.dg/modules/contracts-3_a.C: Likewise.
* g++.dg/modules/contracts-3_b.C: Likewise.
* g++.dg/modules/contracts-4_a.C: Likewise.
* g++.dg/modules/contracts-4_d.C: Likewise.
* g++.dg/modules/global-3_a.C: Likewise.
* g++.dg/modules/hello-1_a.C: Likewise.
* g++.dg/modules/hello-2_a.C: Likewise.
* g++.dg/modules/hello-2_b.C: Likewise.
* g++.dg/modules/iostream-1_a.H: Likewise.
* g++.dg/modules/p1689-2.C: Likewise.
* g++.dg/modules/part-5_c.C: Likewise.
* g++.dg/modules/pr99023_a.X: Likewise.
* g++.dg/modules/pr99166_a.X: Likewise.
* g++.dg/modules/pr99166_b.C: Likewise.
* g++.dg/modules/pr99425-2_a.X: Likewise.
* g++.dg/modules/pr99425-2_b.X: Likewise.
* g++.dg/modules/string-1_a.H: Likewise.
* g++.dg/modules/string-1_b.C: Likewise.
* g++.dg/modules/string-view1.C: Likewise.
* g++.dg/modules/xtreme-header-1_a.H: Likewise.
* g++.dg/modules/xtreme-header-1_b.C: Likewise.
* g++.dg/modules/xtreme-header-2_a.H: Likewise.
* g++.dg/modules/xtreme-header-2_b.C: Likewise.
* g++.dg/modules/xtreme-header-3_a.H: Likewise.
* g++.dg/modules/xtreme-header-3_b.C: Likewise.
* g++.dg/modules/xtreme-header-4_a.H: Likewise.
* g++.dg/modules/xtreme-header-4_b.C: Likewise.
* g++.dg/modules/xtreme-header-5_a.H: Likewise.
* g++.dg/modules/xtreme-header-5_b.C: Likewise.
* g++.dg/modules/xtreme-header-6_a.H: Likewise.
* g++.dg/modules/xtreme-header-6_b.C: Likewise.
* g++.dg/modules/xtreme-header-7_a.H: Likewise.
* g++.dg/modules/xtreme-header-7_b.C: Likewise.
* g++.dg/modules/xtreme-header_a.H: Likewise.
* g++.dg/modules/xtreme-header_b.C: Likewise.
* g++.dg/modules/xtreme-tr1_a.H: Likewise.
* g++.dg/modules/xtreme-tr1_b.C: Likewise.
* g++.dg/opt/builtins2.C: Likewise.
* g++.dg/opt/dtor4-aux.cc: Likewise.
* g++.dg/opt/dtor4.C: Likewise.
* g++.dg/opt/nrv17.C: Likewise.
* g++.dg/opt/pr102970.C: Likewise.
* g++.dg/opt/pr109434.C: Likewise.
* g++.dg/opt/pr110879.C: Likewise.
* g++.dg/opt/pr15551.C: Likewise.
* g++.dg/opt/pr30965.C: Likewise.
* g++.dg/opt/pr65074.C: Likewise.
* g++.dg/opt/pr66119.C: Likewise.
* g++.dg/opt/pr77844.C: Likewise.
* g++.dg/opt/pr85393.C: Likewise.
* g++.dg/opt/pr94223.C: Likewise.
* g++.dg/other/final7.C: Likewise.
* g++.dg/other/pr40561.C: Likewise.
* g++.dg/parse/lookup1.C: Likewise.
* g++.dg/parse/parse5.C: Likewise.
* g++.dg/pch/system-1.C: Likewise.
* g++.dg/pch/system-1.Hs: Likewise.
* g++.dg/pch/system-2.C: Likewise.
* g++.dg/pch/system-2.Hs: Likewise.
* g++.dg/pr100253.C: Likewise.
* g++.dg/pr104547.C: Likewise.
* g++.dg/pr107087.C: Likewise.
* g++.dg/pr71488.C: Likewise.
* g++.dg/pr71655.C: Likewise.
* g++.dg/pr79095-3.C: Likewise.
* g++.dg/pr83239.C: Likewise.
* g++.dg/pr99966.C: Likewise.
* g++.dg/rtti/typeid4.C: Likewise.
* g++.dg/spellcheck-inttypes.C: Likewise.
* g++.dg/template/friend10.C: Likewise.
* g++.dg/template/pr69961a.C: Likewise.
* g++.dg/template/show-template-tree-3.C: Likewise.
* g++.dg/tm/inherit2.C: Likewise.
* g++.dg/tm/pr46270.C: Likewise.
* g++.dg/torture/alias-1.C: Likewise.
* g++.dg/torture/builtin-location.C: Likewise.
* g++.dg/torture/pr103669.C: Likewise.
* g++.dg/torture/pr104601.C: Likewise.
* g++.dg/torture/pr106922.C: Likewise.
* g++.dg/torture/pr111019.C: Likewise.
* g++.dg/torture/pr33572.C: Likewise.
* g++.dg/torture/pr33735.C: Likewise.
* g++.dg/torture/pr34099.C: Likewise.
* g++.dg/torture/pr39417.C: Likewise.
* g++.dg/torture/pr44972.C: Likewise.
* g++.dg/torture/pr46364.C: Likewise.
* g++.dg/torture/pr49628.C: Likewise.
* g++.dg/torture/pr49938.C: Likewise.
* g++.dg/torture/pr51903.C: Likewise.
* g++.dg/torture/pr54498.C: Likewise.
* g++.dg/torture/pr60750.C: Likewise.
* g++.dg/torture/pr67600.C: Likewise.
* g++.dg/torture/pr82084.C: Likewise.
* g++.dg/torture/pr86763.C: Likewise.
* g++.dg/torture/pr95493-1.C: Likewise.
* g++.dg/tree-ssa/allocator-opt1.C: Likewise.
* g++.dg/tree-ssa/copyprop.C: Likewise.
* g++.dg/tree-ssa/empty-loop.C: Likewise.
* g++.dg/tree-ssa/initlist-opt1.C: Likewise.
* g++.dg/tree-ssa/initlist-opt2.C: Likewise.
* g++.dg/tree-ssa/initlist-opt3.C: Likewise.
* g++.dg/tree-ssa/initlist-opt5.C: Likewise.
* g++.dg/tree-ssa/loop-cond-split-1.C: Likewise.
* g++.dg/tree-ssa/loop-split-1.C: Likewise.
* g++.dg/tree-ssa/pr101839.C: Likewise.
* g++.dg/tree-ssa/pr104529.C: Likewise.
* g++.dg/tree-ssa/pr109849.C: Likewise.
* g++.dg/tree-ssa/pr14703.C: Likewise.
* g++.dg/tree-ssa/pr19786.C: Likewise.
* g++.dg/tree-ssa/pr46228.C: Likewise.
* g++.dg/tree-ssa/pr63841.C: Likewise.
* g++.dg/tree-ssa/pr69336.C: Likewise.
* g++.dg/tree-ssa/pr78847.C: Likewise.
* g++.dg/tree-ssa/pr95638.C: Likewise.
* g++.dg/uninit-pr105937.C: Likewise.
* g++.dg/vect/pr102421.cc: Likewise.
* g++.dg/vect/pr105053.cc: Likewise.
* g++.dg/vect/pr33426-ivdep-4.cc: Likewise.
* g++.dg/vect/pr64410.cc: Likewise.
* g++.dg/vect/slp-pr87105.cc: Likewise.
* g++.dg/vect/vect-novector-pragma.cc: Likewise.
* g++.dg/warn/Warray-bounds-27.C: Likewise.
* g++.dg/warn/Wdangling-pointer-pr110055.C: Likewise.
* g++.dg/warn/Wdangling-reference10.C: Likewise.
* g++.dg/warn/Wdangling-reference14.C: Likewise.
* g++.dg/warn/Wdangling-reference17.C: Likewise.
* g++.dg/warn/Wdangling-reference4.C: Likewise.
* g++.dg/warn/Wdangling-reference5.C: Likewise.
* g++.dg/warn/Wfree-nonheap-object-3.C: Likewise.
* g++.dg/warn/Winline-3.C: Likewise.
* g++.dg/warn/Wmemset-elt-size1.C: Likewise.
* g++.dg/warn/Wparentheses-34.C: Likewise.
* g++.dg/warn/Wstrict-aliasing-bogus-escape-2.C: Likewise.
* g++.dg/warn/Wstrict-aliasing-bogus-escape.C: Likewise.
* g++.dg/warn/Wstringop-overflow-6.C: Likewise.
* g++.dg/warn/Wstringop-overflow-8.C: Likewise.
* g++.dg/warn/Wstringop-overread-1.C: Likewise.
* g++.dg/warn/Wuninitialized-33.C: Likewise.
* g++.dg/warn/Wuninitialized-pr111123-1.C: Likewise.
* g++.dg/warn/format1.C: Likewise.
* g++.dg/warn/huge-val1.C: Likewise.
* g++.dg/warn/string1.C: Likewise.
* g++.dg/warn/uninit-pr105562.C: Likewise.
* g++.old-deja/g++.benjamin/15071.C: Likewise.
* g++.old-deja/g++.brendan/copy9.C: Likewise.
* g++.old-deja/g++.brendan/crash15.C: Likewise.
* g++.old-deja/g++.brendan/crash20.C: Likewise.
* g++.old-deja/g++.brendan/crash30.C: Likewise.
* g++.old-deja/g++.brendan/crash38.C: Likewise.
* g++.old-deja/g++.brendan/crash39.C: Likewise.
* g++.old-deja/g++.brendan/crash49.C: Likewise.
* g++.old-deja/g++.brendan/crash52.C: Likewise.
* g++.old-deja/g++.brendan/crash62.C: Likewise.
* g++.old-deja/g++.brendan/cvt1.C: Likewise.
* g++.old-deja/g++.brendan/err-msg3.C: Likewise.
* g++.old-deja/g++.brendan/nest21.C: Likewise.
* g++.old-deja/g++.brendan/ptolemy2.C: Likewise.
* g++.old-deja/g++.jason/2371.C: Likewise.
* g++.old-deja/g++.jason/template24.C: Likewise.
* g++.old-deja/g++.jason/template31.C: Likewise.
* g++.old-deja/g++.jason/typeid1.C: Likewise.
* g++.old-deja/g++.law/arg1.C: Likewise.
* g++.old-deja/g++.law/arg8.C: Likewise.
* g++.old-deja/g++.law/arm12.C: Likewise.
* g++.old-deja/g++.law/arm9.C: Likewise.
* g++.old-deja/g++.law/bad-error7.C: Likewise.
* g++.old-deja/g++.law/code-gen5.C: Likewise.
* g++.old-deja/g++.law/ctors10.C: Likewise.
* g++.old-deja/g++.law/ctors12.C: Likewise.
* g++.old-deja/g++.law/ctors13.C: Likewise.
* g++.old-deja/g++.law/ctors17.C: Likewise.
* g++.old-deja/g++.law/ctors6.C: Likewise.
* g++.old-deja/g++.law/cvt16.C: Likewise.
* g++.old-deja/g++.law/cvt2.C: Likewise.
* g++.old-deja/g++.law/cvt7.C: Likewise.
* g++.old-deja/g++.law/except5.C: Likewise.
* g++.old-deja/g++.law/missed-error2.C: Likewise.
* g++.old-deja/g++.law/nest3.C: Likewise.
* g++.old-deja/g++.law/operators32.C: Likewise.
* g++.old-deja/g++.law/operators4.C: Likewise.
* g++.old-deja/g++.law/vbase1.C: Likewise.
* g++.old-deja/g++.law/virtual3.C: Likewise.
* g++.old-deja/g++.law/visibility1.C: Likewise.
* g++.old-deja/g++.law/visibility10.C: Likewise.
* g++.old-deja/g++.law/visibility13.C: Likewise.
* g++.old-deja/g++.law/visibility17.C: Likewise.
* g++.old-deja/g++.law/visibility2.C: Likewise.
* g++.old-deja/g++.law/visibility22.C: Likewise.
* g++.old-deja/g++.law/visibility25.C: Likewise.
* g++.old-deja/g++.law/visibility7.C: Likewise.
* g++.old-deja/g++.law/weak.C: Likewise.
* g++.old-deja/g++.martin/new1.C: Likewise.
* g++.old-deja/g++.mike/dyncast7.C: Likewise.
* g++.old-deja/g++.mike/eh13.C: Likewise.
* g++.old-deja/g++.mike/eh2.C: Likewise.
* g++.old-deja/g++.mike/net34.C: Likewise.
* g++.old-deja/g++.mike/net46.C: Likewise.
* g++.old-deja/g++.mike/p658.C: Likewise.
* g++.old-deja/g++.mike/rtti1.C: Likewise.
* g++.old-deja/g++.ns/using4.C: Likewise.
* g++.old-deja/g++.ns/using6.C: Likewise.
* g++.old-deja/g++.other/defarg6.C: Likewise.
* g++.old-deja/g++.other/headers1.C: Likewise.
* g++.old-deja/g++.other/init9.C: Likewise.
* g++.old-deja/g++.other/inline14.C: Likewise.
* g++.old-deja/g++.other/inline2.C: Likewise.
* g++.old-deja/g++.other/inline7.C: Likewise.
* g++.old-deja/g++.other/inline8.C: Likewise.
* g++.old-deja/g++.other/optimize2.C: Likewise.
* g++.old-deja/g++.other/sibcall1.C: Likewise.
* g++.old-deja/g++.other/unchanging1.C: Likewise.
* g++.old-deja/g++.pt/crash68.C: Likewise.
* g++.old-deja/g++.pt/memtemp100.C: Likewise.
* g++.old-deja/g++.robertl/eb109.C: Likewise.
* g++.old-deja/g++.robertl/eb113.C: Likewise.
* g++.old-deja/g++.robertl/eb115.C: Likewise.
* g++.old-deja/g++.robertl/eb124.C: Likewise.
* g++.old-deja/g++.robertl/eb127.C: Likewise.
* g++.old-deja/g++.robertl/eb129.C: Likewise.
* g++.old-deja/g++.robertl/eb129a.C: Likewise.
* g++.old-deja/g++.robertl/eb130.C: Likewise.
* g++.old-deja/g++.robertl/eb132.C: Likewise.
* g++.old-deja/g++.robertl/eb15.C: Likewise.
* g++.old-deja/g++.robertl/eb21.C: Likewise.
* g++.old-deja/g++.robertl/eb24.C: Likewise.
* g++.old-deja/g++.robertl/eb27.C: Likewise.
* g++.old-deja/g++.robertl/eb28.C: Likewise.
* g++.old-deja/g++.robertl/eb29.C: Likewise.
* g++.old-deja/g++.robertl/eb3.C: Likewise.
* g++.old-deja/g++.robertl/eb30.C: Likewise.
* g++.old-deja/g++.robertl/eb31.C: Likewise.
* g++.old-deja/g++.robertl/eb33.C: Likewise.
* g++.old-deja/g++.robertl/eb36.C: Likewise.
* g++.old-deja/g++.robertl/eb39.C: Likewise.
* g++.old-deja/g++.robertl/eb4.C: Likewise.
* g++.old-deja/g++.robertl/eb41.C: Likewise.
* g++.old-deja/g++.robertl/eb43.C: Likewise.
* g++.old-deja/g++.robertl/eb44.C: Likewise.
* g++.old-deja/g++.robertl/eb46.C: Likewise.
* g++.old-deja/g++.robertl/eb54.C: Likewise.
* g++.old-deja/g++.robertl/eb55.C: Likewise.
* g++.old-deja/g++.robertl/eb59.C: Likewise.
* g++.old-deja/g++.robertl/eb60.C: Likewise.
* g++.old-deja/g++.robertl/eb62.C: Likewise.
* g++.old-deja/g++.robertl/eb66.C: Likewise.
* g++.old-deja/g++.robertl/eb7.C: Likewise.
* g++.old-deja/g++.robertl/eb73.C: Likewise.
* g++.old-deja/g++.robertl/eb77.C: Likewise.
* g++.old-deja/g++.robertl/eb79.C: Likewise.
* g++.old-deja/g++.warn/iomanip.C: Likewise.
* g++.target/i386/pr105638.C: Likewise.
* g++.target/i386/pr110170.C: Likewise.
* g++.target/i386/pr80566-1.C: Likewise.
* g++.target/i386/pr80566-2.C: Likewise.
* c-c++-common/analyzer/allocation-size-1.c: Skip if
!hostedlib because of unavailable declarations.
* c-c++-common/analyzer/allocation-size-2.c: Likewise.
* c-c++-common/analyzer/allocation-size-3.c: Likewise.
* c-c++-common/analyzer/allocation-size-4.c: Likewise.
* c-c++-common/analyzer/analyzer-verbosity-0.c: Likewise.
* c-c++-common/analyzer/analyzer-verbosity-1.c: Likewise.
* c-c++-common/analyzer/analyzer-verbosity-2.c: Likewise.
* c-c++-common/analyzer/analyzer-verbosity-3.c: Likewise.
* c-c++-common/analyzer/call-summaries-1.c: Likewise.
* c-c++-common/analyzer/call-summaries-malloc.c: Likewise.
* c-c++-common/analyzer/callbacks-1.c: Likewise.
* c-c++-common/analyzer/callbacks-2.c: Likewise.
* c-c++-common/analyzer/capacity-1.c: Likewise.
* c-c++-common/analyzer/capacity-2.c: Likewise.
* c-c++-common/analyzer/capacity-3.c: Likewise.
* c-c++-common/analyzer/compound-assignment-1.c: Likewise.
* c-c++-common/analyzer/data-model-14.c: Likewise.
* c-c++-common/analyzer/data-model-20.c: Likewise.
* c-c++-common/analyzer/data-model-5d.c: Likewise.
* c-c++-common/analyzer/disabling.c: Likewise.
* c-c++-common/analyzer/dump-state.c: Likewise.
* c-c++-common/analyzer/edges-2.c: Likewise.
* c-c++-common/analyzer/first-field-2.c: Likewise.
* c-c++-common/analyzer/flex-with-call-summaries.c: Likewise.
* c-c++-common/analyzer/flex-without-call-summaries.c:
Likewise.
* c-c++-common/analyzer/flexible-array-member-1.c: Likewise.
* c-c++-common/analyzer/function-ptr-2.c: Likewise.
* c-c++-common/analyzer/function-ptr-3.c: Likewise.
* c-c++-common/analyzer/function-ptr-4.c: Likewise.
* c-c++-common/analyzer/gzio.c: Likewise.
* c-c++-common/analyzer/imprecise-floating-point-1.c:
Likewise.
* c-c++-common/analyzer/leak-2.c: Likewise.
* c-c++-common/analyzer/leak-3.c: Likewise.
* c-c++-common/analyzer/leak-4.c: Likewise.
* c-c++-common/analyzer/loop-0-up-to-n-by-1-with-iter-obj.c:
Likewise.
* c-c++-common/analyzer/loop-3.c: Likewise.
* c-c++-common/analyzer/malloc-3.c: Likewise.
* c-c++-common/analyzer/malloc-5.c: Likewise.
* c-c++-common/analyzer/malloc-CWE-401-example.c: Likewise.
* c-c++-common/analyzer/malloc-CWE-415-examples.c: Likewise.
* c-c++-common/analyzer/malloc-CWE-416-examples.c: Likewise.
* c-c++-common/analyzer/malloc-CWE-590-examples.c: Likewise.
* c-c++-common/analyzer/malloc-callbacks.c: Likewise.
* c-c++-common/analyzer/malloc-dce.c: Likewise.
* c-c++-common/analyzer/malloc-dedupe-1.c: Likewise.
* c-c++-common/analyzer/malloc-in-loop.c: Likewise.
* c-c++-common/analyzer/malloc-ipa-1.c: Likewise.
* c-c++-common/analyzer/malloc-ipa-10.c: Likewise.
* c-c++-common/analyzer/malloc-ipa-11.c: Likewise.
* c-c++-common/analyzer/malloc-ipa-12.c: Likewise.
* c-c++-common/analyzer/malloc-ipa-13a.c: Likewise.
* c-c++-common/analyzer/malloc-ipa-2.c: Likewise.
* c-c++-common/analyzer/malloc-ipa-3.c: Likewise.
* c-c++-common/analyzer/malloc-ipa-4.c: Likewise.
* c-c++-common/analyzer/malloc-ipa-5.c: Likewise.
* c-c++-common/analyzer/malloc-ipa-6.c: Likewise.
* c-c++-common/analyzer/malloc-ipa-7.c: Likewise.
* c-c++-common/analyzer/malloc-ipa-9.c: Likewise.
* c-c++-common/analyzer/malloc-macro-inline-events.c:
Likewise.
* c-c++-common/analyzer/malloc-macro-separate-events.c:
Likewise.
* c-c++-common/analyzer/malloc-many-paths-3.c: Likewise.
* c-c++-common/analyzer/malloc-meaning-1.c: Likewise.
* c-c++-common/analyzer/malloc-paths-1.c: Likewise.
* c-c++-common/analyzer/malloc-paths-2.c: Likewise.
* c-c++-common/analyzer/malloc-paths-3.c: Likewise.
* c-c++-common/analyzer/malloc-paths-4.c: Likewise.
* c-c++-common/analyzer/malloc-paths-5.c: Likewise.
* c-c++-common/analyzer/malloc-paths-6.c: Likewise.
* c-c++-common/analyzer/malloc-paths-7.c: Likewise.
* c-c++-common/analyzer/malloc-paths-8.c: Likewise.
* c-c++-common/analyzer/malloc-paths-9-noexcept.c: Likewise.
* c-c++-common/analyzer/malloc-sarif-1.c: Likewise.
* c-c++-common/analyzer/malloc-vs-local-1a.c: Likewise.
* c-c++-common/analyzer/malloc-vs-local-1b.c: Likewise.
* c-c++-common/analyzer/malloc-vs-local-2.c: Likewise.
* c-c++-common/analyzer/malloc-vs-local-3.c: Likewise.
* c-c++-common/analyzer/out-of-bounds-1.c: Likewise.
* c-c++-common/analyzer/out-of-bounds-2.c: Likewise.
* c-c++-common/analyzer/out-of-bounds-diagram-3.c: Likewise.
* c-c++-common/analyzer/out-of-bounds-diagram-8.c: Likewise.
* c-c++-common/analyzer/paths-3.c: Likewise.
* c-c++-common/analyzer/paths-6.c: Likewise.
* c-c++-common/analyzer/paths-7.c: Likewise.
* c-c++-common/analyzer/pr103526.c: Likewise.
* c-c++-common/analyzer/pr106539.c: Likewise.
* c-c++-common/analyzer/pr94399.c: Likewise.
* c-c++-common/analyzer/pr94851-1.c: Likewise.
* c-c++-common/analyzer/pr94851-2.c: Likewise.
* c-c++-common/analyzer/pr94851-4.c: Likewise.
* c-c++-common/analyzer/pr97608.c: Likewise.
* c-c++-common/analyzer/pr98918.c: Likewise.
* c-c++-common/analyzer/pr99716-2.c: Likewise.
* c-c++-common/analyzer/pr99716-3.c: Likewise.
* c-c++-common/analyzer/pragma-1.c: Likewise.
* c-c++-common/analyzer/pragma-2.c: Likewise.
* c-c++-common/analyzer/sarif-path-role.c: Likewise.
* c-c++-common/analyzer/scope-1.c: Likewise.
* c-c++-common/analyzer/strndup-1.c: Likewise.
* c-c++-common/analyzer/taint-alloc-3.c: Likewise.
* c-c++-common/analyzer/taint-realloc.c: Likewise.
* c-c++-common/analyzer/use-after-free-3.c: Likewise.
* c-c++-common/analyzer/zlib-4.c: Likewise.
* c-c++-common/goacc/kernels-counter-vars-function-scope.c:
Likewise.
* c-c++-common/goacc/kernels-loop-2.c: Likewise.
* c-c++-common/goacc/kernels-loop-3.c: Likewise.
* c-c++-common/goacc/kernels-loop-data-2.c: Likewise.
* c-c++-common/goacc/kernels-loop-data-enter-exit-2.c:
Likewise.
* c-c++-common/goacc/kernels-loop-data-enter-exit.c:
Likewise.
* c-c++-common/goacc/kernels-loop-data-update.c: Likewise.
* c-c++-common/goacc/kernels-loop-data.c: Likewise.
* c-c++-common/goacc/kernels-loop-g.c: Likewise.
* c-c++-common/goacc/kernels-loop-mod-not-zero.c: Likewise.
* c-c++-common/goacc/kernels-loop-n.c: Likewise.
* c-c++-common/goacc/kernels-loop.c: Likewise.
* c-c++-common/goacc/kernels-one-counter-var.c: Likewise.
* c-c++-common/goacc/kernels-parallel-loop-data-enter-exit.c:
Likewise.
* c-c++-common/gomp/pr103642.c: Likewise.
* c-c++-common/gomp/target-implicit-map-2.c: Likewise.
* c-c++-common/simulate-thread/bitfields-4.c: Likewise.
* c-c++-common/tm/malloc.c: Likewise.
* g++.dg/abi/mangle36.C: Likewise.
* g++.dg/abi/mangle40.C: Likewise.
* g++.dg/abi/mangle41.C: Likewise.
* g++.dg/analyzer/cstdlib.C: Likewise.
* g++.dg/analyzer/fanalyzer-show-events-in-system-headers-default.C:
Likewise.
* g++.dg/analyzer/fanalyzer-show-events-in-system-headers-no.C:
Likewise.
* g++.dg/analyzer/fanalyzer-show-events-in-system-headers.C:
Likewise.
* g++.dg/analyzer/malloc.C: Likewise.
* g++.dg/analyzer/new-vs-malloc.C: Likewise.
* g++.dg/analyzer/placement-new-size.C: Likewise.
* g++.dg/analyzer/vfunc-3.C: Likewise.
* g++.dg/analyzer/vfunc-5.C: Likewise.
* g++.dg/coroutines/coro-bad-gro-00-class-gro-scalar-return.C:
Likewise.
* g++.dg/coroutines/coro-bad-gro-01-void-gro-non-class-coro.C:
Likewise.
* g++.dg/coroutines/pr101765.C: Likewise.
* g++.dg/coroutines/pr95477.C: Likewise.
* g++.dg/coroutines/pr95599.C: Likewise.
* g++.dg/coroutines/pr95711.C: Likewise.
* g++.dg/coroutines/torture/alloc-00-gro-on-alloc-fail.C:
Likewise.
* g++.dg/coroutines/torture/alloc-01-overload-newdel.C:
Likewise.
* g++.dg/coroutines/torture/alloc-02-fail-new-grooaf-check.C:
Likewise.
* g++.dg/coroutines/torture/alloc-03-overload-new-1.C:
Likewise.
* g++.dg/coroutines/torture/alloc-04-overload-del-use-two-args.C:
Likewise.
* g++.dg/coroutines/torture/call-00-co-aw-arg.C: Likewise.
* g++.dg/coroutines/torture/call-01-multiple-co-aw.C:
Likewise.
* g++.dg/coroutines/torture/call-02-temp-co-aw.C: Likewise.
* g++.dg/coroutines/torture/call-03-temp-ref-co-aw.C:
Likewise.
* g++.dg/coroutines/torture/class-00-co-ret.C: Likewise.
* g++.dg/coroutines/torture/class-01-co-ret-parm.C: Likewise.
* g++.dg/coroutines/torture/class-02-templ-parm.C: Likewise.
* g++.dg/coroutines/torture/class-03-operator-templ-parm.C:
Likewise.
* g++.dg/coroutines/torture/class-04-lambda-1.C: Likewise.
* g++.dg/coroutines/torture/class-05-lambda-capture-copy-local.C:
Likewise.
* g++.dg/coroutines/torture/class-06-lambda-capture-ref.C:
Likewise.
* g++.dg/coroutines/torture/class-07-data-member.C: Likewise.
* g++.dg/coroutines/torture/co-await-00-trivial.C: Likewise.
* g++.dg/coroutines/torture/co-await-01-with-value.C:
Likewise.
* g++.dg/coroutines/torture/co-await-02-xform.C: Likewise.
* g++.dg/coroutines/torture/co-await-03-rhs-op.C: Likewise.
* g++.dg/coroutines/torture/co-await-04-control-flow.C:
Likewise.
* g++.dg/coroutines/torture/co-await-05-loop.C: Likewise.
* g++.dg/coroutines/torture/co-await-06-ovl.C: Likewise.
* g++.dg/coroutines/torture/co-await-07-tmpl.C: Likewise.
* g++.dg/coroutines/torture/co-await-08-cascade.C: Likewise.
* g++.dg/coroutines/torture/co-await-09-pair.C: Likewise.
* g++.dg/coroutines/torture/co-await-10-template-fn-arg.C:
Likewise.
* g++.dg/coroutines/torture/co-await-11-forwarding.C:
Likewise.
* g++.dg/coroutines/torture/co-await-12-operator-2.C:
Likewise.
* g++.dg/coroutines/torture/co-await-13-return-ref.C:
Likewise.
* g++.dg/coroutines/torture/co-await-14-return-ref-to-auto.C:
Likewise.
* g++.dg/coroutines/torture/co-await-15-return-non-triv.C:
Likewise.
* g++.dg/coroutines/torture/co-await-17-capture-comp-ref.C:
Likewise.
* g++.dg/coroutines/torture/co-await-18-if-cond.C: Likewise.
* g++.dg/coroutines/torture/co-await-19-while-cond.C:
Likewise.
* g++.dg/coroutines/torture/co-await-20-do-while-cond.C:
Likewise.
* g++.dg/coroutines/torture/co-await-21-switch-value.C:
Likewise.
* g++.dg/coroutines/torture/co-await-22-truth-and-of-if.C:
Likewise.
* g++.dg/coroutines/torture/co-await-24-for-init.C: Likewise.
* g++.dg/coroutines/torture/co-await-25-for-condition.C:
Likewise.
* g++.dg/coroutines/torture/co-await-26-for-iteration-expr.C:
Likewise.
* g++.dg/coroutines/torture/co-ret-00-void-return-is-ready.C:
Likewise.
* g++.dg/coroutines/torture/co-ret-01-void-return-is-suspend.C:
Likewise.
* g++.dg/coroutines/torture/co-ret-03-different-GRO-type.C:
Likewise.
* g++.dg/coroutines/torture/co-ret-04-GRO-nontriv.C:
Likewise.
* g++.dg/coroutines/torture/co-ret-05-return-value.C:
Likewise.
* g++.dg/coroutines/torture/co-ret-06-template-promise-val-1.C:
Likewise.
* g++.dg/coroutines/torture/co-ret-07-void-cast-expr.C:
Likewise.
* g++.dg/coroutines/torture/co-ret-08-template-cast-ret.C:
Likewise.
* g++.dg/coroutines/torture/co-ret-09-bool-await-susp.C:
Likewise.
* g++.dg/coroutines/torture/co-ret-10-expression-evaluates-once.C:
Likewise.
* g++.dg/coroutines/torture/co-ret-11-co-ret-co-await.C:
Likewise.
* g++.dg/coroutines/torture/co-ret-12-co-ret-fun-co-await.C:
Likewise.
* g++.dg/coroutines/torture/co-ret-13-template-2.C: Likewise.
* g++.dg/coroutines/torture/co-ret-14-template-3.C: Likewise.
* g++.dg/coroutines/torture/co-ret-16-simple-control-flow.C:
Likewise.
* g++.dg/coroutines/torture/co-ret-17-void-ret-coro.C:
Likewise.
* g++.dg/coroutines/torture/co-yield-00-triv.C: Likewise.
* g++.dg/coroutines/torture/co-yield-01-multi.C: Likewise.
* g++.dg/coroutines/torture/co-yield-02-loop.C: Likewise.
* g++.dg/coroutines/torture/co-yield-03-tmpl.C: Likewise.
* g++.dg/coroutines/torture/co-yield-03-tmpl-nondependent.C:
Likewise.
* g++.dg/coroutines/torture/co-yield-05-co-aw.C: Likewise.
* g++.dg/coroutines/torture/co-yield-06-fun-parm.C: Likewise.
* g++.dg/coroutines/torture/co-yield-07-template-fn-param.C:
Likewise.
* g++.dg/coroutines/torture/co-yield-08-more-refs.C:
Likewise.
* g++.dg/coroutines/torture/co-yield-09-more-templ-refs.C:
Likewise.
* g++.dg/coroutines/torture/exceptions-test-0.C: Likewise.
* g++.dg/coroutines/torture/exceptions-test-01-n4849-a.C:
Likewise.
* g++.dg/coroutines/torture/func-params-00.C: Likewise.
* g++.dg/coroutines/torture/func-params-01.C: Likewise.
* g++.dg/coroutines/torture/func-params-02.C: Likewise.
* g++.dg/coroutines/torture/func-params-03.C: Likewise.
* g++.dg/coroutines/torture/func-params-04.C: Likewise.
* g++.dg/coroutines/torture/func-params-05.C: Likewise.
* g++.dg/coroutines/torture/func-params-06.C: Likewise.
* g++.dg/coroutines/torture/func-params-07.C: Likewise.
* g++.dg/coroutines/torture/lambda-00-co-ret.C: Likewise.
* g++.dg/coroutines/torture/lambda-01-co-ret-parm.C:
Likewise.
* g++.dg/coroutines/torture/lambda-02-co-yield-values.C:
Likewise.
* g++.dg/coroutines/torture/lambda-03-auto-parm-1.C:
Likewise.
* g++.dg/coroutines/torture/lambda-04-templ-parm.C: Likewise.
* g++.dg/coroutines/torture/lambda-05-capture-copy-local.C:
Likewise.
* g++.dg/coroutines/torture/lambda-06-multi-capture.C:
Likewise.
* g++.dg/coroutines/torture/lambda-07-multi-yield.C:
Likewise.
* g++.dg/coroutines/torture/lambda-08-co-ret-parm-ref.C:
Likewise.
* g++.dg/coroutines/torture/lambda-09-init-captures.C:
Likewise.
* g++.dg/coroutines/torture/lambda-10-mutable.C: Likewise.
* g++.dg/coroutines/torture/local-var-00-const.C: Likewise.
* g++.dg/coroutines/torture/local-var-01-single.C: Likewise.
* g++.dg/coroutines/torture/local-var-02-conditional.C:
Likewise.
* g++.dg/coroutines/torture/local-var-03-with-awaits.C:
Likewise.
* g++.dg/coroutines/torture/local-var-04-hiding-nested-scopes.C:
Likewise.
* g++.dg/coroutines/torture/local-var-06-structured-binding.C:
Likewise.
* g++.dg/coroutines/torture/mid-suspend-destruction-0.C:
Likewise.
* g++.dg/coroutines/torture/pr95003.C: Likewise.
* g++.dg/coroutines/torture/pr95519-00-return_void.C:
Likewise.
* g++.dg/coroutines/torture/pr95519-01-initial-suspend.C:
Likewise.
* g++.dg/coroutines/torture/pr95519-02-final_suspend.C:
Likewise.
* g++.dg/coroutines/torture/pr95519-03-return-value.C:
Likewise.
* g++.dg/coroutines/torture/pr95519-04-yield-value.C:
Likewise.
* g++.dg/coroutines/torture/pr95519-05-gro.C: Likewise.
* g++.dg/coroutines/torture/pr95519-06-grooaf.C: Likewise.
* g++.dg/coroutines/torture/pr95519-07-unhandled-exception.C:
Likewise.
* g++.dg/cpp0x/lambda/lambda-std-function.C: Likewise.
* g++.dg/cpp0x/lambda/lambda-this8.C: Likewise.
* g++.dg/cpp0x/pr70887.C: Likewise.
* g++.dg/cpp1y/lambda-generic-variadic2.C: Likewise.
* g++.dg/cpp23/subscript5.C: Likewise.
* g++.dg/cpp23/subscript6.C: Likewise.
* g++.dg/cpp26/constexpr-new2.C: Likewise.
* g++.dg/cpp2a/destroying-delete5.C: Likewise.
* g++.dg/eh/filter2.C: Likewise.
* g++.dg/eh/uncaught1.C: Likewise.
* g++.dg/eh/uncaught2.C: Likewise.
* g++.dg/expr/anew1.C: Likewise.
* g++.dg/expr/anew2.C: Likewise.
* g++.dg/expr/anew3.C: Likewise.
* g++.dg/expr/anew4.C: Likewise.
* g++.dg/ext/cleanup-10.C: Likewise.
* g++.dg/ext/cleanup-11.C: Likewise.
* g++.dg/ext/cleanup-5.C: Likewise.
* g++.dg/ext/cleanup-8.C: Likewise.
* g++.dg/ext/cleanup-9.C: Likewise.
* g++.dg/ext/is_invocable2.C: Likewise.
* g++.dg/goacc/pr107028-2.C: Likewise.
* g++.dg/gomp/target-lambda-2.C: Likewise.
* g++.dg/init/new11.C: Likewise.
* g++.dg/init/value3.C: Likewise.
* g++.dg/lto/pr66180_0.C: Likewise.
* g++.dg/opt/eh4.C: Likewise.
* g++.dg/opt/pr103989.C: Likewise.
* g++.dg/opt/pr80385.C: Likewise.
* g++.dg/opt/reload3.C: Likewise.
* g++.dg/other/i386-1.C: Likewise.
* g++.dg/other/i386-11.C: Likewise.
* g++.dg/other/i386-2.C: Likewise.
* g++.dg/other/i386-3.C: Likewise.
* g++.dg/other/i386-4.C: Likewise.
* g++.dg/other/i386-7.C: Likewise.
* g++.dg/other/i386-8.C: Likewise.
* g++.dg/other/mmintrin.C: Likewise.
* g++.dg/other/pr34435.C: Likewise.
* g++.dg/other/pr40446.C: Likewise.
* g++.dg/other/pr49133.C: Likewise.
* g++.dg/other/ucnid-1-utf8.C: Likewise.
* g++.dg/other/ucnid-1.C: Likewise.
* g++.dg/pr80481.C: Likewise.
* g++.dg/torture/pr10148.C: Likewise.
* g++.dg/torture/pr91334.C: Likewise.
* g++.dg/torture/pr91606.C: Likewise.
* g++.dg/tree-ssa/pr102216-2.C: Likewise.
* g++.dg/vect/slp-pr98855.cc: Likewise.
* g++.dg/warn/Wsystem-headers1a.C: Likewise.
* g++.dg/warn/noreturn-1.C: Likewise.
* g++.old-deja/g++.abi/arraynew.C: Likewise.
* g++.old-deja/g++.abi/cxa_vec.C: Likewise.
* g++.old-deja/g++.brendan/new3.C: Likewise.
* g++.old-deja/g++.eh/new1.C: Likewise.
* g++.old-deja/g++.eh/new2.C: Likewise.
* g++.old-deja/g++.jason/template44.C: Likewise.
* g++.old-deja/g++.law/arm13.C: Likewise.
* g++.old-deja/g++.law/scope2.C: Likewise.
* g++.old-deja/g++.mike/eh47.C: Likewise.
* g++.old-deja/g++.mike/ns15.C: Likewise.
* g++.old-deja/g++.mike/p710.C: Likewise.
* g++.old-deja/g++.mike/p9706.C: Likewise.
* g++.old-deja/g++.oliva/new1.C: Likewise.
* g++.old-deja/g++.other/delete8.C: Likewise.
* g++.target/i386/avx-pr54700-1.C: Likewise.
* g++.target/i386/avx-pr54700-2.C: Likewise.
* g++.target/i386/avx2-pr54700-1.C: Likewise.
* g++.target/i386/avx2-pr54700-2.C: Likewise.
* g++.target/i386/avx512bw-pr96246-2.C: Likewise.
* g++.target/i386/avx512vl-pr54700-1a.C: Likewise.
* g++.target/i386/avx512vl-pr54700-1b.C: Likewise.
* g++.target/i386/avx512vl-pr54700-2a.C: Likewise.
* g++.target/i386/avx512vl-pr54700-2b.C: Likewise.
* g++.target/i386/avx512vl-pr96246-2.C: Likewise.
* g++.target/i386/mvc4.C: Likewise.
* g++.target/i386/pr100885.C: Likewise.
* g++.target/i386/pr102166.C: Likewise.
* g++.target/i386/pr103750-fwprop-1.C: Likewise.
* g++.target/i386/pr105593.C: Likewise.
* g++.target/i386/pr112443.C: Likewise.
* g++.target/i386/pr113560.C: Likewise.
* g++.target/i386/pr88152.C: Likewise.
* g++.target/i386/pr88998.C: Likewise.
* g++.target/i386/pr94046-1.C: Likewise.
* g++.target/i386/pr94046-2.C: Likewise.
* g++.target/i386/sse4_1-pr54700-1.C: Likewise.
* g++.target/i386/sse4_1-pr54700-2.C: Likewise.
* g++.dg/tree-ssa/pr20458.C: Skip if !hostedlib because of
unavailable library definitions.

6 days agolibstdc++: Remove unused alias template in std::optional
Jonathan Wakely [Thu, 12 Sep 2024 09:55:23 +0000 (12 10:55 +0100)]
libstdc++: Remove unused alias template in std::optional

I added this __is_bool alias template in r15-2309-g6d86486292acbe but
it isn't actually used so can be removed.

libstdc++-v3/ChangeLog:

* include/std/optional (__is_bool): Remove.

6 days agolibstdc++: Simplify std::launder definition
Jonathan Wakely [Wed, 11 Sep 2024 09:17:23 +0000 (11 10:17 +0100)]
libstdc++: Simplify std::launder definition

A single static assert is a much simpler way to implement the
compile-time preconditions on std::launder than an overload set of
deleted functions and function templates. The only difficulty is that
<new> doesn't include <type_traits> so we can't use std::is_function and
std::is_void for the checks. That can be worked around though, by using
the __is_same and __is_function built-ins. If the __is_function built-in
isn't supported then the __builtin_launder built-in will give an error
anyway, since the commit preceding this one.

We can also remove the redundant __cplusplus >= 201703L check around the
definitions of std::launder and the interference constants, which are
already guarded by the appropriate feature test macros.

libstdc++-v3/ChangeLog:

* libsupc++/new (launder): Add static_assert and remove deleted
overloads.
* testsuite/18_support/launder/requirements_neg.cc: Adjust
expected diagnostics.

6 days agoc++: Make __builtin_launder reject invalid types [PR116673]
Jonathan Wakely [Wed, 11 Sep 2024 10:47:44 +0000 (11 11:47 +0100)]
c++: Make __builtin_launder reject invalid types [PR116673]

The standard says that std::launder is ill-formed for function pointers
and cv void pointers, so there's no reason for __builtin_launder to
accept them. This change allows implementations of std::launder to defer
to the built-in for error checking, although libstdc++ will continue to
diagnose it directly for more user-friendly diagnostics.

PR c++/116673

gcc/cp/ChangeLog:

* semantics.cc (finish_builtin_launder): Diagnose function
pointers and cv void pointers.

gcc/testsuite/ChangeLog:

* g++.dg/cpp1z/launder2.C: Adjust dg-error strings.
* g++.dg/cpp1z/launder10.C: New test.

6 days agoImplement modules for UNSIGNED.
Steven G. Kargl [Thu, 12 Sep 2024 19:33:31 +0000 (12 21:33 +0200)]
Implement modules for UNSIGNED.

gcc/fortran/ChangeLog:

* module.cc (bt_types): Add BT_UNSIGNED.

gcc/testsuite/ChangeLog:

* gfortran.dg/unsigned_kiss.f90: New test.

6 days agoi386: Implement SAT_ADD for signed vector integers
Uros Bizjak [Thu, 12 Sep 2024 18:34:28 +0000 (12 20:34 +0200)]
i386: Implement SAT_ADD for signed vector integers

Enable V4QI, V2QI and V2HI mode signed saturated arithmetic insn patterns
and add a couple of testcases to test for PADDSB and PADDSW instructions.

PR target/112600

gcc/ChangeLog:

* config/i386/mmx.md (<sat_plusminus:insn><mode>3): Rename
from *<sat_plusminus:insn><mode>3.

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr112600-3a.c: New test.
* gcc.target/i386/pr112600-3b.c: New test.

6 days agoc++: decltype(auto) deduction of statement-expression [PR116418]
Patrick Palka [Thu, 12 Sep 2024 16:45:03 +0000 (12 12:45 -0400)]
c++: decltype(auto) deduction of statement-expression [PR116418]

r8-7538 for PR84968 made strip_typedefs_expr diagnose STATEMENT_LIST
so that we reject statement-expressions in noexcept-specifiers to
match our behavior in template arguments (which the parser diagnoses
directly).

Later r11-7452 made decltype(auto) deduction canonicalize the expression
(as an implementation detail) which in turn calls strip_typedefs_expr,
and so ever since we inadvertently reject decltype(auto) deduction of a
statement-expression.

This patch just removes the diagnostic in strip_typedefs_expr and instead
treats statement-expressions similar to lambda-expressions.  The function
doesn't seem like the right place for such a diagnostic and so it seems
easier to just accept rather than try to reject them in a suitable place.

PR c++/116418

gcc/cp/ChangeLog:

* tree.cc (strip_typedefs_expr) <case STATEMENT_LIST>: Replace
this error path with ...
<case STMT_EXPR>: ... this, returning the original tree.

gcc/testsuite/ChangeLog:

* g++.dg/eh/pr84968.C: No longer expect an ahead of time diagnostic
for the statement-expresssion.  Instantiate the template and expect
an incomplete type error instead.
* g++.dg/ext/stmtexpr26.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
6 days agoc++: Disable deprecated/unavailable diagnostics when creating thunks for methods...
Jakub Jelinek [Thu, 12 Sep 2024 16:22:21 +0000 (12 18:22 +0200)]
c++: Disable deprecated/unavailable diagnostics when creating thunks for methods with such attributes [PR116636]

On the following testcase, we emit false positive warnings/errors about using
the deprecated or unavailable methods when creating thunks for them, even
when nothing (in the testcase so far) actually used those.

The following patch temporarily disables that diagnostics when creating
the thunks.

2024-09-12  Jakub Jelinek  <jakub@redhat.com>

PR c++/116636
* method.cc: Include decl.h.
(use_thunk): Temporarily change deprecated_state to
UNAVAILABLE_DEPRECATED_SUPPRESS.

* g++.dg/warn/deprecated-19.C: New test.

6 days agolibcpp, v2: Add support for gnu::base64 #embed parameter
Jakub Jelinek [Thu, 12 Sep 2024 16:17:05 +0000 (12 18:17 +0200)]
libcpp, v2: Add support for gnu::base64 #embed parameter

This patch which adds another #embed extension, gnu::base64.

As mentioned in the documentation, this extension is primarily
intended for use by the preprocessor, so that for the larger (say 32+ or
64+ bytes long embeds it doesn't have to emit tens of thousands or
millions of comma separated string literals which would be very expensive
to parse again, but can emit
 #embed "." __gnu__::__base64__( \
 "Tm9uIGVyYW0gbsOpc2NpdXMsIEJydXRlLCBjdW0sIHF1w6Ygc3VtbWlzIGluZ8OpbmlpcyBleHF1" \
 "aXNpdMOhcXVlIGRvY3Ryw61uYSBwaGlsw7Nzb3BoaSBHcsOmY28gc2VybcOzbmUgdHJhY3RhdsOt" \
 "c3NlbnQsIGVhIExhdMOtbmlzIGzDrXR0ZXJpcyBtYW5kYXLDqW11cywgZm9yZSB1dCBoaWMgbm9z" \
 "dGVyIGxhYm9yIGluIHbDoXJpYXMgcmVwcmVoZW5zacOzbmVzIGluY8O6cnJlcmV0LiBuYW0gcXVp" \
 "YsO6c2RhbSwgZXQgaWlzIHF1aWRlbSBub24gw6FkbW9kdW0gaW5kw7NjdGlzLCB0b3R1bSBob2Mg" \
 "ZMOtc3BsaWNldCBwaGlsb3NvcGjDoXJpLiBxdWlkYW0gYXV0ZW0gbm9uIHRhbSBpZCByZXByZWjD" \
 "qW5kdW50LCBzaSByZW3DrXNzaXVzIGFnw6F0dXIsIHNlZCB0YW50dW0gc3TDumRpdW0gdGFtcXVl" \
 "IG11bHRhbSDDs3BlcmFtIHBvbsOpbmRhbSBpbiBlbyBub24gYXJiaXRyw6FudHVyLiBlcnVudCDD" \
 "qXRpYW0sIGV0IGlpIHF1aWRlbSBlcnVkw610aSBHcsOmY2lzIGzDrXR0ZXJpcywgY29udGVtbsOp" \
 "bnRlcyBMYXTDrW5hcywgcXVpIHNlIGRpY2FudCBpbiBHcsOmY2lzIGxlZ8OpbmRpcyDDs3BlcmFt" \
 "IG1hbGxlIGNvbnPDum1lcmUuIHBvc3Ryw6ltbyDDoWxpcXVvcyBmdXTDunJvcyBzw7pzcGljb3Is" \
 "IHF1aSBtZSBhZCDDoWxpYXMgbMOtdHRlcmFzIHZvY2VudCwgZ2VudXMgaG9jIHNjcmliw6luZGks" \
 "IGV0c2kgc2l0IGVsw6lnYW5zLCBwZXJzw7Nuw6YgdGFtZW4gZXQgZGlnbml0w6F0aXMgZXNzZSBu" \
 "ZWdlbnQu")
with the meaning don't actually load some file, instead base64 decode
(RFC4648 with A-Za-z0-9+/ chars and = padding, no newlines in between)
the string and use that as data.  This is chosen because it should be
-pedantic-errors clean, fairly cheap to decode and then in optimizing
compiler could be handled as similar binary blob to normal #embed,
while the data isn't left somewhere on the disk, so distcc/ccache etc.
can move the preprocessed source without issues.
It makes no sense to support limit and gnu::offset parameters together
with it IMHO, why would somebody waste providing full data and then
threw some away?  prefix/suffix/if_empty are normally supported though,
but not intended to be used by the preprocessor.

This patch adds just the extension side, not the actual emitting of this
during -E or -E -fdirectives-only for now, that will be included in the
upcoming patch.

Compared to the earlier posted version of this extension, this patch
allows the string concatenation in the parameter argument (but still
doesn't allow escapes in the string, why would anyone use them when
only A-Za-z0-9+/= are valid).  The patch also adds support for parsing
this even in -fpreprocessed compilation.

2024-09-12  Jakub Jelinek  <jakub@redhat.com>

libcpp/
* internal.h (struct cpp_embed_params): Add base64 member.
(_cpp_free_embed_params_tokens): Declare.
* directives.cc (DIRECTIVE_TABLE): Add IN_I flag to T_EMBED.
(save_token_for_embed, _cpp_free_embed_params_tokens): New functions.
(EMBED_PARAMS): Add gnu::base64 entry.
(_cpp_parse_embed_params): Parse gnu::base64 parameter.  If
-fpreprocessed without -fdirectives-only, require #embed to have
gnu::base64 parameter.  Diagnose conflict between gnu::base64 and
limit or gnu::offset parameters.
(do_embed): Use _cpp_free_embed_params_tokens.
* files.cc (finish_embed, base64_dec_fn): New functions.
(base64_dec): New array.
(B64D0, B64D1, B64D2, B64D3): Define.
(finish_base64_embed): New function.
(_cpp_stack_embed): Use finish_embed.  Handle params->base64
using finish_base64_embed.
* macro.cc (builtin_has_embed): Call _cpp_free_embed_params_tokens.
gcc/
* doc/cpp.texi (Binary Resource Inclusion): Document gnu::base64
parameter.
gcc/testsuite/
* c-c++-common/cpp/embed-17.c: New test.
* c-c++-common/cpp/embed-18.c: New test.
* c-c++-common/cpp/embed-19.c: New test.
* c-c++-common/cpp/embed-27.c: New test.
* gcc.dg/cpp/embed-6.c: New test.
* gcc.dg/cpp/embed-7.c: New test.

6 days agolibcpp: adjust pedwarn handling
Jason Merrill [Tue, 27 Aug 2024 17:15:16 +0000 (27 13:15 -0400)]
libcpp: adjust pedwarn handling

Using cpp_pedwarning (CPP_W_PEDANTIC instead of if (CPP_PEDANTIC cpp_error
lets users suppress these diagnostics with
 #pragma GCC diagnostic ignored "-Wpedantic".

This patch changes all instances of the cpp_error (CPP_DL_PEDWARN to
cpp_pedwarning.  In cases where the extension appears in a later C++
revision, we now condition the warning on the relevant -Wc++??-extensions
flag instead of -Wpedantic; in such cases often the if (CPP_PEDANTIC) check
is retained to preserve the default non-warning behavior.

I didn't attempt to adjust the warning flags for the C compiler, since it
seems to follow a different system than C++.

The CPP_PEDANTIC check is also kept in _cpp_lex_direct to avoid an ICE in
the self-tests from cb.diagnostics not being initialized.

While working on testcases for these changes I noticed that the c-c++-common
tests are not run with -pedantic-errors by default like the gcc.dg and
g++.dg directories are.  And if I specify -pedantic-errors with dg-options,
the default -std= changes from c++?? to gnu++??, which interferes with some
other pedwarns.  So two of the tests are C++-only.

libcpp/ChangeLog:

* include/cpplib.h (enum cpp_warning_reason): Add
CPP_W_CXX{14,17,20,23}_EXTENSIONS.
* charset.cc (_cpp_valid_ucn, convert_hex, convert_oct)
(convert_escape, narrow_str_to_charconst): Use cpp_pedwarning
instead of cpp_error for pedwarns.
* directives.cc (directive_diagnostics, _cpp_handle_directive)
(do_line, do_elif): Likewise.
* expr.cc (cpp_classify_number, eval_token): Likewise.
* lex.cc (skip_whitespace, maybe_va_opt_error)
(_cpp_lex_direct): Likewise.
* macro.cc (_cpp_arguments_ok): Likewise.
(replace_args): Use -Wvariadic-macros for pedwarn about
empty macro arguments.

gcc/c-family/ChangeLog:

* c.opt: Add CppReason for Wc++{14,17,20,23}-extensions.
* c-pragma.cc (handle_pragma_diagnostic_impl): Don't check
OPT_Wc__23_extensions.

gcc/testsuite/ChangeLog:

* c-c++-common/pragma-diag-17.c: New test.
* g++.dg/cpp0x/va-opt1.C: New test.
* g++.dg/cpp23/named-universal-char-escape3.C: New test.

6 days agoarm: testsuite: make use of -mcpu=unset/-march=unset
Richard Earnshaw [Thu, 12 Sep 2024 13:24:55 +0000 (12 14:24 +0100)]
arm: testsuite: make use of -mcpu=unset/-march=unset

This patch makes use of the new ability to unset the CPU or
architecture flags on the command line to enable several more tests on
Arm.  It doesn't cover every case and it does enable some tests that
now fail for different reasons when the tests are no-longer skipped;
these were failing anyway for other testsuite configurations, so it's
still an overall improvement.

There's some restructuring required to fully implement this change: we
could previously treat Xscale as an architecture, even though the
option set -mcpu=, we now need to handle this correctly so that we
unset the architecture rather than the CPU.  To do this I've added a
new table for these variants and renamed the template functions to use
'cpu' rather than 'arch'.  This entailed updating the two XScale
related tests accordingly.

gcc/testsuite/ChangeLog:

* lib/target-supports.exp: Move xscale to new generator table.
(check_effective_target_arm_arch_FUNC_ok): Add -mcpu=unset to the
list of flags.
(add_options_for_arm_arch_FUNC): Likewise.
(check_effective_target_arm_cpu_FUNC_ok): New function.
(add_options_for_arm_cpu_FUNC): Likewise.
(check_effective_target_arm_cpu_FUNC_link): Likewise.
(check_effective_target_arm_cpu_FUNC_multilib): Likewise.
* gcc.target/arm/g2.c: Update dg directives.
* gcc.target/arm/scd42-2.c: Likewise.