]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
3 weeks agophi-opt: Disable parts of it for -Og
Andrew Pinski [Mon, 13 Oct 2025 23:47:55 +0000 (16:47 -0700)] 
phi-opt: Disable parts of it for -Og

While working on the cselim limited part of phiopt, I noticed
that the debugging experience for -Og case would cause jumping
execution in some cases. So this disables the store and operation
factoring parts for -Og since those 2 can cause the line information
of the debugging to be off.

Bootstrapped and tested on x86_64-linux-gnu.

gcc/ChangeLog:

* tree-ssa-phiopt.cc (pass_phiopt::execute): Disable
cselim-limited and factor out operations for -Og.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
3 weeks agocselim: Handle clobbers too [PR122178]
Andrew Pinski [Mon, 13 Oct 2025 23:35:07 +0000 (16:35 -0700)] 
cselim: Handle clobbers too [PR122178]

With the addition of cselim-limited in phiopt, factoring
out clobbers can be added easily. Now sink handles clobbers as
a store too. So this just moves that earlier.

This adds support there with a testcase to show it happens.

Bootstrapped and tested on x86_64-linux-gnu.

PR tree-optimization/122178

gcc/ChangeLog:

* tree-ssa-phiopt.cc (cond_if_else_store_replacement_1): Handle
clobber statements.

gcc/testsuite/ChangeLog:

* g++.dg/tree-ssa/cselim-1.C: New test.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
3 weeks agoprop: Remove may_propagate_copy_into_asm [PR122182]
Andrew Pinski [Mon, 13 Oct 2025 21:04:31 +0000 (14:04 -0700)] 
prop: Remove may_propagate_copy_into_asm  [PR122182]

may_propagate_copy_into_asm has been returning true always since r0-118216-g01c59d23df7eef.
Many places that checks may_propagate_copy don't check
may_propagate_copy_into_asm for asm_expr. may_propagate_copy_into_stmt
does not check when you would have expected it to. So let's remove may_propagate_copy_into_asm
and remove the checks from substitute_and_fold_engine and dom.

Bootstrapped and tested on x86_64-linux-gnu.

PR tree-optimization/122182
gcc/ChangeLog:

* tree-ssa-dom.cc (cprop_operand): Don't check may_propagate_copy_into_asm.
* tree-ssa-propagate.cc (substitute_and_fold_engine::replace_uses_in): Don't
check may_propagate_copy_into_asm.
(may_propagate_copy_into_asm): Remove.
* tree-ssa-propagate.h (may_propagate_copy_into_asm): Remove.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
3 weeks ago[PATCH v3] RISC-V: Implement RISC-V profile macro support
Zhongyao Chen [Tue, 14 Oct 2025 02:55:40 +0000 (20:55 -0600)] 
[PATCH v3] RISC-V: Implement RISC-V profile macro support

users can now write code like the following to adapt to the
current RISC-V profile selected at compile time:

```c
  #ifdef __riscv_rva23u64
    // Code specific to the rva23u64 profile
  #endif
```

Changes from v2:
- clarify get_profile_name comment

gcc/
* common/config/riscv/riscv-common.cc (riscv_subset_list::get_profile_name):
New function.
* config/riscv/riscv-c.cc (riscv_cpu_cpp_builtins): Define
profile macro if a profile is detected.
* config/riscv/riscv-subset.h (riscv_subset_list::get_profile_name): Declare.

gcc/testsuite/
* gcc.target/riscv/predef-profiles-1.c: New test for __riscv_rvi20u64.
* gcc.target/riscv/predef-profiles-2.c: New test for __riscv_rvi20u32.
* gcc.target/riscv/predef-profiles-3.c: New test for __riscv_rva20u64.
* gcc.target/riscv/predef-profiles-4.c: New test for __riscv_rva22u64.
* gcc.target/riscv/predef-profiles-5.c: New test for __riscv_rva23u64.
* gcc.target/riscv/predef-profiles-6.c: New test for __riscv_rva23s64.
* gcc.target/riscv/predef-profiles-7.c: New test for __riscv_rvb23u64.
* gcc.target/riscv/predef-profiles-8.c: New test for __riscv_rvb23s64.

3 weeks agoDaily bump.
GCC Administrator [Tue, 14 Oct 2025 00:20:06 +0000 (00:20 +0000)] 
Daily bump.

3 weeks agolibcpp: decode original directory strings for traditional CPP
Eric Botcazou [Mon, 13 Oct 2025 22:24:37 +0000 (00:24 +0200)] 
libcpp: decode original directory strings for traditional CPP

gcc/testsuite/
* gcc.dg/cpp/cpp.exp: Process .i files.
* gcc.dg/cpp/pr36674.i: Pass -Wno-implicit-int.
* gcc.dg/cpp/escape-3.i: New test.

3 weeks agolibcpp: decode original directory strings for traditional CPP
Pierre Marie de Rodat [Mon, 13 Oct 2025 22:11:37 +0000 (00:11 +0200)] 
libcpp: decode original directory strings for traditional CPP

In traditional CPP mode (-save-temps, -no-integrated-cpp, etc.), the
compilation directory is conveyed to cc1 using a line such as:

 # <line> "/path/name//"

This string literal can contain escape sequences, for instance, if the
original source file was compiled in "/tmp/a\b", then this line will be:

 # <line> "/tmp/a\\b//"

So reading the compilation directory must decode escape sequences. This
last part is currently missing and this patch implements it.

libcpp/
* init.cc (read_original_directory): Attempt to decode escape
sequences with cpp_interpret_string_notranslate.

3 weeks ago[RISC-V][PR target/120811] Improving address reloads in LRA
Shreya Munnangi [Mon, 13 Oct 2025 22:13:44 +0000 (16:13 -0600)] 
[RISC-V][PR target/120811] Improving address reloads in LRA

In pr120811, we have cases where GCC is emitting an extra addi instruction
instead of using the 12-bit signed-immediate of ld.

addi t1, t1, 1
ld   t1, 0(t1)

This problem occurs when fp -> sp+offset elimination results in an
out-of-range constant and we generate an address reload in LRA using
addsi/adddi expanders.

We've already adjusted the expanders to widen the set of valid operands to
allow more constants for the 2nd input operand. These expanders, rather than
constructing the constant into a register and using an add instruction, will
generate two addi instructions (or shNadd) during initial RTL generation.

We define a new pattern for cases where we need to access the current frame
and the offsets are too large. This gets reasonable code out of LRA in a form
fold-mem-offsets can handle, rather than having to wait for sched2 to do
the height reduction transformation and leaving in the unnecessary add
instruction in the RTL stream.

To avoid the two addi instructions being squashed back together in the
post-reload combine, we remove the adddi3_const_sum_of_two_s12 pattern.

We are seeing about 100 billion dynamic instructions saved which is about 5%
on cactuBSSN and a 2% improvement in performance on the BPI.

PR target/120811

gcc/

* config/riscv/riscv.cc (synthesize_add): Exchange constant terms when
generating addi pairs.
(synthesize_addsi): Similarly.
* config/riscv/riscv.md (addptr<mode>3): New define_expand.
(*add<mode>3_const_sum_of_two_s12): Remove pattern.

gcc/testsuite/

* gcc.target/riscv/add-synthesis-1.c: Adjust const to fit in range.
* gcc.target/riscv/pr120811.c: Add new test case.
* gcc.target/riscv/sum-of-two-s12-const-1.c: Adjust const to fit in range.

3 weeks ago[RISC-V][PR target/120674] Avoid division by zero in dwarf emitter when vector is...
Jeff Law [Mon, 13 Oct 2025 20:33:10 +0000 (14:33 -0600)] 
[RISC-V][PR target/120674] Avoid division by zero in dwarf emitter when vector is not enabled

This is a RISC-V specific failure in the dwarf2 emitter.  When vector is not
enabled riscv_convert_vector_chunks sets the riscv_vector_chunks poly_int to
[1, 0].

riscv_dwarf_poly_indeterminite_value pulls out that 0 coefficient and uses that
as FACTOR triggering a divide by zero here:

>               /* Add COEFF * ((REGNO / FACTOR) - BIAS) to the value:
>                  add COEFF * (REGNO / FACTOR) now and subtract
>                  COEFF * BIAS from the final constant part.  */
>               constant -= coeff * bias;
>               add_loc_descr (&ret, new_reg_loc_descr (regno, 0));
>               if (coeff % factor == 0)
>                 coeff /= factor;
>               else
>                 {
>                   int amount = exact_log2 (factor);
>                   gcc_assert (amount >= 0);
>                   add_loc_descr (&ret, int_loc_descriptor (amount));
>                   add_loc_descr (&ret, new_loc_descr (DW_OP_shr, 0, 0));
>                 }

Per Robin's recommendation this patch adjusts
riscv_dwarf_poly_indeterminite_value to never set FACTOR to 0, but instead
detect this case and adjust its value to 1.

That fixes the ICE and looks good across the board in my tester. Waiting on
pre-commit CI, of course.

PR target/120674
gcc/
* config/riscv/riscv.cc (riscv_dwarf_poly_indeterminite_value): Do not
set FACTOR to zero, for that case use one instead.

gcc/testsuite

* gcc.target/riscv/pr120674.c: New test.

3 weeks agolibstdc++: Fix grammatical error in comment in std::advance
Jonathan Wakely [Thu, 9 Oct 2025 14:21:16 +0000 (15:21 +0100)] 
libstdc++: Fix grammatical error in comment in std::advance

libstdc++-v3/ChangeLog:

* include/bits/stl_iterator_base_funcs.h (advance): Fix comment.

3 weeks ago++: Fix up __PRETTY_FUNCTION__ for -fexec-charset= [PR122228]
Jakub Jelinek [Mon, 13 Oct 2025 19:36:47 +0000 (21:36 +0200)] 
++: Fix up __PRETTY_FUNCTION__ for -fexec-charset= [PR122228]

When working on reflection, I've noticed that while we correctly translate
__FUNCTION__ content into the execution charset, for C++ we don't translate
__PRETTY_FUNCTION__ content and leave it in the SOURCE_CHARSET encoding:

const char *
file ()
{
  return __FILE__;
}

const char *
func ()
{
  return __func__;
}

const char *
function ()
{
  return __FUNCTION__;
}

const char *
pretty_function ()
{
  return __PRETTY_FUNCTION__;
}
./cc1 -quiet -fexec-charset=IBM1047 /tmp/0.C -o - | grep string
        .string "a\243\224\227a\360K\303"
        .string "\206\244\225\203"
        .string "\206\244\225\203\243\211\226\225"
        .string "\227\231\205\243\243\250m\206\244\225\203\243\211\226\225"
./cc1plus -quiet -fexec-charset=IBM1047 /tmp/0.C -o - | grep string
        .string "a\243\224\227a\360K\303"
        .string "\206\244\225\203"
        .string "\206\244\225\203\243\211\226\225"
        .string "const char* pretty_function()"

The following patch fixes that.

2025-10-13  Jakub Jelinek  <jakub@redhat.com>

PR c++/122228
* decl.cc (cp_make_fname_decl): When not using fname_as_decl,
attempt to translate name into ordinary literal encoding.

* g++.dg/cpp1y/func_constexpr3.C: New test.

3 weeks agoPR modula2/122241: Lack of spellng hints with simple errors
Gaius Mulley [Mon, 13 Oct 2025 15:43:07 +0000 (16:43 +0100)] 
PR modula2/122241: Lack of spellng hints with simple errors

Following on from the initial bug fix for PR modula2/122241
this patch provides spell check hints for unknown types, variables
and constants.  The accuracy of the offending module end name
is also improved

gcc/m2/ChangeLog:

PR modula2/122241
* gm2-compiler/M2Quads.mod (BuildSizeFunction): Improve
error message.
(BuildTSizeFunction): Improve error message.
* gm2-compiler/P3Build.bnf (ProgramModule): New variable
namet.
Pass namet to P3EndBuildProgModule.
(ImplementationModule): New variable namet.
Pass namet to P3EndBuildImpModule.
(ModuleDeclaration): New variable namet.
Pass namet to P3EndBuildInnerModule.
(DefinitionModule): New variable namet.
Pass namet to P3EndBuildDefModule.
* gm2-compiler/P3SymBuild.def (P3EndBuildDefModule): New
parameter tokno.
(P3EndBuildImpModule): Ditto.
(P3EndBuildProgModule): Ditto.
(EndBuildInnerModule): Ditto.
* gm2-compiler/P3SymBuild.mod (P3EndBuildDefModule): New
parameter tokno.
Pass tokno to CheckForUnknownInModule.
(P3EndBuildImpModule): Ditto.
(P3EndBuildProgModule): Ditto.
(EndBuildInnerModule): Ditto.
* gm2-compiler/PCBuild.bnf (ProgramModule): New variable
namet.
Pass namet to PCEndBuildProgModule.
(ImplementationModule): New variable namet.
Pass namet to PCEndBuildImpModule.
(ModuleDeclaration): New variable namet.
Pass namet to PCEndBuildInnerModule.
(DefinitionModule): New variable namet.
Pass namet to PCEndBuildDefModule.
* gm2-compiler/PCSymBuild.def (PCEndBuildDefModule): New
parameter tokno.
(PCEndBuildImpModule): Ditto.
(PCEndBuildProgModule): Ditto.
(PCEndBuildInnerModule): Ditto.
* gm2-compiler/PCSymBuild.mod (PCEndBuildDefModule): New
parameter tokno.
Pass tokno to CheckForUnknownInModule.
(PCEndBuildImpModule): Ditto.
(PCEndBuildProgModule): Ditto.
(PCEndBuildInnerModule): Ditto.
* gm2-compiler/PHBuild.bnf (DefinitionModule): New variable
namet.
Pass namet to PHEndBuildDefModule.
(ModuleDeclaration): New variable namet.
Pass namet to PHEndBuildProgModule.
(ImplementationModule): New variable namet.
Pass namet to PHEndBuildImpModule.
(ModuleDeclaration): New variable namet.
Pass namet to PHEndBuildInnerModule.
(DefinitionModule): New variable namet.
Pass namet to PHEndBuildDefModule.
* gm2-compiler/SymbolTable.def (CheckForUnknownInModule): Add
tokno parameter.
* gm2-compiler/SymbolTable.mod (CheckForUnknownInModule): Add
tokno parameter.
Pass tokno to CheckForUnknowns.
(CheckForUnknowns): Reimplement.

gcc/testsuite/ChangeLog:

PR modula2/122241
* gm2/iso/fail/badconst.mod: New test.
* gm2/iso/fail/badtype.mod: New test.
* gm2/iso/fail/badvar.mod: New test.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
3 weeks agoaarch64, testsuite: Add -fchecking to test options [PR121772]
Alex Coplan [Mon, 13 Oct 2025 13:41:09 +0000 (13:41 +0000)] 
aarch64, testsuite: Add -fchecking to test options [PR121772]

I noticed while testing a backport of the PR121772 fix to GCC 13 that
the test wasn't triggering the ICE as expected with the unpatched
compiler.

This turned out to be because the ICE is a checking ICE, and we
configure by default with --enable-checking=release on the branches.
Additionally, I hadn't noticed when doing the backports to 15 and 14
since there we still ICE later on in emit_move_insn even if we don't
catch the invalid gimple with checking.

I'm not too sure why the 13 branch doesn't see the emit_move_insn ICE,
but it's somewhat irrelevant - the important thing is that adding
-fchecking to the options makes the test fail as expected with an
unpatched compiler (i.e. with a gimple checking failure), even on
release branches.

I considered applying this patch to just the release branches, but
figured that trunk will at some point itself become a release branch, so
it seems to make most sense just to apply it everywhere.

I've checked that the test still passes with this patch, and still fails
if I revert the PR121772 fix.

gcc/testsuite/ChangeLog:

PR tree-optimization/121772
* gcc.target/aarch64/torture/pr121772.c: Add -fchecking to
dg-options.

3 weeks agolibstdc++: Implement P2835R7 Expose std::atomic_ref's object address
Yuao Ma [Fri, 10 Oct 2025 15:14:48 +0000 (23:14 +0800)] 
libstdc++: Implement P2835R7 Expose std::atomic_ref's object address

This patch adds the address function to __atomic_ref_base.

libstdc++-v3/ChangeLog:

* include/bits/atomic_base.h: Implement address().
* include/bits/version.def: Bump version number.
* include/bits/version.h: Regenerate.
* testsuite/29_atomics/atomic_ref/address.cc: New test.

3 weeks agoMatch: Add widen_mul based unsigned SAT_MUL after gimple_convert refactor
Pan Li [Sat, 11 Oct 2025 15:12:59 +0000 (23:12 +0800)] 
Match: Add widen_mul based unsigned SAT_MUL after gimple_convert refactor

The build_and_insert_cast refactored to go the gimple_convert way, to
take care of the widen_mul.  Thus, the gimple layout from uint64_t
widen_mul to uint128_t doesn't need additional cast like other types
(uint32_t, uint16_t, uint8_t) widen to uint128_t for mul.  Thus, add
the simplifed pattern match for such forms of unsigned SAT_MUL.

The below test suites are passed for this patch:
1. The rv64gcv fully regression tests.
2. Fix rv64gcv SAT_MUL test failure of optimized .SAT_MUL check.
3. The x86 bootstrap tests.
4. The x86 fully regression tests.

gcc/ChangeLog:

* match.pd: Add simplifed pattern for widen_mul based unsigned
SAT_MUL.

Signed-off-by: Pan Li <pan2.li@intel.com>
3 weeks agoRemove max_count computation from ipa-inline
Jan Hubicka [Mon, 13 Oct 2025 10:13:51 +0000 (12:13 +0200)] 
Remove max_count computation from ipa-inline

Ipa inline computes max_count which used to be applied later to compute badness
before it was converted to sreal.  Now it is only used in couple of places to see
if any IPA profile is presents at all.  This patch replaces this by more specific
flag has_nonzero_ipa_profile.

gcc/ChangeLog:

* ipa-inline.cc (max_count): Remove.
(has_nonzero_ipa_profile): New.
(inline_small_functions): Update.
(dump_inline_stats): Update.

3 weeks agolibstdc++: Fix reverse iteration in _Utf16_view
Jonathan Wakely [Fri, 10 Oct 2025 22:56:43 +0000 (23:56 +0100)] 
libstdc++: Fix reverse iteration in _Utf16_view

When iterating over a range of char16_t in reverse the _Utf_view was
incorrectly treating U+DC00 as a valid high surrogate that can precede
the low surrogate. But U+DC00 is a low surrogate, and so should not be
allowed before another low surrogate. The check should be u2 >= 0xDC00
rather than u2 > 0xDC00.

libstdc++-v3/ChangeLog:

* include/bits/unicode.h (_Utf_view::_M_read_reverse_utf16):
Fix check for high surrogate preceding low surrogate.
* testsuite/ext/unicode/view.cc: Check unpaired low surrogates.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
3 weeks agolibstdc++: Fix check for 7-bit ASCII characters
Jonathan Wakely [Fri, 10 Oct 2025 22:16:22 +0000 (23:16 +0100)] 
libstdc++: Fix check for 7-bit ASCII characters

This should check for c <= 0x7f not x < 0x7f, because 0x7f is an ASCII
character (DEL).

libstdc++-v3/ChangeLog:

* include/bits/unicode.h (__is_single_code_unit): Fix check for
7-bit ASCII characters.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
3 weeks agovect: Handle grouped accesses via gather/scatter.
Robin Dapp [Fri, 5 Sep 2025 14:19:18 +0000 (16:19 +0200)] 
vect: Handle grouped accesses via gather/scatter.

This patch adds gather/scatter handling for grouped access.  The idea is
to e.g. replace an access (for uint8_t elements) like
  arr[0]
  arr[1]
  arr[2]
  arr[3]
  arr[0 + step]
  arr[1 + step]
  ...
by gather loads of uint32_t
  arr[0..3]
  arr[0 + step * 1..3 + step * 1]
  arr[0 + step * 2..3 + step * 2]
  ...
where the offset vector is a simple series with step STEP.
If supported, such a gather can be implemented as a strided load.

If we have a masked access the transformation is not performed.
Masking could still be done after converting the data back to the
original vectype but it does not seem worth it for now.

PR target/118019

gcc/ChangeLog:

* internal-fn.cc (get_supported_else_vals): Exit at invalid
index.
(internal_strided_fn_supported_p): New funtion.
* internal-fn.h (internal_strided_fn_supported_p): Declare.
* tree-vect-stmts.cc (vector_vector_composition_type):
Add vector_only argument.
(vect_use_grouped_gather): New function.
(vect_get_store_rhs): Adjust docs of
vector_vector_composition_type.
(get_load_store_type): Try grouped gather.
(vectorizable_store): Use punned vectype.
(vectorizable_load): Ditto.
* tree-vectorizer.h (struct vect_load_store_data): Add punned
vectype.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/pr118019-2.c: New test.

3 weeks agomatch.pd: Do not canonicalize division by power 2 for {ROUND, CEIL}_DIV
Avinash Jayakar [Mon, 13 Oct 2025 09:47:45 +0000 (15:17 +0530)] 
match.pd: Do not canonicalize division by power 2 for {ROUND, CEIL}_DIV

Canonicalization of unsigned division by power of 2 only applies to
{TRUNC,FLOOR,EXACT}_DIV, therefore remove the same pattern for {CEIL,ROUND}_DIV,
which was added in a previous commit.

2025-10-13  Avinash Jayakar  <avinashd@linux.ibm.com>

gcc/ChangeLog:
PR tree-optimization/122213
* match.pd: Canonicalize unsigned pow2 div only for trunk, floor and
exact div.

3 weeks agoopenmp: Teach OpenMP declare variant append_args handling about TYPE_NO_NAMED_ARGS_ST...
Jakub Jelinek [Mon, 13 Oct 2025 07:47:09 +0000 (09:47 +0200)] 
openmp: Teach OpenMP declare variant append_args handling about TYPE_NO_NAMED_ARGS_STDARG_P

Since my recent patch, GCC for C++26 uses the TYPE_NO_NAMED_ARGS_STDARG_P
flag like C23 uses for (...) function types.  The OpenMP declare variant
append_args handling does some very ugly hacks (modify TYPE_ARG_TYPES
temporarily instead of trying to create new function types) and had
to be tweaked to deal with that.  This fixes
-FAIL: c-c++-common/gomp/append-args-7.c  -std=c++26  scan-tree-dump-times gimple "f3 \\\\(obj1, obj2, 1, a, cp, d\\\\);" 1
-FAIL: c-c++-common/gomp/append-args-7.c  -std=c++26 (test for excess errors)

2025-10-13  Jakub Jelinek  <jakub@redhat.com>

* decl.cc (omp_declare_variant_finalize_one): If !nbase_args
and TREE_TYPE (decl) has TYPE_NO_NAMED_ARGS_STDARG_P bit set
and varg is NULL, temporarily set TYPE_NO_NAMED_ARGS_STDARG_P
on TREE_TYPE (variant).

3 weeks agoAvoid bool pattern for vect_extern_defs
Richard Biener [Mon, 13 Oct 2025 06:22:04 +0000 (08:22 +0200)] 
Avoid bool pattern for vect_extern_defs

The following avoids applying the new bool pattern for binary bitwise
ops when the wrongly typed operand is external or constant as we
cannot handle in-loop conversions of externs.

* tree-vect-patterns.cc (integer_type_for_mask): Add optional
output dt argument.
(vect_recog_bool_pattern): Make sure to not apply the bitwise
binary pattern to an external operand.

3 weeks agoFortran: Fix ICE in deallocating PDTs [PR121191]
Paul Thomas [Mon, 13 Oct 2025 06:55:18 +0000 (07:55 +0100)] 
Fortran: Fix ICE in deallocating PDTs [PR121191]

2025-10-13  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
PR fortran/121191
* trans-array.cc (has_parameterized_comps): New function which
checks if a derived type has parameterized components.
( gfc_deallocate_pdt_comp): Use it to prevent deallocation of
PDTs if there are no parameterized components.

gcc/testsuite/
PR fortran/121191
* gfortran.dg/pdt_59.f03: New test.

3 weeks agoObjective-C/C++: Enable Wignored-attributes.
Iain Sandoe [Mon, 13 Oct 2025 05:57:55 +0000 (06:57 +0100)] 
Objective-C/C++: Enable Wignored-attributes.

r16-4373 altered headers so that Wignored-attributes was named in
a diagnostic push.  This causes several Objective-C++ tests to fail
since the atomicity.h header is included there.

Since Objective-C/C++ are intended to be supersets of the base
language, there is no specific reason to exclude this warning there.

gcc/c-family/ChangeLog:

* c.opt: Enable Wignored-attributes for Objective-C and
Objective-C++.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
3 weeks agoDaily bump.
GCC Administrator [Mon, 13 Oct 2025 00:17:27 +0000 (00:17 +0000)] 
Daily bump.

3 weeks agoc++: Ensure mark_lvalue_use returns an lvalue [PR122163]
Nathaniel Shead [Sun, 5 Oct 2025 10:30:56 +0000 (21:30 +1100)] 
c++: Ensure mark_lvalue_use returns an lvalue [PR122163]

When processing a tentative capture of a rvalue reference, mark_use
folds it away to the referred-to entity.  But this is an rvalue, and
when called from an lvalue context an rvalue reference should still be
an lvalue.

PR c++/122163

gcc/cp/ChangeLog:

* expr.cc (mark_use): When processing a reference, always return
an lvalue reference when !rvalue_p.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/lambda/lambda-ref3.C: New test.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
3 weeks agoFortran: Fix some minor PDT parse errors [PR95543,PR103748]
Paul Thomas [Sun, 12 Oct 2025 07:21:11 +0000 (08:21 +0100)] 
Fortran: Fix some minor PDT parse errors [PR95543,PR103748]

2025-10-12  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
PR fortran/95543
PR fortran/103748
* decl.cc (insert_parameter_exprs): Guard param->expr before
using it.
(gfc_get_pdt_instance): Substitute paramaters in kind default
initializers.
(gfc_match_decl_type_spec): Emit an error if a type paramter
specification list appears in a variable declaraion with a
non-parameterized type.
* primary.cc (gfc_match_rvalue): Emit an error if a type spec
list is empty.

gcc/testsuite/
PR fortran/95543
* gfortran.dg/pdt_17.f03: Change error message.
* gfortran.dg/pdt_57.f03: New test.

PR fortran/103748
* gfortran.dg/pdt_58.f03: New test.

3 weeks agoDaily bump.
GCC Administrator [Sun, 12 Oct 2025 00:17:20 +0000 (00:17 +0000)] 
Daily bump.

3 weeks agoPR modula2/122241 Lack of spelling hints with simple errors
Gaius Mulley [Sat, 11 Oct 2025 17:34:25 +0000 (18:34 +0100)] 
PR modula2/122241 Lack of spelling hints with simple errors

This patch introduces spell checking to Modula-2.  Currently
it spell checks unknown symbols in pass 3.  Unknowns found in
record fields, with statements, procedures and variable names
are checked.

gcc/m2/ChangeLog:

PR modula2/122241
* Make-lang.in (GM2_C_OBJS): Add m2/gm2-gcc/m2spellcheck.o.
(GM2-COMP-BOOT-DEFS): Add M2StackSpell.def.
(GM2-COMP-BOOT-MODS): Add M2StackSpell.mod.
(GM2-GCC-DEFS): Add m2spellcheck.def.
(GM2-COMP-DEFS): Add M2StackSpell.def.
(GM2-COMP-MODS): Add M2StackSpell.mod.
* gm2-compiler/M2Base.mod (CheckCompatible): Add comments.
* gm2-compiler/M2MetaError.mod (importHint): New field.
(exportHint): Ditto.
(withStackHint): Ditto.
* gm2-compiler/M2Quads.mod (M2StackSpell): Import.
(BuildProcedureCall): Add spell check specifier when
encountering an unknown symbol.
(CheckProcedureParameters): Ditto.
(CheckParameter): Ditto.
(DescribeType): Ditto.
(GetQualidentImport): Ditto.
(BuildValFunction): Ditto.
(BuildCastFunction): Ditto.
(BuildConvertFunction): Ditto.
(ExpectingParameterType): Ditto.
(ExpectingVariableType): Ditto.
(BuildDesignatorPointer): Ditto.
(BuildEmptySet): Ditto.
(CheckVariableOrConstantOrProcedure): Ditto.
* gm2-compiler/P2SymBuild.mod (BuildType): Add comment.
* gm2-compiler/P3Build.bnf (SubDesignator): Reimplement.
* gm2-compiler/P3SymBuild.mod (P3StartBuildDefModule): Add
M2StackSpell.Push.
(P3StartBuildProgModule): Ditto.
(P3StartBuildImpModule): Ditto.
(StartBuildInnerModule): Ditto.
(StartBuildProcedure): Ditto.
(P3EndBuildDefModule): Add M2StackSpell.Pop.
(P3EndBuildImpModule): Ditto.
(P3EndBuildProgModule): Ditto.
(EndBuildInnerModule): Ditto.
(EndBuildProcedure): Ditto.
(BuildProcedureHeading): Ditto.
(EndBuildForward): Ditto.
* gm2-compiler/SymbolTable.mod (RequestSym): Reformat.
* gm2-gcc/init.cc (_M2_M2StackSpell_init): New prototype.
(init_PerCompilationInit): Call _M2_M2StackSpell_init.
* gm2-libs/DynamicStrings.def (RemoveWhitePrefix): Correct
comment.
* gm2-libs/DynamicStrings.mod (RemoveWhitePrefix): Ditto.
* gm2-compiler/M2StackSpell.def: New file.
* gm2-compiler/M2StackSpell.mod: New file.
* gm2-gcc/m2spellcheck.cc: New file.
* gm2-gcc/m2spellcheck.def: New file.
* gm2-gcc/m2spellcheck.h: New file.

gcc/testsuite/ChangeLog:

* gm2/iso/fail/badfield.mod: New test.
* gm2/iso/fail/badfield2.mod: New test.
* gm2/iso/fail/badprocedure.mod: New test.
* gm2/iso/fail/badprocedure2.mod: New test.
* gm2/iso/fail/badset4.mod: New test.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
3 weeks ago[PR target/119587] RISC-V: xtheadmemidx: Split slli.uw pattern
Bohan Lei [Sat, 11 Oct 2025 16:11:34 +0000 (10:11 -0600)] 
[PR target/119587] RISC-V: xtheadmemidx: Split slli.uw pattern

The combine pass can generate an index like (and:DI (mult:DI (reg:DI)
(const_int scale)) (const_int mask)) when XTheadMemIdx is available.
LRA may pull it out, and thus a splitter is needed when Zba is not
available.

A similar splitter were introduced when XTheadMemIdx support was added,
but removed in commit 31c3c5d.  The new splitter in this new patch is
based on the removed one.

PR target/119587
gcc/ChangeLog:

* config/riscv/thead.md (*th_memidx_operand): New splitter.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/xtheadmemidx-bug.c: New test.

3 weeks agoAllow target to chose address-space for artificial rodata.
Georg-Johann Lay [Wed, 11 Dec 2024 10:57:46 +0000 (11:57 +0100)] 
Allow target to chose address-space for artificial rodata.

This patch adds a new target hook TARGET_ADDR_SPACE_FOR_ARTIFICIAL_RODATA
that allows the backend to chose an address space other than the generic one.

This hook is only invoked when the compiler can make sure that:

-  The object for which the hooks is being invoked will be located
   in the desired address space, and

-  All accesses to that object will be accesses appropriate for
   that address space, and

-  The object is read-only and is initialized at load time, and

-  The hook invokations are independent of each other.  This means
   that this hook can be used to optimize code / data consumption.
   (Rather than introducing an ABI change, which would be the case
   when C++'s vtables were put in a different AS).

To date, there are only two candidates for such compiler generated
lookup tables:  CSWTCH tables as generated by tree-switch-conversion.cc,
and CRC lookup tables generated by gimple-crc-optimization.cc.

gcc/
* coretypes.h (enum artificial_rodata): New enum type.
* doc/tm.texi: Rebuild.
* doc/tm.texi.in (TARGET_ADDR_SPACE_FOR_ARTIFICIAL_RODATA):
New hook.
* target.def (addr_sapce.for_artificial_rodata): New DEFHOOK.
* targhooks.cc (default_addr_space_convert): New function.
* targhooks.h (default_addr_space_convert): New prototype.
* tree-switch-conversion.cc (build_one_array) <value_type>:
Set type_quals address-space according to
targetm.addr_space.for_artificial_rodata().

* config/avr/avr.cc (avr_rodata_in_flash_p): Move up.
(TARGET_ADDR_SPACE_FOR_ARTIFICIAL_RODATA): Define to...
(avr_addr_space_for_artificial_rodata): ...this new function.
* common/config/avr/avr-common.cc (avr_option_optimization_table):
Adjust -ftree-switch-conversion comment.

3 weeks agofortran: fix bootstrap after r16-4372 [PR122257]
Harald Anlauf [Sat, 11 Oct 2025 12:53:37 +0000 (14:53 +0200)] 
fortran: fix bootstrap after r16-4372 [PR122257]

PR fortran/50377
PR fortran/122257

gcc/fortran/ChangeLog:

* resolve.cc (resolve_actual_arglist): Initialize variable.

3 weeks agolibstdc++: Update Autoconf manual link
Gerald Pfeifer [Sat, 11 Oct 2025 10:18:56 +0000 (12:18 +0200)] 
libstdc++: Update Autoconf manual link

libstdc++-v3:
* doc/xml/manual/build_hacking.xml: Update Autoconf manual link.
* doc/html/manual/appendix_porting.html: Regenerate.

3 weeks ago*: Fix patch email address
Ben Boeckel [Sat, 11 Oct 2025 02:01:02 +0000 (22:01 -0400)] 
*: Fix patch email address

ChangeLog:
* config-ml.in: Update patch email address.
* symlink-tree: Ditto.

3 weeks ago[RISC-V] Improve subword atomic patterns in sync.md
Austin Law [Sat, 11 Oct 2025 03:32:14 +0000 (21:32 -0600)] 
[RISC-V] Improve subword atomic patterns in sync.md

This is Austin's work to further clean up and improve sync.md.

While fixing the PR from a couple months back we noticed that many of the
patterns had operand predicates/constraints that were tighter than they needed
to be.  For example, the subword atomics have mask and not_mask operands that
are used in AND/OR instructions.  Those can legitimately accept a simm12 value.

So this patch adjust several patterns where we identified operands that could
be relaxed a little to improve the generated code in those cases.

This has been tested in my tester for riscv32-elf and riscv64-elf.  It has also
bootstrapped and regression tested on the Pioneer and BPI.

Planning to push to the trunk later after verification of pre-commit CI.

* config/riscv/sync.md (lrsc_atomic_fetch_<atomic_optab><mode>):
Adjust operand predicate/constraint to allow simm12 operands
where valid.  Adjust output template accordingly.
(subword_atomic_fech_strong_<atomic_optab>): Likewise.
(subword_atomic_fetch_strong_nand): Likewise.
(subword_atomic_exchange_strong): Likewise.
(subword_atomic_cas_strong): Likewise.

3 weeks agoDaily bump.
GCC Administrator [Sat, 11 Oct 2025 00:21:09 +0000 (00:21 +0000)] 
Daily bump.

3 weeks agolibstdc++: Fix warnings from std::make_unsigned<_Atomic_word> [PR122172]
Jonathan Wakely [Mon, 6 Oct 2025 14:51:28 +0000 (15:51 +0100)] 
libstdc++: Fix warnings from std::make_unsigned<_Atomic_word> [PR122172]

GCC gives a -Wignored-attributes warning when a class template is
instantiated with a type that has an aligned(n) attribute. Specifically,
cris-elf uses 'typedef int __attribute_((__aligned(4))) _Atomic_word;'
and so compiling libstdc++ headers gives:
warning: ignoring attributes on template argument ‘int’ [-Wignored-attributes]

This commit reduces four occurrences of make_unsigned<_Atomic_word> into
two, one in bits/shared_ptr_base.h and one in ext/atomicity.h, and uses
diagnostic pragmas around the two remaining uses to avoid the warnings.
Because the unsigned type might have lost the alignment of _Atomic_word
that is needed for atomic ops (at least on cris-elf), the unsigned type
should only be used for plain non-atomic arithmetic. To prevent misuse,
it's defined as a private type in _Sp_counted_base, and is defined and
then undefined as a macro in ext/atomicity.h, so that it's not usable
after __exchange_and_add_single and __atomic_add_single have been
defined.

We also get a warning from instantiating __int_traits<_Atomic_word> in
shared_ptr_base.h which can be avoided by calculating the maximum signed
value from the maximum unsigned value.

libstdc++-v3/ChangeLog:

PR libstdc++/122172
* include/bits/shared_ptr_base.h (_Sp_counted_base): Define
_Unsigned_count_type for make_unsigned<_Atomic_word>.
Replace __int_traits<_Atomic_word> with equivalent expression.
* include/ext/atomicity.h (_GLIBCXX_UNSIGNED_ATOMIC_WORD):
Define macro for unsigned type to use for arithmetic.
(__exchange_and_add_single, __atomic_add_single): Use it.

Reviewed-by: Hans-Peter Nilsson <hp@axis.com>
3 weeks agoFortran: improve checking of procedures passed as actual argument [PR50377]
Harald Anlauf [Fri, 10 Oct 2025 20:02:51 +0000 (22:02 +0200)] 
Fortran: improve checking of procedures passed as actual argument [PR50377]

Procedures passed as actual argument require either an explicit interface
or must be declared EXTERNAL.  Add a check and generate an error (default)
or a warning when -std=legacy is specified.

PR fortran/50377

gcc/fortran/ChangeLog:

* resolve.cc (resolve_actual_arglist): Check procedure actual
arguments.

gcc/testsuite/ChangeLog:

* gfortran.dg/pr41011.f: Fix invalid testcase.
* gfortran.dg/actual_procedure_2.f: New test.

3 weeks agobpf: fix cbranch miscompilation in CPUv1 [PR122141]
David Faust [Fri, 10 Oct 2025 17:35:07 +0000 (10:35 -0700)] 
bpf: fix cbranch miscompilation in CPUv1 [PR122141]

As diagnosed by Andrew in the linked PR, when reversing the branch
condition to work around lack of some cbranch instructions, we must
use swap_condition rather than reverse_condition.

PR target/122141

gcc/

* config/bpf/bpf.cc (bpf_expand_cbranch): Use swap_condition
rather than reverse_condition when reversing jump condition to
work around missing instructions in very old BPF ISAs.

gcc/testsuite/

* gcc.target/bpf/pr122141-1.c: New.
* gcc.target/bpf/pr122141-2.c: New.

Suggested-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
3 weeks agocobol: Convert to individual variable character-set encoding.
Robert Dubner [Fri, 10 Oct 2025 15:35:44 +0000 (11:35 -0400)] 
cobol: Convert to individual variable character-set encoding.

Prior to this "patch", the GCOBOL compiler was capable of producing binaries
that operated internally in either ASCII or EBCDIC.  The COBOL specification,
however, allows for the concurrent presence of two encodings, known as
"alphanumeric" and "national".

In order to support this capability, we have chosen to establish an "encoding"
characteristic that gets carried along with every variable,

This change affected many parts of the COBOL front end compiler.  If anybody
looks at any of the changes listed below, they will find they fall into two
classes:

1) Removing the dependence on a global ASCII vs EBCDIC determination.

2) Adding a dependence on a new ::encoding characteristic of the compile time
and run time cbl_field_t and cblc_field_t variable structures.  Those
structures now contain the cbl_encoding_t ::encoding members, which drive the
use of the iconv(3) function in moving back and forth between variable
encodings.

Although the effort is not complete, these changes represent the bulk of what
needs to be done.  With these changes in place, all of our current ASCII and
EBCDIC tests run properly.

gcc/cobol/ChangeLog:

* cdf.y: In support of the described changes.
* gcobol.1: Likewise.
* genapi.cc (level_88_helper): Likewise.
(get_level_88_domain): Likewise.
(get_class_condition_string): Likewise.
(initialize_variable_internal): Likewise.
(gg_default_qualification): Likewise.
(cobol_compare): Likewise.
(move_tree): Likewise.
(move_tree_to_field): Likewise.
(psa_FldBlob): Likewise.
(parser_accept_date_yymmdd): Likewise.
(parser_accept_date_yyyymmdd): Likewise.
(parser_accept_date_yyddd): Likewise.
(parser_accept_date_yyyyddd): Likewise.
(parser_accept_date_dow): Likewise.
(parser_accept_date_hhmmssff): Likewise.
(parser_alphabet): Likewise.
(parser_alphabet_use): Likewise.
(parser_display_internal): Likewise.
(parser_display): Likewise.
(is_valuable): Likewise.
(parser_division): Likewise.
(parser_relop_long): Likewise.
(parser_setop): Likewise.
(parser_set_conditional88): Likewise.
(parser_file_add): Likewise.
(parser_file_open): Likewise.
(create_and_call): Likewise.
(parser_call): Likewise.
(mh_identical): Likewise.
(mh_source_is_literalN): Likewise.
(picky_memcpy): Likewise.
(mh_numeric_display): Likewise.
(mh_source_is_group): Likewise.
(mh_source_is_literalA): Likewise.
(move_helper): Likewise.
(initial_from_initial): Likewise.
(actually_create_the_static_field): Likewise.
(psa_FldLiteralA): Likewise.
(parser_symbol_add): Likewise.
* genmath.cc (arithmetic_operation): Likewise.
* genutil.cc (get_binary_value): Likewise.
(get_literal_string): Likewise.
* genutil.h (EBCDIC_MINUS): Likewise.
(EBCDIC_PLUS): Likewise.
(EBCDIC_ZERO): Likewise.
(EBCDIC_NINE): Likewise.
* parse.y: Likewise.
* parse_ante.h (name_of): Likewise.
(class prog_descr_t): Likewise.
(current_encoding): Likewise.
(needs_picture): Likewise.
(is_callable): Likewise.
(field_attr_str): Likewise.
(value_encoding_check): Likewise.
(field_alloc): Likewise.
(file_add): Likewise.
* scan.l: Likewise.
* structs.cc (create_cblc_field_t): Likewise.
* symbols.cc (elementize): Likewise.
(cbl_field_attr_str): Likewise.
(is_variable_length): Likewise.
(field_str): Likewise.
(extend_66_capacity): Likewise.
(assert): Likewise.
(symbols_update): Likewise.
(symbol_field_parent_set): Likewise.
(add_token): Likewise.
(symbol_table_init): Likewise.
(symbol_field_add): Likewise.
(symbol_field_forward_add): Likewise.
(symbol_field_same_as): Likewise.
(cbl_alphabet_t::reencode): Likewise.
(new_temporary_impl): Likewise.
(parser_symbol_add2): Likewise.
(new_literal_add): Likewise.
(temporaries_t::literal): Likewise.
(new_literal): Likewise.
(standard_internal): Likewise.
(new_temporary): Likewise.
(cbl_field_t::holds_ascii): Likewise.
(cbl_field_t::is_ascii): Likewise.
(cbl_field_t::internalize): Likewise.
(symbol_label_add): Likewise.
(symbol_label_section_exists): Likewise.
(cbl_occurs_t::subscript_ok): Likewise.
(cbl_file_t::deforward): Likewise.
(has_value): Likewise.
* symbols.h (is_numeric): Likewise.
(__gg__encoding_iconv_name): Likewise.
(current_encoding): Likewise.
(struct cbl_field_t): Likewise.
(new_literal): Likewise.
(class temporaries_t): Likewise.
(struct function_descr_t): Likewise.
(hex_decode): Likewise.
(struct cbl_alphabet_t): Likewise.
(struct cbl_file_t): Likewise.
* symfind.cc (field_structure): Likewise.
(erase_symbol_map_fwds): Likewise.
(symbol_find): Likewise.
* token_names.h: Likewise.
* util.cc (cbl_field_type_str): Likewise.
(is_elementary): Likewise.
(symbol_field_type_update): Likewise.
(cbl_field_t::report_invalid_initial_value): Likewise.
(valid_move): Likewise.
(valid_picture): Likewise.
(type_capacity): Likewise.
(gcc_location_set_impl): Likewise.
(cbl_unimplementedw): Likewise.

libgcobol/ChangeLog:

* charmaps.cc (raw_is_SBC): Likewise.
(extract_next_code_point): Likewise.
(flipper): Likewise.
(__gg__ascii_to_ascii_chr): Likewise.
(__gg__ascii_to_ebcdic_chr): Likewise.
(__gg__raw_to_ascii): Likewise.
(__gg__raw_to_ebcdic): Likewise.
(convert_cp1252_to_utf8): Likewise.
(__gg__text_conversion_override): Likewise.
(__gg__ascii_to_ascii): Likewise.
(__gg__encoding_iconv_name): Likewise.
(__gg__encoding_iconv_type): Likewise.
(__gg__ascii_to_ebcdic): Likewise.
(__gg__iconverter): Likewise.
(__gg__ebcdic_to_ascii): Likewise.
(__gg__ascii_to_console): Likewise.
(__gg__ebcdic_to_console): Likewise.
(__gg__console_to_ascii): Likewise.
(__gg__console_to_ebcdic): Likewise.
(_to_ctype): Likewise.
(_from_ctype): Likewise.
(__gg__get_charmap): Likewise.
* charmaps.h (internal_is_ebcdic): Likewise.
(internal_space): Likewise.
(internal_zero): Likewise.
(internal_period): Likewise.
(internal_comma): Likewise.
(internal_dquote): Likewise.
(internal_asterisk): Likewise.
(internal_plus): Likewise.
(internal_minus): Likewise.
(internal_cr): Likewise.
(internal_ff): Likewise.
(internal_newline): Likewise.
(internal_return): Likewise.
(internal_0): Likewise.
(internal_1): Likewise.
(internal_2): Likewise.
(internal_3): Likewise.
(internal_4): Likewise.
(internal_5): Likewise.
(internal_6): Likewise.
(internal_7): Likewise.
(internal_8): Likewise.
(internal_9): Likewise.
(internal_colon): Likewise.
(internal_query): Likewise.
(internal_A): Likewise.
(internal_B): Likewise.
(internal_C): Likewise.
(internal_D): Likewise.
(internal_E): Likewise.
(internal_F): Likewise.
(internal_G): Likewise.
(internal_H): Likewise.
(internal_I): Likewise.
(internal_J): Likewise.
(internal_K): Likewise.
(internal_L): Likewise.
(internal_M): Likewise.
(internal_N): Likewise.
(internal_O): Likewise.
(internal_P): Likewise.
(internal_Q): Likewise.
(internal_R): Likewise.
(internal_S): Likewise.
(internal_T): Likewise.
(internal_U): Likewise.
(internal_V): Likewise.
(internal_W): Likewise.
(internal_X): Likewise.
(internal_Y): Likewise.
(internal_Z): Likewise.
(internal_a): Likewise.
(internal_b): Likewise.
(internal_c): Likewise.
(internal_d): Likewise.
(internal_e): Likewise.
(internal_f): Likewise.
(internal_g): Likewise.
(internal_h): Likewise.
(internal_i): Likewise.
(internal_j): Likewise.
(internal_k): Likewise.
(internal_l): Likewise.
(internal_m): Likewise.
(internal_n): Likewise.
(internal_o): Likewise.
(internal_p): Likewise.
(internal_q): Likewise.
(internal_r): Likewise.
(internal_s): Likewise.
(internal_t): Likewise.
(internal_u): Likewise.
(internal_v): Likewise.
(internal_w): Likewise.
(internal_x): Likewise.
(internal_y): Likewise.
(internal_z): Likewise.
(enum text_codeset_t): Likewise.
(__gg__ascii_to_ascii_chr): Likewise.
(__gg__ascii_to_ebcdic_chr): Likewise.
(ascii_to_internal): Likewise.
(__gg__ascii_to_ascii): Likewise.
(__gg__ascii_to_ebcdic): Likewise.
(ascii_to_internal_str): Likewise.
(__gg__raw_to_ascii): Likewise.
(__gg__raw_to_ebcdic): Likewise.
(raw_to_internal): Likewise.
(__gg__ascii_to_console): Likewise.
(__gg__ebcdic_to_console): Likewise.
(internal_to_console): Likewise.
(__gg__console_to_ascii): Likewise.
(__gg__console_to_ebcdic): Likewise.
(console_to_internal): Likewise.
(__gg__ebcdic_to_ascii): Likewise.
(internal_to_ascii): Likewise.
(__gg__encoding_iconv_name): Likewise.
(__gg__encoding_iconv_type): Likewise.
(__gg__iconverter): Likewise.
(DEFAULT_CHARMAP_SOURCE): Likewise.
(class charmap_t): Likewise.
(__gg__get_charmap): Likewise.
* common-defs.h (EBCDIC_MINUS): Likewise.
(EBCDIC_PLUS): Likewise.
(EBCDIC_ZERO): Likewise.
(EBCDIC_NINE): Likewise.
(PACKED_NYBBLE_PLUS): Likewise.
(PACKED_NYBBLE_MINUS): Likewise.
(PACKED_NYBBLE_UNSIGNED): Likewise.
(NUMERIC_DISPLAY_SIGN_BIT_EBCDIC): Likewise.
(NUMERIC_DISPLAY_SIGN_BIT): Likewise.
(SEPARATE_PLUS): Likewise.
(SEPARATE_MINUS): Likewise.
(ZONED_ZERO): Likewise.
(ZONE_SIGNED_EBCDIC): Likewise.
(enum cbl_field_type_t): Likewise.
(enum cbl_field_attr_t): Likewise.
(enum cbl_figconst_t): Likewise.
(enum cbl_encoding_t): Likewise.
* constants.cc (struct cblc_field_t): Likewise.
(X): Likewise.
(S9): Likewise.
* gcobolio.h: Likewise.
* gfileio.cc (get_filename): Likewise.
(relative_file_delete): Likewise.
(relative_file_start): Likewise.
(relative_file_rewrite): Likewise.
(relative_file_write_varying): Likewise.
(relative_file_write): Likewise.
(sequential_file_write): Likewise.
(line_sequential_file_read): Likewise.
(sequential_file_read): Likewise.
(relative_file_read): Likewise.
(file_indexed_open): Likewise.
(__gg__file_reopen): Likewise.
(__io__file_open): Likewise.
(__io__file_close): Likewise.
(__gg__file_open): Likewise.
* intrinsic.cc (trim_trailing_spaces): Likewise.
(is_zulu_format): Likewise.
(string_to_dest): Likewise.
(get_all_time): Likewise.
(ftime_replace): Likewise.
(__gg__char): Likewise.
(__gg__current_date): Likewise.
(__gg__seconds_past_midnight): Likewise.
(__gg__formatted_current_date): Likewise.
(__gg__formatted_date): Likewise.
(__gg__formatted_datetime): Likewise.
(__gg__formatted_time): Likewise.
(__gg__lower_case): Likewise.
(numval): Likewise.
(numval_c): Likewise.
(__gg__ord): Likewise.
(__gg__trim): Likewise.
(__gg__random): Likewise.
(__gg__random_next): Likewise.
(__gg__reverse): Likewise.
(__gg__upper_case): Likewise.
(__gg__when_compiled): Likewise.
(gets_int): Likewise.
(gets_year): Likewise.
(gets_month): Likewise.
(gets_day): Likewise.
(gets_day_of_week): Likewise.
(gets_day_of_year): Likewise.
(gets_week): Likewise.
(gets_hours): Likewise.
(gets_minutes): Likewise.
(gets_seconds): Likewise.
(gets_nanoseconds): Likewise.
(fill_cobol_tm): Likewise.
(__gg__hex_of): Likewise.
(floating_format_tester): Likewise.
(__gg__numval_f): Likewise.
(__gg__test_numval_f): Likewise.
(strcasestr): Likewise.
(strlaststr): Likewise.
(__gg__locale_compare): Likewise.
(__gg__locale_date): Likewise.
(__gg__locale_time): Likewise.
(__gg__locale_time_from_seconds): Likewise.
* libgcobol.cc (struct program_state): Likewise.
(turn_sign_bit_on): Likewise.
(turn_sign_bit_off): Likewise.
(is_sign_bit_on): Likewise.
(__gg__string_to_alpha_edited_ascii): Likewise.
(int128_to_field): Likewise.
(edited_to_binary): Likewise.
(get_binary_value_local): Likewise.
(__gg__get_date_yymmdd): Likewise.
(__gg__get_date_yyyymmdd): Likewise.
(__gg__get_date_yyddd): Likewise.
(__gg__get_yyyyddd): Likewise.
(__gg__get_date_dow): Likewise.
(__gg__get_date_hhmmssff): Likewise.
(__gg__dirty_to_binary_internal): Likewise.
(__gg__dirty_to_binary): Likewise.
(__gg__dirty_to_float): Likewise.
(psz_to_internal): Likewise.
(get_scaled_rdigits): Likewise.
(format_for_display_internal): Likewise.
(format_for_display_local): Likewise.
(compare_88): Likewise.
(compare_field_class): Likewise.
(compare_strings): Likewise.
(__gg__compare_2): Likewise.
(init_var_both): Likewise.
(alpha_to_alpha_move_from_location): Likewise.
(alpha_to_alpha_move): Likewise.
(__gg__move): Likewise.
(__gg__move_literala): Likewise.
(normalize_id): Likewise.
(inspect_backward_format_1): Likewise.
(__gg__inspect_format_1): Likewise.
(inspect_backward_format_2): Likewise.
(__gg__inspect_format_2): Likewise.
(normalize_for_inspect_format_4): Likewise.
(__gg__inspect_format_4): Likewise.
(move_string): Likewise.
(brute_force_trim): Likewise.
(__gg__string): Likewise.
(display_both): Likewise.
(__gg__display_string): Likewise.
(not_mangled_core): Likewise.
(__gg__accept): Likewise.
(__gg__set_initial_switch_value): Likewise.
(__gg__onetime_initialization): Likewise.
(is_numeric_display_numeric): Likewise.
(is_alpha_a_number): Likewise.
(__gg__classify): Likewise.
(__gg__convert_encoding): Likewise.
(__gg__convert_encoding_length): Likewise.
(accept_envar): Likewise.
(__gg__accept_envar): Likewise.
(__gg__set_envar): Likewise.
(__gg__get_argc): Likewise.
(__gg__get_argv): Likewise.
(__gg__get_command_line): Likewise.
(__gg__alphabet_use): Likewise.
(__gg__ascii_to_internal_field): Likewise.
(__gg__ascii_to_internal): Likewise.
(__gg__console_to_internal): Likewise.
(__gg__parser_set_conditional): Likewise.
(__gg__internal_to_console_in_place): Likewise.
(__gg__literaln_alpha_compare): Likewise.
(__gg__unstring): Likewise.
(struct cbl_exception_t): Likewise.
(__gg__codeset_figurative_constants): Likewise.
(__gg__function_handle_from_cobpath): Likewise.
(__gg__just_mangle_name): Likewise.
(__gg__function_handle_from_name): Likewise.
(get_the_byte): Likewise.
(__gg__set_env_name): Likewise.
(__gg__get_env_name): Likewise.
(__gg__get_env_value): Likewise.
(__gg__set_env_value): Likewise.
(__gg__fprintf_stderr): Likewise.
(__gg__accept_arg_value): Likewise.
(__gg__fc_char): Likewise.
* libgcobol.h (__gg__dirty_to_binary_internal): Likewise.
(__gg__dirty_to_binary): Likewise.
(__gg__internal_to_console_in_place): Likewise.
(__gg__fc_char): Likewise.
(__gg__convert_encoding): Likewise.
(__gg__convert_encoding_length): Likewise.
* stringbin.cc (string_from_combined): Likewise.
(__gg__binary_to_string_internal): Likewise.
(__gg__binary_to_string_encoded): Likewise.
(__gg__numeric_display_to_binary): Likewise.
(__gg__packed_to_binary): Likewise.
* stringbin.h (__gg__binary_to_string_internal): Likewise.
(__gg__binary_to_string_encoded): Likewise.
(__gg__numeric_display_to_binary): Likewise.
* valconv.cc (__gg__alphabet_create): Likewise.
(__gg__string_to_numeric_edited): Likewise.
(__gg__string_to_alpha_edited): Likewise.
(__gg__remove_trailing_zeroes): Likewise.
* valconv.h (__VALCONV_H): Likewise.
* encodings.h: New file.

gcc/testsuite/ChangeLog:

* cobol.dg/group1/check_88.cob: Likewise.

3 weeks agoforwprop: Add a simple DSE after a clobber
Andrew Pinski [Thu, 11 Sep 2025 05:05:26 +0000 (22:05 -0700)] 
forwprop: Add a simple DSE after a clobber

After copy propagation for aggregates patches we might end up with
now:
```
tmp = a;
b = a; // was b = tmp;
tmp = {CLOBBER};
```
To help out ESRA, it would be a good idea to remove the `tmp = a` statement as
there is no DSE between frowprop and ESRA. copy-prop-aggregate-sra-1.c is an example
where the removal of the copy helps ESRA.

This adds a simple DSE which is only designed to remove the `tmp = a` statement.
This shows up a few times in many C++ code including the code from the javascript
interpreter in ladybird, and in the "fake" testcase in PR 108653 and in the aarch64
specific PR 89967.

This is disabled for -Og as we don't do dse there either.
intent_optimize_10.f90 testcase needed to be updated as the constant
shows up in a debug statement now.

Changes since v1:
* v2: Add much more comments in the code instead of just relying on the commit message.
      Count the maybe_use towards the aliasing lookup limit (increase the non-full walk limit to 4
to account for that).
      Use direct comparison instead of operand_equal_p since we are comparing against a DECL.

Bootstrapped and tested on x86_64-linux-gnu.

gcc/ChangeLog:

* tree-ssa-forwprop.cc (do_simple_agr_dse): New function.
(pass_forwprop::execute): Call do_simple_agr_dse for clobbers.

gcc/testsuite/ChangeLog:

* gfortran.dg/intent_optimize_10.f90: Update so -g won't fail.
* gcc.dg/tree-ssa/copy-prop-aggregate-sra-1.c: New testcase.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
3 weeks agoc++: base-specifier name lookup is type-only [PR122192]
Patrick Palka [Fri, 10 Oct 2025 14:25:25 +0000 (10:25 -0400)] 
c++: base-specifier name lookup is type-only [PR122192]

The r13-6098 change to make TYPENAME_TYPE no longer always ignore
non-type bindings needs another exception: base-specifiers that are
represented as TYPENAME_TYPE, for which lookup must be type-only (by
[class.derived.general]/2).  This patch fixes this by giving such
TYPENAME_TYPEs a tag type of class_type rather than typename_type so
that we treat them like elaborated-type-specifiers (another type-only
lookup situation).

PR c++/122192

gcc/cp/ChangeLog:

* decl.cc (make_typename_type): Document base-specifier as
another type-only lookup case.
* parser.cc (cp_parser_class_name): Propagate tag_type to
make_typename_type instead of hardcoding typename_type.
(cp_parser_base_specifier): Pass class_type instead of
typename_type as tag_type to cp_parser_class_name.

gcc/testsuite/ChangeLog:

* g++.dg/template/dependent-base6.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
3 weeks agox86: Fixes for AMD znver5 enablement
Umesh Kalvakuntla [Wed, 8 Oct 2025 16:50:37 +0000 (18:50 +0200)] 
x86: Fixes for AMD znver5 enablement

This patch fixes cpu family model numbers for znver5 and uses the
correct cpuid bit for prefetchi which is different from Intel
(https://docs.amd.com/v/u/en-US/24594_3.37).

2025-09-29  Umesh Kalvakuntla <Umesh.Kalvakuntla@amd.com>

* common/config/i386/cpuinfo.h (get_amd_cpu): Fix znver5 family
model numbers.
(get_available_features): Set FEATURE_PREFETCHI for bit_AMD_PREFETCHI.
* config/i386/cpuid.h (bit_AMD_PREFETCHI): New Macro.

3 weeks agoRISC-V: Add test for vec_duplicate + vwsubu.wv combine with GR2VR cost 0, 1 and 15
Pan Li [Wed, 8 Oct 2025 14:15:56 +0000 (22:15 +0800)] 
RISC-V: Add test for vec_duplicate + vwsubu.wv combine with GR2VR cost 0, 1 and 15

Add asm dump check and run test for vec_duplicate + vwsubu.wv
combine to vwsubu.wx, with the GR2VR cost is 0, 2 and 15.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/vx_vf/vx-1-u16.c: Add asm check
for vwsubu.wx.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-1-u32.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-1-u64.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-2-u16.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-2-u32.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-2-u64.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-3-u16.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-3-u32.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-3-u64.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx_widen.h: Add test helper
macros.
* gcc.target/riscv/rvv/autovec/vx_vf/vx_widen_data.h: Add test
data for run test.
* gcc.target/riscv/rvv/autovec/vx_vf/wx_vwsubu-run-1-u64.c: New test.

Signed-off-by: Pan Li <pan2.li@intel.com>
3 weeks agoRISC-V: Combine vec_duplicate + vwsubu.wv to vwsubu.wx on GR2VR cost
Pan Li [Wed, 8 Oct 2025 14:12:38 +0000 (22:12 +0800)] 
RISC-V: Combine vec_duplicate + vwsubu.wv to vwsubu.wx on GR2VR cost

This patch would like to combine the vec_duplicate + vwsubu.wv to the
vwsubu.wx.  From example as below code.  The related pattern will depend
on the cost of vec_duplicate from GR2VR.  Then the late-combine will
take action if the cost of GR2VR is zero, and reject the combination
if the GR2VR cost is greater than zero.

Assume we have asm code like below, GR2VR cost is 0.

Before this patch:
  11       beq a3,zero,.L8
  12       vsetvli a5,zero,e32,m1,ta,ma
  13       vmv.v.x v2,a2
  ...
  16   .L3:
  17       vsetvli a5,a3,e32,m1,ta,ma
  ...
  22       vwsubu.wv v1,v2,v3
  ...
  25       bne a3,zero,.L3

After this patch:
  11       beq a3,zero,.L8
  ...
  14    .L3:
  15       vsetvli a5,a3,e32,m1,ta,ma
  ...
  20       vwsubu.wx v1,a2,v3
  ...
  23       bne a3,zero,.L3

Unfortunately, and similar as vwaddu.vv, only widening from uint32_t to
uint64_t has the necessary zero-extend during combine, we loss the
extend op after expand for any other types.

gcc/ChangeLog:

* config/riscv/autovec-opt.md (*widen_wsubu_wx_<mode>): Add new
pattern to match vwsubu.wx.

Signed-off-by: Pan Li <pan2.li@intel.com>
3 weeks agos390x: Fix fmin/fmax patterns
Juergen Christ [Mon, 15 Sep 2025 10:13:22 +0000 (12:13 +0200)] 
s390x: Fix fmin/fmax patterns

s390x floating point minimum and maximum functions unfortunately do
not canonicalize NaNs.  Hence, test pr105414.c fails since
c476f554e3f.  Fix this by only allowing fmin/fmax pattern if signaling
NaNs are disabled.

gcc/ChangeLog:

* config/s390/vector.md (fmax<mode>3): Restrict to no trapping
math.
(fmin<mode>3): Ditto.

gcc/testsuite/ChangeLog:

* gcc.target/s390/fminmax-1.c: Disable for signaling NaNs.
* gcc.target/s390/fminmax-2.c: Ditto.
* gcc.target/s390/vector/reduc-minmax-1.c: Ditto.

Signed-off-by: Juergen Christ <jchrist@linux.ibm.com>
3 weeks agotestsuite: Fix vector-subscript-4.c [PR116421]
Stefan Schulze Frielinghaus [Fri, 10 Oct 2025 13:02:09 +0000 (15:02 +0200)] 
testsuite: Fix vector-subscript-4.c [PR116421]

Verify we don't have any vector temporaries in the IL at least until
ISEL which may introduce VEC_EXTRACTs on targets which support
non-constant indices (see PR116421).

As a pass I chose NRV for no particular reason except that it is
literally the last pass prior ISEL.  At least at time of writing this.

gcc/testsuite/ChangeLog:
PR testsuite/116421
* c-c++-common/vector-subscript-4.c: Check for vectors prior
ISEL.

3 weeks agors6000: Add CCFP and CCEQ to CCANY
Segher Boessenkool [Fri, 10 Oct 2025 12:08:45 +0000 (12:08 +0000)] 
rs6000: Add CCFP and CCEQ to CCANY

This allows those modes to be used in more setbc and similar
constructions.

2025-10-10  Segher Boessenkool  <segher@kernel.crashing.org>

* config/rs6000/rs6000.md (mode_iterator CCANY): Add CCFP and CCEQ.

3 weeks agolibstdc++: Remove misleading TODO comments to add parsing tests.
Tomasz Kamiński [Fri, 10 Oct 2025 12:03:11 +0000 (14:03 +0200)] 
libstdc++: Remove misleading TODO comments to add parsing tests.

Standard does not define form_stream overloads for these types,
so there is nothing to tests.

libstdc++-v3/ChangeLog:

* testsuite/std/time/month_day_last/io.cc: Remove TODO comments
for test_parse().
* testsuite/std/time/month_weekday/io.cc: Likewise.
* testsuite/std/time/month_weekday_last/io.cc: Likewise.
* testsuite/std/time/weekday_indexed/io.cc: Likewise.
* testsuite/std/time/weekday_last/io.cc: Likewise.
* testsuite/std/time/year_month_day_last/io.cc: Likewise.
* testsuite/std/time/year_month_weekday/io.cc: Likewise.
* testsuite/std/time/year_month_weekday_last/io.cc: Likewise.

3 weeks agotestsuite: Adjust vect-reduc-chain-1.c for SLP permute transform
Christophe Lyon [Fri, 10 Oct 2025 11:26:38 +0000 (11:26 +0000)] 
testsuite: Adjust vect-reduc-chain-1.c for SLP permute transform

Since r16-3847-g21d1bb1922f (Integrate SLP permute transform into
vect_transform_stmt), vect-reduc-chain-1.c was failing on aarch64
because the dump message changed.

Apply the same change as r16-3847-g21d1bb1922f applied to
vect-reduc-chain-2.c and vect-reduc-chain-3.c

gcc/testsuite/ChangeLog:

* gcc.dg/vect/vect-reduc-chain-1.c: Adjust expected
dump.

3 weeks agoarm: [MVE] Fix operands order in vbicq_f [PR122223]
Christophe Lyon [Thu, 9 Oct 2025 14:09:26 +0000 (14:09 +0000)] 
arm: [MVE] Fix operands order in vbicq_f [PR122223]

The operands of the floating-point version of vbicq were swapped, this
patch fixes this.

gcc/ChangeLog:
PR target/122223
* config/arm/mve.md (@mve_vbicq_f<mode>): Fix operands order.

gcc/testsuite/ChangeLog:
PR target/122223
* gcc.target/arm/mve/intrinsics/pr122223.c: New test.

3 weeks agovect: Fix out-of-date VEC_STMT comments
Andrew Stubbs [Thu, 9 Oct 2025 12:52:29 +0000 (12:52 +0000)] 
vect: Fix out-of-date VEC_STMT comments

The vec_stmt parameter was removed from these functions by Richi in July
(commit 5865c0b81, some were removed earlier), but the comments still talked
about it.

gcc/ChangeLog:

* tree-vect-stmts.cc: Fix VEC_STMT parameter comments throughout.

3 weeks agoaarch64, Darwin: Improve Apple M3 cores, add M4
Francois-Xavier Coudert [Thu, 9 Oct 2025 08:11:38 +0000 (10:11 +0200)] 
aarch64, Darwin: Improve Apple M3 cores, add M4

Complete the list of M3 cores (Ibiza, Palma and Lobos) and add the M4
cores (Donan and two types of Brava).

The values for chip IDs and the LITTLE.big variants have been taken from
lists in the XNU sources (xnu/osfmk/arm/cpuid.h) in xnu-11417.101.15.

gcc/ChangeLog:

* config/aarch64/aarch64-cores.def (AARCH64_CORE): Improve Apple
M3 and add Apple M4 cores.
* config/aarch64/aarch64-tune.md: Regenerate.
* doc/invoke.texi: Add apple-m4 core to the ones listed
for arch and tune selections.

3 weeks agoUse gimple_build to perform conversion simplification
Richard Biener [Fri, 10 Oct 2025 08:05:46 +0000 (10:05 +0200)] 
Use gimple_build to perform conversion simplification

The following uses gimple_build to do the conversion simplification
in build_and_insert_cast instead of duplicating it there.  Conveniently
when building directly into the IL all stmts are taken into account
for the simplification.

PR tree-optimization/122111
* tree-ssa-math-opts.cc (build_and_insert_cast): Remove
conversion simplification, instead use gimple_convert.

* gcc.target/arm/pr122111.c: New test.

3 weeks agoarm: Fix support_vector_misalignment.
Robin Dapp [Thu, 9 Oct 2025 20:47:26 +0000 (22:47 +0200)] 
arm: Fix support_vector_misalignment.

In gcc-16-4314-g5e9eecc6686 I meant to remove all uses of TYPE
in support_vector_misalignment but apparently forgot this one.
Fixing by using the inner mode's size.

gcc/ChangeLog:

* config/arm/arm.cc (arm_builtin_support_vector_misalignment):
Remove use of type.

3 weeks agolibgomp: Add is_integrated_apu function to plugin/plugin-{gcn,nvptx}.c
Tobias Burnus [Fri, 10 Oct 2025 07:48:37 +0000 (09:48 +0200)] 
libgomp: Add is_integrated_apu function to plugin/plugin-{gcn,nvptx}.c

The added function is currently '#if 0' but is planned to be used to enable
self mapping automatically. Prerequisite for auto self maps is still mapping
'declare target' variables (if any, in libgomp) or converting all
'declare target' variables to 'declare target link' in the compiler
(as required for 'omp requires self_maps').

include/ChangeLog:

* hsa_ext_amd.h (enum hsa_amd_agent_info_s): Add
HSA_AMD_AGENT_INFO_MEMORY_PROPERTIES.
(enum): Add HSA_AMD_MEMORY_PROPERTY_AGENT_IS_APU.

libgomp/ChangeLog:

* plugin/plugin-gcn.c (is_integrated_apu): New; currently '#if 0'.
* plugin/plugin-nvptx.c (is_integrated_apu): Likewise.

3 weeks agotree-optimization/122225 - fix return stmt verification
Richard Biener [Fri, 10 Oct 2025 06:20:22 +0000 (08:20 +0200)] 
tree-optimization/122225 - fix return stmt verification

The following fixes return stmt type verification by properly looking
at DECL_RESULT to decide whether that's by reference, not trying to
figure that from the actual argument.

PR tree-optimization/122225
* tree-cfg.cc (verify_gimple_return): Look at DECL_RESULT
for DECL_BY_REFERENCE.

3 weeks agolibstdc++: Adjust enable_nonlocking_formatter_optimization specializations [PR121790]
Tomasz Kamiński [Fri, 3 Oct 2025 07:01:21 +0000 (09:01 +0200)] 
libstdc++: Adjust enable_nonlocking_formatter_optimization specializations [PR121790]

This patch addresses several issues related to the additional specializations
for enable_nonlocking_formatter_optimization fomr P3235R3 proposal:

* LWG4399 [1]: Apply remove_cvref_t to tuple and pair elements when checking if
the direct printing optimization is enabled.
* LWG4398 [2]: Disable the direct printing optimization for the standard library
 container adaptors: queue, priority_queue, and stack.
* LWG4400 [3]: Enable the direct printing optimization only for durations that
 use standard arithmetic types. Conditionally enable it for hh_mm_ss
 and time_points based on their underlying Duration template argument.

[1] https://cplusplus.github.io/LWG/issue4399
[2] https://cplusplus.github.io/LWG/issue4398
[3] https://cplusplus.github.io/LWG/issue4400

PR libstdc++/121790

libstdc++-v3/ChangeLog:

* include/bits/chrono_io.h (enable_nonlocking_formatter_optimization):
Adjust specializations for duration, hh_mm_ss and time_points.
* include/std/format (enable_nonlocking_formatter_optimization):
Apply remove_cvref_t on pair and tuple elements.
* include/std/queue (enable_nonlocking_formatter_optimization):
Change specialization value to false.
* include/std/stack (enable_nonlocking_formatter_optimization):
Change specialization value to false.
* testsuite/std/format/ranges/adaptors.cc: Adjusted tests.
* testsuite/std/format/tuple.cc: Adjusted tests.
* testsuite/std/time/format/nonlocking.cc: Adjusted tests.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
3 weeks agolibstdc++: Implement P3235R3 optimizations for std::print [PR121790]
Tomasz Kamiński [Thu, 2 Oct 2025 14:17:05 +0000 (16:17 +0200)] 
libstdc++: Implement P3235R3 optimizations for std::print [PR121790]

This patch implements additional enable_nonlocking_formatter_optimization
specializations listed in P3235R3.

PR libstdc++/121790

libstdc++-v3/ChangeLog:

* include/bits/chrono_io.h
(enable_nonlocking_formatter_optimization): Define specializations
for chrono types.
* include/bits/version.def (print): Bump.
* include/bits/version.h: Regenerate.
* include/std/format (enable_nonlocking_formatter_optimization):
Define specializations for pair, tuple and ranges.
* include/std/queue (enable_nonlocking_formatter_optimization):
Define specializations for queue and priority_queue.
* include/std/stack (enable_nonlocking_formatter_optimization):
Define specialization for stack.
* include/std/stacktrace (enable_nonlocking_formatter_optimization):
Define specialization for basic_stacktrace and stacktrace_entry.
* include/std/thread (enable_nonlocking_formatter_optimization):
Define specialization for thread::id.
* include/std/vector (enable_nonlocking_formatter_optimization):
Define specialization for vector<bool>::reference.
* testsuite/23_containers/vector/bool/format.cc: Test value of
enable_nonlocking_formatter_optimization.
* testsuite/30_threads/thread/id/output.cc: Likewise.
* testsuite/std/format/ranges/adaptors.cc: Likewise.
* testsuite/std/format/ranges/formatter.cc: Likewise.
* testsuite/std/format/tuple.cc: Likewise.
* testsuite/std/time/format/empty_spec.cc: Extract Rep class
to custom_rep.h.
* testsuite/std/time/format/custom_rep.h: Extracted from
empty_spec.cc.
* testsuite/std/time/format/nonlocking.cc: New test.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
3 weeks agolibstdc++: Implement P3107R5 optimizations for std::print [PR121790]
Jonathan Wakely [Wed, 21 Feb 2024 16:11:53 +0000 (16:11 +0000)] 
libstdc++: Implement P3107R5 optimizations for std::print [PR121790]

The names of the vprint functions follow the convention from P3235R3.

This takes advantage of the additional permission proposed by P3107R5 so
that std::print can write directly to a FILE stream, rather than
formatting to an intermediate std::string temporary and then writing
that to the stream. The change is to write to a new _File_sink type
instead of a _Str_sink that populates a std::string. There are three
implementations of _File_sink.

For non-Glibc targets that support POSIX flockfile and putc_unlocked,
the stream will be locked and then formatted characters will be buffered
on the stack (instead of allocating a std::string) and copied to the
stream when the buffer fills up.

For Glibc, _File_sink will lock the stream but then if the file is
line-buffered or fully buffered, characters will be written directly
into the file's output buffer. This avoids two levels of buffering and
copying the characters from one to the other. For an unbuffered stream
(like stderr) the _File_sink buffer will still be used, to avoid the
overhead of lots of small writes to the stream.  Because this version of
_File_sink accesses the stream's buffer directly it relies on
glibc-specific implementation details that are exposed in public
headers.

A fallback definition of _File_sink just wraps a _Str_sink so is
equivalent to the original code, and is used when flockfile isn't
available.

Both forms of std::println (taking a FILE* and a std::ostream) can be
implemented more efficiently by appending a newline to the format
string, to avoid formatting twice.

PR libstdc++/121790

libstdc++-v3/ChangeLog:

* acinclude.m4 (GLIBCXX_CHECK_STDIO_LOCKING): New macro to check
for std::print dependencies.
* config.h.in: Regenerate.
* configure: Regenerate.
* configure.ac: Use GLIBCXX_CHECK_STDIO_LOCKING.
* include/bits/formatfwd.h (enable_nonlocking_formatter_optimization):
Define new variable template.
* include/bits/version.def (print): Bump value.
* include/bits/version.h: Regenerate.
* include/std/format (enable_nonlocking_formatter_optimization):
Define specializations for variable template.
* include/std/ostream (print) [!_WIN32]: Do not use
vprint_unicode at all.
(println): Append newline to format string instead of formatting
twice.
* include/std/print (_File_sink): New class.
(vprint_nonunicode_locking): New function.
(vprint_unicode_locking): New function reusing previous code
from vprint_unicode.
(vprintf_unicode): Defer to vprint_nonunicode for Windows or to
vprint_unicode_locking otherwise.
(print): [!_WIN32]: Do no use vprint_unicode at all.
Check enable_nonlocking_formatter_optimization and defer to
either vprint_nonunicode_locking or vprint_nonunicode.
(println): Use vprint_unicode or format directly to a _File_sink
instead of formatting twice.
* testsuite/27_io/print/1.cc: Updated and added new tests.
* testsuite/std/format/formatter/nonlocking.cc: New tests.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Co-authored-by: Tomasz Kamiński <tkaminsk@redhat.com>
3 weeks agolibstdc++: Handle cv-qualified types in atomic and atomic_ref [PR115402]
Giuseppe D'Angelo [Mon, 9 Dec 2024 00:32:27 +0000 (01:32 +0100)] 
libstdc++: Handle cv-qualified types in atomic and atomic_ref [PR115402]

Implements P3233R1 (DR for C++20/C++11, fixes LWG 4069 and 3508).

This commit implements std::atomic_ref<cv T> support (LWG3508) as DR for
C++20, by  extractingparts of the __atomic_ref class (that atomic_ref inherits
from) into a further base class (__atomic_ref_base):

* __atomic_ref_base<const T> implements non-mutating (const) atomic API.
  Single base class is used, and the difference in is_always_lock_free and
  required_aligment values between types are handled by _S_is_always_lock_free,
  _S_required_aligment helper functions.
* __atomic_ref_base<T> implements the common atomic APIs. The non-mutating
  operations are handled by inherting from __atomic_ref_base<const T> partial
  partial specialization. Tu support that __atomic_ref_base<const T> stores
  mutable pointer to T, and performs const_cast in constructor.
* __atomic_ref<T, ....> inherits from __atomic_ref_base<T>, and implement
  type-specific mutable APIs (fetch_add, -=, ...) and difference_type member
  type.
* __atomic_ref<const T, ...> inherits from __atomic_ref_base<const T>
  and adds different_type member, whose presence and denoted type depends
  on T.

The __atomic_ref specialization selection is adjusted to handle cv-qualified
bool (add remove_cv_t) and pointer types. To handle the later, additional
constant template parameter is introduced.

The atomic wait and notify operations are currently not supported for volatile
types, to signal that static assert is added to corresponding methods of
atomic_ref.

At the same time,  disable support for cv-qualified types in std::atomic
(for instance, std::atomic<volatile T> isn't meaningful; one should use
volatile std::atomic<T>), again as per the paper, resolving LWG4069 as DR
for C++11. This only affects atomic<volatile T>, as specialization
atomic with const-qualifed types was already producing an compile-time
error.

PR libstdc++/115402

libstdc++-v3/ChangeLog:

* include/bits/atomic_base.h (__atomic_ref_base<const _Tp>)
(__atomic_ref_base<_Tp>): Define by extracting common methods
from atomic_ref specializations.
(__atomic_ref<_Tp, In, Fp, Pt>): Inherit from __atomic_ref_base
and remove extracted method.
(__atomic_ref<const _Tp, In, Fp, Pt>): Define.
* include/std/atomic (std::atomic): Added an
* testsuite/29_atomics/atomic/requirements/types_neg.cc:
Add test for volatile qualified types.
* testsuite/29_atomics/atomic_ref/bool.cc: Move the content
to op_support.cc, add test for bool.
* testsuite/29_atomics/atomic_ref/op_support.cc: New test
expanded from atomic_ref/bool.cc.
* testsuite/29_atomics/atomic_ref/cv_qual.cc: New test.
* testsuite/29_atomics/atomic_ref/requirements_neg.cc: New test.
* testsuite/29_atomics/atomic_ref/deduction.cc: Add tests for
cv-qualified types.
* testsuite/29_atomics/atomic_ref/float.cc: Likewise.
* testsuite/29_atomics/atomic_ref/generic.cc: Likewise.
* testsuite/29_atomics/atomic_ref/integral.cc: Likewise.
* testsuite/29_atomics/atomic_ref/pointer.cc: Likewise.
* testsuite/29_atomics/atomic_ref/requirements.cc: Likewise.
* testsuite/29_atomics/atomic_ref/wait_notify.cc: Add tests for
const qualified types.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Co-authored-by: Tomasz Kamiński <tkaminsk@redhat.com>
Signed-off-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
3 weeks agolibstdc++: Improve handling of !ok() weekday index in formatting [PR121929]
Tomasz Kamiński [Thu, 9 Oct 2025 12:38:54 +0000 (14:38 +0200)] 
libstdc++: Improve handling of !ok() weekday index in formatting [PR121929]

Previously, formatting a year_month_weekday with the weekday index equal to
0, 6, or 7 (which are !ok() values in the supported range) produced a
seemingly correct day output. For example %Y-%m-%d produced:
 * 2024-09-06 for 2024y/September/Sunday[6] (2024-10-06)
 * 2024-09-25 for 2024y/September/Sunday[0] (2023-08-25)

This patch changes how the internal _M_day value is computed for
year_month_weekday. Instead of converting to local_days then to year_month_day,
_M_day is now set as the number of days since ymd.year()/ymd.month()/0. If this
difference is negative (which occurs when index() is 0), _M_day is set to 0 to
avoid handling negative days of the month.

This change yields identical results for all ok() values. However, for !ok() dates,
it now consistently produces invalid dates, ensuring the formatted output clearly
reflects the !ok input state:
 * 2024-09-36 for 2024y/September/Sunday[6]
 * 2024-09-00 for 2024y/September/Sunday[0]

For consistency, _M_day is computed in the same manner for year_month_weekday_last.

Finally, for year_month_day_last, we fill _M_day directly with ymd.day().
This provides a more efficient implementation and avoids the need to compute
local_days for %Y-%m-%d, %F and similar specifiers.

PR libstdc++/121929

libstdc++-v3/ChangeLog:

* include/bits/chrono_io.h (_ChronoData::_M_fill_aux)
(_ChronoData::_M_fill_aux): Add comment documenting precondition.
(formatter<chrono::year_month_day, _CharT>::format): Compute
local_days inline.
(formatter<chrono::year_month_day_last, _CharT>::format)
(formatter<chrono::year_month_weekday, _CharT>::format)
(formatter<chrono::year_month_weekday_last, _CharT>::format):
Change how the _M_day field is computed.
* testsuite/std/time/year_month_weekday/io.cc: Adjust tests.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
3 weeks agoDaily bump.
GCC Administrator [Fri, 10 Oct 2025 00:21:51 +0000 (00:21 +0000)] 
Daily bump.

3 weeks agoRevert "MIPS: Add conditions for use of the -mmips16e2 and -mips16 option."
YunQiang Su [Fri, 10 Oct 2025 00:16:38 +0000 (08:16 +0800)] 
Revert "MIPS: Add conditions for use of the -mmips16e2 and -mips16 option."

This reverts commit f731fa580156d07f6347cb87931ce7b9cf2acbb4.

3 weeks agoRevert "MIPS/testsuite: Use isa_rev=2 instead of >=2"
YunQiang Su [Fri, 10 Oct 2025 00:16:32 +0000 (08:16 +0800)] 
Revert "MIPS/testsuite: Use isa_rev=2 instead of >=2"

This reverts commit 10bb371eee6357cd32ffc8cfddcd62bd8b182c4b.

4 weeks agobpf: add tests for CO-RE and BTF tag interaction
David Faust [Mon, 28 Apr 2025 19:17:24 +0000 (12:17 -0700)] 
bpf: add tests for CO-RE and BTF tag interaction

Add a couple of tests to ensure that BTF type/decl tags do not interfere
with generation of BPF CO-RE relocations.

gcc/testsuite/
* gcc.target/bpf/core-btf-tag-1.c: New test.
* gcc.target/bpf/core-btf-tag-2.c: New test.

4 weeks agodoc: document btf_type_tag and btf_decl_tag attributes
David Faust [Wed, 5 Feb 2025 18:42:25 +0000 (10:42 -0800)] 
doc: document btf_type_tag and btf_decl_tag attributes

gcc/
* doc/extend.texi (Common Function Attributes)
(Common Variable Attributes): Document btf_decl_tag attribute.
(Common Type Attributes): Document btf_type_tag attribute.

4 weeks agobtf: generate and output DECL_TAG and TYPE_TAG records
David Faust [Wed, 5 Feb 2025 18:41:23 +0000 (10:41 -0800)] 
btf: generate and output DECL_TAG and TYPE_TAG records

Support the btf_decl_tag and btf_type_tag attributes in BTF by creating
and emitting BTF_KIND_DECL_TAG and BTF_KIND_TYPE_TAG records,
respectively, for them.

Some care is required when -gprune-btf is in effect to avoid emitting
decl or type tags for declarations or types which have been pruned and
will not be emitted in BTF.

gcc/
* btfout.cc (get_btf_kind): Handle DECL_TAG and TYPE_TAG kinds.
(btf_calc_num_vbytes): Likewise.
(btf_asm_type): Likewise.
(output_asm_btf_vlen_bytes): Likewise.
(output_btf_tags): New.
(btf_output): Call it here.
(btf_add_used_type): Replace with simple wrapper around...
(btf_add_used_type_1): ...the implementation.  Handle
BTF_KIND_DECL_TAG and BTF_KIND_TYPE_TAG.
(btf_add_vars): Update btf_add_used_type call.
(btf_assign_tag_ids): New.
(btf_mark_type_used): Update btf_add_used_type call.
(btf_collect_pruned_types): Likewise.  Handle type and decl tags.
(btf_finish): Call btf_assign_tag_ids.

gcc/testsuite/
* gcc.dg/debug/btf/btf-decl-tag-1.c: New test.
* gcc.dg/debug/btf/btf-decl-tag-2.c: New test.
* gcc.dg/debug/btf/btf-decl-tag-3.c: New test.
* gcc.dg/debug/btf/btf-decl-tag-4.c: New test.
* gcc.dg/debug/btf/btf-type-tag-1.c: New test.
* gcc.dg/debug/btf/btf-type-tag-2.c: New test.
* gcc.dg/debug/btf/btf-type-tag-3.c: New test.
* gcc.dg/debug/btf/btf-type-tag-4.c: New test.
* gcc.dg/debug/btf/btf-type-tag-c2x-1.c: New test.

include/
* btf.h (BTF_KIND_DECL_TAG, BTF_KIND_TYPE_TAG) New defines.
(struct btf_decl_tag): New.

4 weeks agoctf: translate annotation DIEs to internal ctf
David Faust [Wed, 5 Feb 2025 18:40:12 +0000 (10:40 -0800)] 
ctf: translate annotation DIEs to internal ctf

Translate DW_TAG_GNU_annotation DIEs created for C attributes
btf_decl_tag and btf_type_tag into an in-memory representation in the
CTF/BTF container.  They will be output in BTF as BTF_KIND_DECL_TAG and
BTF_KIND_TYPE_TAG records.

The new CTF kinds used to represent these annotations, CTF_K_DECL_TAG
and CTF_K_TYPE_TAG, are expected to be formalized in the next version of
the CTF specification.  For now they only exist in memory as a
translation step to BTF, and are not emitted when generating CTF
information.

gcc/
* ctfc.cc (ctf_dtu_d_union_selector): Handle CTF_K_DECL_TAG and
CTF_K_TYPE_TAG.
(ctf_add_type_tag, ctf_add_decl_tag): New.
(ctf_add_variable): Return the new ctf_dvdef_ref rather than zero.
(new_ctf_container): Initialize new members.
(ctfc_delete_container): Deallocate new members.
* ctfc.h (ctf_dvdef, ctf_dvdef_t, ctf_dvdef_ref): Move forward
declarations earlier in file.
(ctf_decl_tag_t): New typedef.
(ctf_dtdef): Add ctf_decl_tag_t member to dtd_u union.
(ctf_dtu_d_union_enum): Add new CTF_DTU_D_TAG enumerator.
(ctf_container): Add ctfc_tags vector and ctfc_type_tags_map hash_map
members.
(ctf_add_type_tag, ctf_add_decl_tag): New function protos.
(ctf_add_variable): Change prototype return type to ctf_dvdef_ref.
* dwarf2ctf.cc (gen_ctf_type_tags, gen_ctf_decl_tags)
(gen_ctf_decl_tags_for_var): New static functions.
(gen_ctf_pointer_type): Handle type tags.
(gen_ctf_sou_type): Handle decl tags.
(gen_ctf_function_type): Likewise.
(gen_ctf_variable): Likewise.
(gen_ctf_function): Likewise.
(gen_ctf_type): Handle TAG_GNU_annotation DIEs.

gcc/testsuite/
* gcc.dg/debug/ctf/ctf-decl-tag-1.c: New test.
* gcc.dg/debug/ctf/ctf-type-tag-1.c: New test.

include/
* ctf.h (CTF_K_DECL_TAG, CTF_K_TYPE_TAG): New defines.

4 weeks agodwarf: create annotation DIEs for btf tags
David Faust [Wed, 5 Feb 2025 18:37:47 +0000 (10:37 -0800)] 
dwarf: create annotation DIEs for btf tags

The btf_decl_tag and btf_type_tag attributes provide a means to annotate
declarations and types respectively with arbitrary user provided
strings.  These strings are recorded in debug information for
post-compilation uses, and despite the name they are meant to be
recorded in DWARF as well as BTF.  New DWARF extensions
DW_TAG_GNU_annotation and DW_AT_GNU_annotation are used to represent
these user annotations in DWARF.

This patch introduces the new DWARF extension DIE and attribute, and
generates them as necessary to represent user annotations from
btf_decl_tag and btf_type_tag.

The format of the new DIE is as follows:

    DW_TAG_GNU_annotation
        DW_AT_name: "btf_decl_tag" or "btf_type_tag"
        DW_AT_const_value: <arbitrary user-supplied string>
        DW_AT_GNU_annotation: <reference to another TAG_GNU_annotation DIE>

DW_AT_GNU_annotation is a new attribute extension used to refer to these
new annotation DIEs.  If non-null in any given declaration or type DIE,
it is a reference to a DW_TAG_GNU_annotation DIE holding an annotation
for that declaration or type.  In addition, the DW_TAG_GNU_annotation
DIEs may also have a non-null DW_AT_GNU_annotation, referring to another
annotation DIE.  This allows chains of annotation DIEs to be formed,
such as in the case where a single declaration has multiple instances of
btf_decl_tag with different string annotations.

gcc/
* dwarf2out.cc (struct annotation_node, struct annotation_node_hasher)
(btf_tag_htab): New ancillary structures and hash table.
(annotation_node_hasher::hash, annotation_node_hasher::equal): New.
(hash_btf_tag, gen_btf_tag_dies, maybe_gen_btf_type_tag_dies)
(maybe_gen_btf_decl_tag_dies): New functions.
(modified_type_die): Add new argument to pass type attributes.
Handle btf_type_tag, and update recursive calls.
(base_type_for_mode): Add new arg for modified_type_die call.
(add_type_attribute): Likewise.
(gen_array_type_die): Call maybe_gen_btf_type_tag_dies for the type.
(gen_formal_parameter_die): Call maybe_gen_btf_decl_tag_dies for the
parameter.
(override_type_for_decl_p): Add new arg for modified_type_die call.
(force_type_die): Likewise.
(gen_tagged_type_die): Call maybe_gen_btf_type_tag_dies for the type.
(gen_decl_die): Call maybe_gen_btf_decl_tag_dies for the decl.
(dwarf2out_finish): Empty btf_tag_htab.
(dwarf2out_cc_finalize): Delete btf_tag_htab hash table.

include/
* dwarf2.def (DW_TAG_GNU_annotation): New DWARF extension.
(DW_AT_GNU_annotation): Likewise.

gcc/testsuite/
* gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-1.c: New test.
* gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-2.c: New test.
* gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-3.c: New test.
* gcc.dg/debug/dwarf2/dwarf-btf-type-tag-1.c: New test.
* gcc.dg/debug/dwarf2/dwarf-btf-type-tag-2.c: New test.
* gcc.dg/debug/dwarf2/dwarf-btf-type-tag-3.c: New test.
* gcc.dg/debug/dwarf2/dwarf-btf-type-tag-4.c: New test.
* gcc.dg/debug/dwarf2/dwarf-btf-type-tag-5.c: New test.
* gcc.dg/debug/dwarf2/dwarf-btf-type-tag-6.c: New test.
* gcc.dg/debug/dwarf2/dwarf-btf-type-tag-7.c: New test.
* gcc.dg/debug/dwarf2/dwarf-btf-type-tag-8.c: New test.
* gcc.dg/debug/dwarf2/dwarf-btf-type-tag-9.c: New test.
* gcc.dg/debug/dwarf2/dwarf-btf-type-tag-10.c: New test.

4 weeks agoc-family: add btf_type_tag and btf_decl_tag attributes
David Faust [Wed, 5 Feb 2025 18:35:13 +0000 (10:35 -0800)] 
c-family: add btf_type_tag and btf_decl_tag attributes

Add two new c-family attributes, "btf_type_tag" and "btf_decl_tag"
along with attribute handlers for them.  These attributes may be
used to annotate types or declarations respectively with arbitrary
strings, which will be recorded in DWARF and/or BTF information.
Both attributes accept exactly one string argument.  Wide strings
are not supported.

gcc/c-family/
* c-attribs.cc (c_common_attribute_table): Add btf_decl_tag and
btf_type_tag attributes.
(handle_btf_decl_tag_attribute): New handler for btf_decl_tag.
(hanlde_btf_type_tag_attribute): New handler for btf_type_tag.
(btf_tag_args_ok): Helper for new attribute handlers.

gcc/testsuite/
* gcc.dg/attr-btf-decl-tag-1.c: New test.
* gcc.dg/attr-btf-decl-tag-2.c: New test.
* gcc.dg/attr-btf-type-tag-1.c: New test.
* gcc.dg/attr-btf-type-tag-2.c: New test.
* gcc.dg/attr-btf-type-tag-3.c: New test.

4 weeks agoc++: C++26 va_start - part of P3348R4 - C++26 should refer to C23 not C17
Jakub Jelinek [Thu, 9 Oct 2025 20:41:30 +0000 (22:41 +0200)] 
c++: C++26 va_start - part of P3348R4 - C++26 should refer to C23 not C17

The C++26 https://wg21.link/P3348R4 C++26 should refer to C23 not C17
paper among other things changes va_start macro in the similar way
how C23 has changed it.  Now, unlike C17 and older, C++ has since forever
allowed int (...) but just one wasn't able to use va_start/va_arg/va_end
in such functions.
With the current C++26 draft wording, we'd have to
  #define va_start(V, ...) __builtin_va_start (V, 0)
like we've used for C23 before the PR107980 change.
But Jonathan has kindly filed
https://cplusplus.github.io/LWG/issue4388
which similarly to C23 will if accepted allow to define it as
  #define va_start(...) __builtin_c23_va_start(__VA_ARGS__)
and let the compiler diagnose undesirable cases (see stdarg6.C
testcase in the patch for what it can diagnose, basically anything
that isn't either va_start (ap) or va_start (ap, i) where i is the
last argument's identifier).  This patch implements what assumes
LWG4388 will pass.

It also defines
  #define __STDC_VERSION_STDARG_H__ 202311L
also for C++26.

The hardest part is actually something different.
C23 had to differentiate between C99 void foo (); i.e. unspecified
arguments (but not stdarg) and the new C23 void bar (...); which
is stdarg, but in both cases TYPE_ARG_TYPES (fntype) is NULL.
This has been implemented through the new TYPE_NO_NAMED_ARGS_STDARG_P
flag, fntypes with that flag set are considered stdarg_p and allow
va_start in those, while fntypes with NULL TYPE_ARG_TYPES but the
flag cleared are not stdarg_p, can accept any number of arguments
but can't use va_start.
So, I had to change various places in the C++ FE to pass true
as the third argument to build_function_type for calls which are
meant to be (...) so that one can actually use va_start in those.
Done only for C++26 in order not to disturb older versions too much.
And there is a problem with some of the builtins and #pragma weak
which are using (...) declarations more in the sense of C17
unspecified arguments rather than this call has variable arguments.

So, structural_comptypes now considers the non-C++26 (...) used
for selected builtins and #pragma weak incompatible with C++26 (...)
to avoid ICEs.

2025-10-09  Jakub Jelinek  <jakub@redhat.com>

gcc/
* ginclude/stdarg.h (va_start): Use __builtin_c23_va_start
also for C++26.
(__STDC_VERSION_STDARG_H__): Also define for C++26.
gcc/c-family/
* c-common.h (D_CXX26): Define.
* c-common.cc (c_common_resword): Add D_CXX26 to
__builtin_c23_va_start flags, mention D_CXX26 in comment.
gcc/cp/
* cp-tree.h (cp_build_function_type): Declare.
* lex.cc: Implement va_start changes from P3348R4 - C++26 should
refer to C23 not C17 paper.
(init_reswords): Set D_CXX26 in mask for C++23 and older.
* parser.cc (cp_parser_primary_expression): Handle RID_C23_VA_START.
(cp_parser_builtin_c23_va_start): New function.
* cp-objcp-common.cc (names_builtin_p): Likewise.
* decl.cc (grokfndecl, check_function_type): Pass
TYPE_NO_NAMED_ARGS_STDARG_P as last arg to build_function_type.
(grokdeclarator, static_fn_type): Use cp_build_function_type instead
of build_function_type.
* typeck.cc (merge_types): Likewise.
(structural_comptypes): Return false for TYPE_NO_NAMED_ARGS_STDARG_P
differences.
* lambda.cc (maybe_add_lambda_conv_op): Use cp_build_function_type
instead of build_function_type.
* tree.cc (cp_build_function_type): New function.
(strip_typedefs): Pass TYPE_NO_NAMED_ARGS_STDARG_P as last arg to
build_function_type.
* name-lookup.cc (push_local_extern_decl_alias): Likewise.
* module.cc (trees_in::tree_node): Use cp_build_function_type instead
of build_function_type.
* pt.cc (copy_default_args_to_explicit_spec,
rebuild_function_or_method_type, build_deduction_guide): Likewise.
(alias_ctad_tweaks): Pass TYPE_NO_NAMED_ARGS_STDARG_P as last arg to
build_function_type.
* decl2.cc (change_return_type, cp_reconstruct_complex_type):
Likewise.
gcc/testsuite/
* c-c++-common/cpp/has-builtin-4.c: Expect
__has_builtin (__builtin_c23_va_start) == 1 also for C++26.
* c-c++-common/Wvarargs.c (foo3): Don't expect undefined behavior
warning for C++26.
* g++.dg/cpp26/stdarg1.C: New test.
* g++.dg/cpp26/stdarg2.C: New test.
* g++.dg/cpp26/stdarg3.C: New test.
* g++.dg/cpp26/stdarg4.C: New test.
* g++.dg/cpp26/stdarg5.C: New test.
* g++.dg/cpp26/stdarg6.C: New test.
* g++.dg/cpp26/stdarg7.C: New test.
* g++.dg/cpp26/stdarg8.C: New test.
* g++.dg/cpp26/stdarg9.C: New test.
* g++.dg/opt/pr60849.C (foo): Add explicit cast.

4 weeks agoc++: Fix ICE with concept used as function [PR116477]
Egas Ribeiro [Tue, 7 Oct 2025 21:48:56 +0000 (22:48 +0100)] 
c++: Fix ICE with concept used as function [PR116477]

As suggested by Patrick Palka in the bug report, the diagnostic check
for concept_check_p(fn) was being done too late in finish_call_expr(),
which led to an early return inside if (processing_template_decl), which
meant that the error wouldn't be triggered when we are in a type
dependence early exit. This fix makes sure that this error is handled in
the semantic analysis phase, and avoids the failed assertion later in
tsubst_expr().

PR c++/116477

gcc/cp/ChangeLog:

* semantics.cc (finish_call_expr): Move concept_check_p diagnostic
before processing_template_decl check to catch errors earlier.

gcc/testsuite/ChangeLog:

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

Signed-off-by: Egas Ribeiro <egas.g.ribeiro@tecnico.ulisboa.pt>
4 weeks agoAVR: target/122222 - Add modules for __floatsidf, __floatunsidf.
Georg-Johann Lay [Thu, 9 Oct 2025 16:35:34 +0000 (18:35 +0200)] 
AVR: target/122222 - Add modules for __floatsidf, __floatunsidf.

PR target/122222
libgcc/config/avr/libf7/
* libf7-asm.sx (D_floatsidf, D_floatunsidf): New modules.
* libf7-common.mk (F7_ASM_PARTS): Add D_floatsidf, D_floatunsidf.
(F7F, g_dx): Remove floatunsidf, floatsidf.
* libf7.c (f7_set_s32): Don't alias to f7_floatsidf.
(f7_set_u32): Don't alias to f7_floatunsidf.
* f7-renames.h: Rebuild
* f7-wraps.h: Rebuild.

gcc/testsuite/
* gcc.target/avr/pr122222-sitod.c: New test.

4 weeks agoAVR: target/122220 - Let (int32_t) -0x1p31L return INT32_MIN.
Georg-Johann Lay [Thu, 9 Oct 2025 13:27:16 +0000 (15:27 +0200)] 
AVR: target/122220 - Let (int32_t) -0x1p31L return INT32_MIN.

PR target/122220
libgcc/config/avr/libf7/
* libf7-asm.sx (to_integer): Return 0x80... on negative overflow.

gcc/testsuite/
* gcc.target/avr/pr122220.c: New test.

4 weeks agoanalyzer: reimplement binding_map using a "spatial" representation
David Malcolm [Thu, 9 Oct 2025 18:41:28 +0000 (14:41 -0400)] 
analyzer: reimplement binding_map using a "spatial" representation

Previously, ana::binding_map was a
  hash_map <const binding_key *, const svalue *>
combining both concrete and symbolic keys into the same map, with no
meaningful ordering.

This patch reimplements it as:
  concrete_bindings_t m_concrete;
  symbolic_bindings_t m_symbolic;
where concrete_bindings_t is:
  std::map<bit_range, const svalue *>
thus organizing them into order, and symbolic_bindings_t is:
  std::vector<symbolic_binding>
where a symbolic_binding is a (region, svalue pair) and the vector for
now has at most one symbolic binding.

In particular, this means that iterating over the bindings in a map or
cluster yields them in ascending memory order of concrete bindings,
followed by the symbolic binding (if present).

This should allow various optimizations, make it easier to detect
overlapping bindings, and to eventually better support analyzing code
that builds up a string via concatenations (perhaps with multiple
symbolic bindings "hanging off the end").

gcc/analyzer/ChangeLog:
* access-diagram.cc: Update for renaming of fields of binding_key.
* ana-state-to-diagnostic-state.cc: Likewise.
* bounds-checking.cc: Likewise.  Add store_manager param.
* call-summary.cc: Likewise.
* diagnostic-manager.cc: Drop includes of "basic-block.h" and
"gimple.h".
* engine.cc: Likewise.
* infinite-recursion.cc: Update for renaming of fields of
binding_key.
* kf.cc: Pass store_manager to mark_as_escaped.
* program-state.cc: Update for renaming of fields of binding_key.
* region-model-asm.cc: Pass store manager to
get_or_create_cluster.
* region-model-reachability.cc: Likewise.  Update for renaming of
fields of binding_key.
* region-model.cc: Likewise.
(struct bad_pointer_finder): Drop.
(region_model::poison_any_pointers_to_descendents): Implement
iteration directly, rather than using store::for_each_binding.
Drop return value.
(selftest::test_struct): Set field in order y then x.  Verify
that iteration yields bindings in order x then y.
* region-model.h
(region_model::poison_any_pointers_to_descendents): Drop return
value.
* region.cc: Pass store manager to get_or_create_cluster.
* store.cc (binding_map::const_iterator::operator==): New.
(binding_map::const_iterator::operator++): New.
(binding_map::const_iterator::operator*): New.
(binding_map::iterator::operator==): New.
(binding_map::iterator::operator++): New.
(binding_map::iterator::operator*): New.
(binding_map::binding_map): Reimplement.
(binding_map::operator=): Reimplement.
(binding_map::operator==): Reimplement.
(binding_map::hash): Reimplement.
(binding_map::get): Reimplement.
(binding_map::put): Reimplement.
(binding_map::overwrite): New.
(binding_map::remove): New.
(binding_map::begin): New.
(binding_map::end): New.
(binding_map::elements): New.
(binding_map::dump_to_pp): Reimplement.
(binding_map::to_json): Iterate over *this directly; drop sort.
(binding_map::add_to_tree_widget): Likewise.
(binding_map::cmp): Reimplement.
(binding_map::get_overlapping_bindings): Update for field
renamings.
(binding_cluster::binding_cluster): Add store_mgr param.
(binding_cluster::validate): Update for field renamings.
(binding_cluster::bind_compound_sval): Likewise.
(binding_cluster::purge_state_involving): Likewise.
(binding_cluster::maybe_get_compound_binding): Likewise.  Add
store_mgr param.
(binding_cluster::can_merge_p): Likewise.  Update for new
implementation.
(binding_cluster::make_unknown_relative_to): Likewise.
(binding_cluster::on_unknown_fncall): Likewise.
(binding_cluster::on_asm): Likewise.
(binding_cluster::get_representative_path_vars): Likewise.
(store::set_value): Likewise.
(store::on_maybe_live_values): Pass around store_manager.
(store::fill_region): Likewise.
(store::mark_region_as_unknown): Likewise.
(store::get_or_create_cluster): Likewise.
(store::can_merge_p): Likewise.
(store::mark_as_escaped): Likewise.
(store::canonicalize): Update for field renamings.
(store::loop_replay_fixup): Likewise.  Pass around store_manager.
(store::replay_call_summary_cluster): Likewise.
(selftest::test_binding_map_ops): New.
(selftest::analyzer_store_cc_tests): Call it.
* store.h (class binding_map): Reimplement.
(binding_map::map_t): Drop.
(struct binding_map::symbolic_binding): New.
(binding_map::concrete_bindings_t): New.
(binding_map::symbolic_bindings_t): New.
(struct binding_map::bindings_pair): New.
(class binding_map::const_iterator): New.
(class binding_map::iterator): New.
(binding_map::get): Reimplement.
(binding_map::overwrite): New decl.
(binding_map::remove): Reimplement.
(binding_map::clear): Reimplement.
(binding_map::put): Reimplement.
(binding_map::empty_p): Reimplement.
(binding_map::begin): Reimplement.
(binding_map::end): Reimplement.
(binding_map::elements): Reimplement.
(binding_map::m_map): Drop field.
(binding_map::m_store_mgr): New field.
(binding_map::m_concrete): New field.
(binding_map::m_symbolic): New field.
(BindingVisitor): Drop.
(binding_cluster::map_t): Drop.
(binding_cluster::iterator_t): Reimplement.
(binding_cluster::const_iterator_t): New.
(binding_cluster::binding_cluster): Add store_mgr param.
(binding_cluster::for_each_value): Reimplement.
(binding_cluster::empty_p): Reimplement.
(binding_cluster::for_each_binding): Drop.
(binding_cluster::begin): Split into const/non-const overloads.
(binding_cluster::get_map): Add non-const overload.
(store::get_or_create_cluster): Add store_mgr param.
(store::mark_as_escaped): Likewise.
(store::for_each_binding): Drop.
(store::on_maybe_live_values): Add store_mgr param.
* svalue.cc (compound_svalue::compound_svalue): Reimplement.
(compound_svalue::accept): Likewise.
(compound_svalue::calc_complexity): Likewise.
(compound_svalue::maybe_fold_bits_within): Likewise.
* svalue.h (compound_svalue::const_iterator_t): New.
(compound_svalue::begin): Split into const/non-const overloads.
(compound_svalue::end): Likewise.

gcc/testsuite/ChangeLog:
* gcc.dg/plugin/analyzer_cpython_plugin.cc: Replace INCLUDE_
defines with include of include "analyzer/common.h".  Update
for changes to binding_pair.
* gcc.dg/plugin/analyzer_kernel_plugin.cc: Likewise.
* gcc.dg/plugin/analyzer_known_fns_plugin.cc: Likewise.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
4 weeks agotestsuite: Explicitly enable cselim pass for cselim-2.c
Dimitar Dimitrov [Wed, 8 Oct 2025 18:45:09 +0000 (21:45 +0300)] 
testsuite: Explicitly enable cselim pass for cselim-2.c

The cselim pass is enabled only for targets that have conditional move
instructions.  Since pru-unknown-elf doesn't have such instructions, the
pass is not executed, and the test fails with:

  gcc.dg/tree-ssa/cselim-2.c: dump file does not exist
  UNRESOLVED: gcc.dg/tree-ssa/cselim-2.c scan-tree-dump cselim "if-then-else store replacement: 3"

Fix by explicitly enabling the cselim pass for this test.

gcc/testsuite/ChangeLog:

* gcc.dg/tree-ssa/cselim-2.c: Pass -ftree-cselim option.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
4 weeks agoFortran: fix "unstable" interfaces of external procedures [PR122206]
Harald Anlauf [Thu, 9 Oct 2025 16:43:22 +0000 (18:43 +0200)] 
Fortran: fix "unstable" interfaces of external procedures [PR122206]

In the testcase repeated invocations of a function showed an apparently
unstable interface.  This was caused by trying to guess an (inappropriate)
interface of the external procedure after processing of the procedure
arguments in gfc_conv_procedure_call.  The mis-guessed interface showed up
in subsequent uses of the procedure symbol in gfc_conv_procedure_call.  The
solution is to check for an existing interface of an external procedure
before trying to wildly guess based on just the actual arguments.

PR fortran/122206

gcc/fortran/ChangeLog:

* trans-types.cc (gfc_get_function_type): Do not clobber an
existing procedure interface.

gcc/testsuite/ChangeLog:

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

4 weeks agogimplify: Fix up side-effect handling in 2nd __builtin_c[lt]zg argument [PR122188]
Jakub Jelinek [Thu, 9 Oct 2025 16:06:39 +0000 (18:06 +0200)] 
gimplify: Fix up side-effect handling in 2nd __builtin_c[lt]zg argument [PR122188]

The patch from yesterday made me think about side-effects in the second
argument of __builtin_c[lt]zg.  When we change
__builtin_c[lt]zg (x, y)
when y is not INTEGER_CST into
x ? __builtin_c[lt]zg (x) : y
with evaluating x only once, we omit the side-effects in y unless x is not
0.  That looks undesirable, we should evaluate side-effects in y
unconditionally.

2025-10-09  Jakub Jelinek  <jakub@redhat.com>

PR c/122188
* c-gimplify.cc (c_gimplify_expr): Also gimplify the second operand
before the COND_EXPR and use in COND_EXPR result of gimplification.

* gcc.dg/torture/pr122188.c: New test.

4 weeks agodiagnostics: add class sink::extension
David Malcolm [Thu, 9 Oct 2025 15:38:50 +0000 (11:38 -0400)] 
diagnostics: add class sink::extension

This patch provides a way for plugins to add extra information
to a diagnostic sink, potentially capturing more information via
a "finalizer" hook.

gcc/c-family/ChangeLog:
* c-opts.cc: Define INCLUDE_VECTOR.

gcc/cp/ChangeLog:
* error.cc: Define INCLUDE_VECTOR.

gcc/ChangeLog:
* diagnostic-global-context.cc: Define INCLUDE_VECTOR.
* diagnostics/buffering.cc: Likewise.
* diagnostics/context.cc (context::finish): Call
finalize_extensions on each sink.
(sink::dump): Dump any extensions.
(sink::finalize_extensions): New.
* diagnostics/macro-unwinding.cc: Define INCLUDE_VECTOR.
* diagnostics/selftest-context.cc: Likewise.
* diagnostics/sink.h (class sink::extension): New.
(sink::add_extension): New.
(sink::finalize_extensions): New decl.
(sink::m_extensions): New member.
* gcc.cc: Define INCLUDE_VECTOR.
* langhooks.cc: Likewise.
* opts.cc: Likewise.
* tree-diagnostic-client-data-hooks.cc: Likewise.
* tree-diagnostic.cc: Likewise.

gcc/fortran/ChangeLog:
* error.cc: Define INCLUDE_VECTOR.

gcc/testsuite/ChangeLog:
* gcc.dg/plugin/diagnostic_group_plugin.cc: Define INCLUDE_VECTOR.
* gcc.dg/plugin/diagnostic_plugin_test_show_locus.cc: Likewise.
* gcc.dg/plugin/location_overflow_plugin.cc: Likewise.

libcc1/ChangeLog:
* context.cc: Define INCLUDE_VECTOR.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
4 weeks agolibstdc++: Extend constexpr if to C++14 in _Hashtable::_S_nothrow_move()
Jonathan Wakely [Wed, 8 Oct 2025 14:26:54 +0000 (15:26 +0100)] 
libstdc++: Extend constexpr if to C++14 in _Hashtable::_S_nothrow_move()

We can use diagnostic pragmas to allow the constexpr if version of this
function to be used for C++14 as well. We still need the __and_ version
for C++11 because we can't use 'if' in constexpr functions at all before
C++14.

Also use the integral_constant::value static data member instead of
invoking integral_constant::operator(), as it's a tiny bit cheaper to
compiler.

libstdc++-v3/ChangeLog:

* include/bits/hashtable.h (_Hashtable::_S_nothrow_move): Use
diagnostic pragmas to allow constexpr if in C++14. Use value
member instead of operator().

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
4 weeks agolibstdc++: Tweak comment on generated #endif lines in bits/version.h
Jonathan Wakely [Wed, 8 Oct 2025 11:42:41 +0000 (12:42 +0100)] 
libstdc++: Tweak comment on generated #endif lines in bits/version.h

Make the #endif comment match the #if condition in the generated code.

Also adjust a comment in the Scheme code which describes the logic. The
__glibcxx_NAME macro is not defined _unconditionally_, as it still
depends on the conditions in cxxmin, extra_cond etca,. and the
__cpp_lib_NAME macro now depends on no_stdname too.

libstdc++-v3/ChangeLog:

* include/bits/version.tpl: Fix comment on #endif. Tweak
description of when macros are defined.
* include/bits/version.h: Regenerate.

Reviewed-by: Arsen Arsenović <arsen@aarsen.me>
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
4 weeks agotree-ssa-structalias: Put constraint building into its own file
Filip Kastl [Thu, 9 Oct 2025 11:45:17 +0000 (13:45 +0200)] 
tree-ssa-structalias: Put constraint building into its own file

This patch cuts out points-to constraint building from
tree-ssa-structalias.cc and places it into a new file
gimple-ssa-pta-constraints.cc.

The diff of tree-ssa-structalias.cc ended up being messy, so here is a
summary of changes I made that may not be apparent at first glance.
I didn't do any functional changes.  Everything is just shifting
functions and declarations around and giving external linkage to some
things.

- These functions now have external linkage and got shifted to the
  beginning of the file:
determine_global_memory_access
fndecl_maybe_in_other_partition
new_var_info
- The using namespace pointer_analysis directive got shifted to the
  beginning of the file
- Declarations of these global variables got shifted to the beginning of
  the file:
variable_info_pool
final_solutions
final_solutions_obstack
- These global variables got external linkage:
use_field_sensitive
in_ipa_mode

gcc/ChangeLog:

* Makefile.in: Add gimple-ssa-pta-constraints.cc.
* tree-ssa-structalias.cc (determine_global_memory_access):
External linkage, move to namespace pointer_analysis.
(fndecl_maybe_in_other_partition): External linkage, move to
namespace pointer_analysis.
(new_var_info): External linkage, move to namespace
pointer_analysis.
(create_variable_info_for): Move to
gimple-ssa-pta-constraints.cc.
(lookup_vi_for_tree): External linkage, move to namespace
pointer_analysis, move to gimple-ssa-pta-constraints.cc.
(type_can_have_subvars): Move to gimple-ssa-pta-constraints.cc.
(make_param_constraints): Move to gimple-ssa-pta-constraints.cc.
(get_call_vi): Move to gimple-ssa-pta-constraints.cc.
(lookup_call_use_vi): External linkage, move to namespace
pointer_analysis, move to gimple-ssa-pta-constraints.cc.
(lookup_call_clobber_vi): External linkage, move to namespace
pointer_analysis, move to gimple-ssa-pta-constraints.cc.
(get_call_use_vi): Move to gimple-ssa-pta-constraints.cc.
(get_call_clobber_vi): Move to gimple-ssa-pta-constraints.cc.
(get_constraint_for_1): Move to gimple-ssa-pta-constraints.cc.
(get_constraint_for): Move to gimple-ssa-pta-constraints.cc.
(get_constraint_for_rhs): Move to gimple-ssa-pta-constraints.cc.
(do_deref): Move to gimple-ssa-pta-constraints.cc.
(constraint_pool): Move to gimple-ssa-pta-constraints.cc.
(new_constraint): Move to gimple-ssa-pta-constraints.cc.
(insert_vi_for_tree): Move to gimple-ssa-pta-constraints.cc.
(alias_get_name): Move to gimple-ssa-pta-constraints.cc.
(get_vi_for_tree): Move to gimple-ssa-pta-constraints.cc.
(new_scalar_tmp_constraint_exp): Move to
gimple-ssa-pta-constraints.cc.
(get_constraint_for_ssa_var): Move to
gimple-ssa-pta-constraints.cc.
(process_constraint): Move to gimple-ssa-pta-constraints.cc.
(bitpos_of_field): Move to gimple-ssa-pta-constraints.cc.
(get_constraint_for_ptr_offset): Move to
gimple-ssa-pta-constraints.cc.
(get_constraint_for_component_ref): Move to
gimple-ssa-pta-constraints.cc.
(get_constraint_for_address_of): Move to
gimple-ssa-pta-constraints.cc.
(process_all_all_constraints): Move to
gimple-ssa-pta-constraints.cc.
(do_structure_copy): Move to gimple-ssa-pta-constraints.cc.
(make_constraints_to): Move to gimple-ssa-pta-constraints.cc.
(make_constraint_to): Move to gimple-ssa-pta-constraints.cc.
(make_constraint_from): Move to gimple-ssa-pta-constraints.cc.
(make_copy_constraint): Move to gimple-ssa-pta-constraints.cc.
(make_escape_constraint): Move to gimple-ssa-pta-constraints.cc.
(make_indirect_escape_constraint): Move to
gimple-ssa-pta-constraints.cc.
(make_transitive_closure_constraints): Move to
gimple-ssa-pta-constraints.cc.
(make_any_offset_constraints): Move to
gimple-ssa-pta-constraints.cc.
(struct obstack fake_var_decl_obstack): Move to
gimple-ssa-pta-constraints.cc.
(build_fake_var_decl): Move to gimple-ssa-pta-constraints.cc.
(make_heapvar): Move to gimple-ssa-pta-constraints.cc.
(make_constraint_from_restrict): Move to
gimple-ssa-pta-constraints.cc.
(make_constraint_from_global_restrict): Move to
gimple-ssa-pta-constraints.cc.
(get_function_part_constraint): Move to
gimple-ssa-pta-constraints.cc.
(handle_call_arg): Move to gimple-ssa-pta-constraints.cc.
(handle_rhs_call): Move to gimple-ssa-pta-constraints.cc.
(handle_lhs_call): Move to gimple-ssa-pta-constraints.cc.
(get_fi_for_callee): Move to gimple-ssa-pta-constraints.cc.
(find_func_aliases_for_call_arg): Move to
gimple-ssa-pta-constraints.cc.
(find_func_aliases_for_builtin_call): Move to
gimple-ssa-pta-constraints.cc.
(find_func_aliases_for_call): Move to
gimple-ssa-pta-constraints.cc.
(find_func_aliases): Move to gimple-ssa-pta-constraints.cc.
(process_ipa_clobber): Move to gimple-ssa-pta-constraints.cc.
(find_func_clobbers): Move to gimple-ssa-pta-constraints.cc.
(struct fieldoff): Move to gimple-ssa-pta-constraints.cc.
(fieldoff_compare): Move to gimple-ssa-pta-constraints.cc.
(sort_fieldstack): Move to gimple-ssa-pta-constraints.cc.
(var_can_have_subvars): Move to gimple-ssa-pta-constraints.cc.
(type_must_have_pointers): Move to
gimple-ssa-pta-constraints.cc.
(field_must_have_pointers): Move to
gimple-ssa-pta-constraints.cc.
(push_fields_onto_fieldstack): Move to
gimple-ssa-pta-constraints.cc.
(count_num_arguments): Move to gimple-ssa-pta-constraints.cc.
(create_function_info_for): Move to
gimple-ssa-pta-constraints.cc.
(check_for_overlaps): Move to gimple-ssa-pta-constraints.cc.
(create_variable_info_for_1): Move to
gimple-ssa-pta-constraints.cc.
(intra_create_variable_infos): Move to
gimple-ssa-pta-constraints.cc.
(init_base_vars): Move to gimple-ssa-pta-constraints.cc.
(init_constraint_builder): Move to
gimple-ssa-pta-constraints.cc.
(delete_constraint_builder): Move to
gimple-ssa-pta-constraints.cc.
(intra_build_constraints): Move to
gimple-ssa-pta-constraints.cc.
(delete_points_to_sets): Move to gimple-ssa-pta-constraints.cc.
(associate_varinfo_to_alias): Move to
gimple-ssa-pta-constraints.cc
(refered_from_nonlocal_fn): Move to
gimple-ssa-pta-constraints.cc
(refered_from_nonlocal_var): Move to
gimple-ssa-pta-constraints.cc
(ipa_create_function_infos): Move to
gimple-ssa-pta-constraints.cc
(ipa_create_global_variable_infos): Move to
gimple-ssa-pta-constraints.cc
(ipa_build_constraints): Move to gimple-ssa-pta-constraints.cc
* tree-ssa-structalias.h (struct constraint_stats):
(determine_global_memory_access): External linkage, move to
namespace pointer_analysis.
(fndecl_maybe_in_other_partition): External linkage, move to
namespace pointer_analysis.
(new_var_info): External linkage, move to namespace
pointer_analysis.
* gimple-ssa-pta-constraints.cc: New file.
* gimple-ssa-pta-constraints.h: New file.

Signed-off-by: Filip Kastl <fkastl@suse.cz>
4 weeks agotree-ssa-structalias: Put constraint building into separate functions
Filip Kastl [Thu, 9 Oct 2025 11:42:52 +0000 (13:42 +0200)] 
tree-ssa-structalias: Put constraint building into separate functions

Preparation for splitting out constraint building into a separate source
file.  This patch splits out constraint building from
compute_points_to_sets and ipa_pta_execute into separate functions.
It also moves initializing and cleaning up constraint building stuff
into separate functions.

gcc/ChangeLog:

* tree-ssa-structalias.cc (init_constraint_builder): New
function.
(delete_constraint_builder): New function.
(compute_points_to_sets): Put constraint building into
intra_build_constraints and call it.
(intra_build_constraints): New function.
(delete_points_to_sets): Put cleanup of constraint builder
global vars into delete_constraint_builder and call it.
(ipa_pta_execute): Put constraint building into
ipa_build_constraints and call it.
(ipa_create_function_infos): New function.
(ipa_create_global_variable_infos): New function.
(ipa_build_constraints): New function.

Signed-off-by: Filip Kastl <fkastl@suse.cz>
4 weeks agolibstdc++: Formatting tests for std::chrono date types.
Tomasz Kamiński [Thu, 9 Oct 2025 09:12:15 +0000 (11:12 +0200)] 
libstdc++: Formatting tests for std::chrono date types.

This covers year_month_day_last, year_month_weekday, year_month_weekday_last.

libstdc++-v3/ChangeLog:

* testsuite/std/time/year_month_day_last/io.cc: New formatting tests.
* testsuite/std/time/year_month_weekday/io.cc: Likewise.
* testsuite/std/time/year_month_weekday_last/io.cc: Likewise.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
4 weeks agoxtensa: constantsynth: Update to version 2
Takayuki 'January June' Suwa [Wed, 8 Oct 2025 01:31:37 +0000 (10:31 +0900)] 
xtensa: constantsynth: Update to version 2

This patch completely replaces the existing "constantsynth" with a new
implementation, which has become unsightly due to the extension.

This new version offers the following benefits:

  - Independence from the insn splitting mechanism.  No define_split
    descriptions are required
  - Resource saving as internally required information storage no longer
    persists across passes
  - The replacement of insns is based on the actual costs (for both size
    and speed) of the insns before and after the conversion, rather than
    on some arbitrary pre-determined ones
  - The replacing insn sequence is verified by formally evaluating the
    RTL expressions to see if it correctly computes the original constant
    value
  - Easy-to-understand/-add interface for constant synthesis methods

The built-in synthesis methods are (supposedly) very effective, with 2
instructions for certain values and up to 5 instructions to cover all
32-bit values.

     /* example */
     _Complex double test(int a[], float b[]) {
       a[0] = 2045 * 2045;
       a[1] = 0xDEADBEEF;
       a[2] = 0xDEADBEEF - 15;
       a[3] = 4182000;
       a[4] = 131071;
       a[5] = 293805;
       a[6] = 700972933;
       a[7] = -372738139;
       b[0] = 3.14159265359f;
       b[1] *= 0.12005615234375f;
       return 1-1i;
     }

     ;; result (-O2 -mextra-l32r-costs=5)
     test:
      entry sp, 32
      movi a8, 0x7af
      float.s f1, a8, 14
      movi a8, 0x7fd
      mull a8, a8, a8
      lsi f0, a3, 4
      s32i.n a8, a2, 0
      movi.n a8, 0x57
      addmi a8, a8, -0x1100
      slli a8, a8, 17
      addmi a8, a8, -0x4100
      addi a8, a8, -17
      s32i.n a8, a2, 4
      addi a8, a8, -15
      s32i.n a8, a2, 8
      movi a8, 0x3fd
      slli a8, a8, 12
      addi a8, a8, -16
      s32i.n a8, a2, 12
      movi.n a8, -1
      srli a8, a8, 15
      s32i.n a8, a2, 16
      movi a8, 0x85
      addmi a8, a8, 0x7f00
      addx8 a8, a8, a8
      s32i.n a8, a2, 20
      movi a8, 0x539
      slli a8, a8, 19
      addi a8, a8, -123
      s32i.n a8, a2, 24
      movi a8, -0x2c7
      slli a8, a8, 19
      addmi a8, a8, 0x7800
      addi a8, a8, -91
      s32i.n a8, a2, 28
      movi.n a8, 0x49
      mul.s f0, f0, f1
      addmi a8, a8, 0x4000
      slli a8, a8, 16
      addmi a8, a8, 0x1000
      addi a8, a8, -37
      s32i.n a8, a3, 0
      ssi f0, a3, 4
      movi a5, -0x401
      movi a3, 0x3ff
      movi.n a2, 0
      slli a3, a3, 20
      movi.n a4, 0
      slli a5, a5, 20
      retw.n

gcc/ChangeLog:

* config/xtensa/xtensa-protos.h (xtensa_constantsynth): Remove.
* config/xtensa/xtensa.cc
(#include): Remove "context.h" and "pass_manager.h".
(machine_function): Remove "litpool_usage" member.
(xtensa_constantsynth_2insn, xtensa_constantsynth_rtx_SLLI,
xtensa_constantsynth_rtx_ADDSUBX, xtensa_constantsynth): Remove.
(constantsynth_method_lshr_m1, split_hwi_to_MOVI_ADDMI,
constantsynth_method_16bits, constantsynth_method_32bits,
constantsynth_method_square): New worker function related to
constant synthesis methods.
(constantsynth_method_info, constantsynth_methods):
New structure representing the list of all constant synthesis
methods.
(constantsynth_info): New structure that stores internal
information for "constantsynth".
(constantsynth_pass1, verify_synth_seq, constantsynth_pass2):
New functions that are the core of "constantsynth".
(do_largeconst): Add a call to constantsynth_pass1() to the insn
enumeration loop, and add a call to constantsynth_pass2() to the
end of this function.
* config/xtensa/xtensa.md (SHI): Remove.
(The two auxiliary define_splits for mov[sh]i_internal): Remove.
(The two auxiliary define_splits for movsf_internal): Remove.

gcc/testsuite/ChangeLog:

* gcc.target/xtensa/constsynth_2insns.c,
gcc.target/xtensa/constsynth_3insns.c,
gcc.target/xtensa/constsynth_double.c: Remove due to outdated.
* gcc.target/xtensa/constsynthV2_O2_costs0.c,
gcc.target/xtensa/constsynthV2_O2_costs5.c,
gcc.target/xtensa/constsynthV2_Os.c: New.

4 weeks agoxtensa: Change the splitting of D[IF]mode constant assignments to be implemented...
Takayuki 'January June' Suwa [Wed, 8 Oct 2025 01:27:48 +0000 (10:27 +0900)] 
xtensa: Change the splitting of D[IF]mode constant assignments to be implemented in xt_largeconst instead of define_split

This patch moves the process of splitting D[IF]mode constant assignments
into SImode ones from the define_split implementation after reloading to
processing within the "xt_largeconst" target-specific pass.  It also
converts SFmode constant assignments into bit-equivalent SImode ones.

This allows these assignments to be processed by the "constantsynth"
optimization, which will be reimplemented later.

gcc/ChangeLog:

* config/xtensa/xtensa-protos.h
(xtensa_split_DI_reg_imm): Remove.
* config/xtensa/xtensa.cc (xtensa_split_DI_reg_imm): Remove.
(split_DI_SF_DF_const): New worker function.
(do_largeconst): Add a call to split_DI_SF_DF_const() to the insn
enumeration loop.
* config/xtensa/xtensa.md (movdi): Remove split code when the
source is constant.
(movdi_internal): Add a new constraint pair (a, Y) to the second
of the existing constraint alternatives.
(The auxiliary define_split for movdi_internal): Remove.

4 weeks agoxtensa: Optimize assignment of certain constants to hardware FP registers
Takayuki 'January June' Suwa [Fri, 19 Sep 2025 12:25:10 +0000 (21:25 +0900)] 
xtensa: Optimize assignment of certain constants to hardware FP registers

This patch introduces an optimization that replaces assignments of signed
12-bit integer values divided by 0th through 15th power of two to hardware
FP registers with assignments of that integer values to address (GP)
registers followed by negatively-scaled floating-point conversion
instructions.

For example, 0.12005615234375f is exactly equal to (1967.f / (1 << 14)), so
we can emit such as:

movi a9, 1967
float.s f0, a9, 14

if such conversion reduces costs.

gcc/ChangeLog:

* config/xtensa/xtensa.cc (xt_full_rtx_costs):
New struct, derived from full_rtx_costs.
(FPreg_neg_scaled_simm12b_1, FPreg_neg_scaled_simm12b):
New worker functions.
(do_largeconst): Add a call to FPreg_neg_scaled_simm12b() to the
insn enumeration loop.

4 weeks agoxtensa: Make large CONST_INT legitimate until the postreload pass
Takayuki 'January June' Suwa [Fri, 19 Sep 2025 12:24:27 +0000 (21:24 +0900)] 
xtensa: Make large CONST_INT legitimate until the postreload pass

Generally, RISC machines only have a limited bit width for integer constant
immediate values, and it is common to implement
TARGET_LEGITIMATE_CONSTANT_P() for their representation.  However, by
making bare CONST_INTs less visible in RTL, some optimizers may miss out
on opportunities.

  - Operands with the nonmemory/immediate_operand() predicates never accept
    constants that TARGET_LEGITIMATE_CONSTANT_P() rejects, so templates
    containing their predicates may unintentionally not be used for insns
    containing such constants during the RTL generation or instruction
    combination passes

  - Some optimizers only accept bare CONST_INTs and may not consider their
    equivalents (such as literal pool entry references) at all
    (Unrelated to this patch, but perhaps even worse, some optimizers such
    as RTL ifcvt, assume that not only the constant format but also the insn
    format is CISC-like)

As a clear example, the effect of constant-anchored optimization during
the postreload pass can be seen by compiling the following with and without
-mconst16 or -mauto-litpools:

     /* example */
     void test(int a[4]) {
       a[0] = 0xDEADFACE;
       a[1] = 0xDEADFACE - 1;
       a[2] = 0xDEADFACE - 2;
       a[3] = 0xDEADFACE + 254;
     }

     ;; without -mauto-litpools
      .literal_position
      .literal .LC0, -559023410
      .literal .LC1, -559023411
      .literal .LC2, -559023412
      .literal .LC3, -559023156
     test:
      entry sp, 32
      l32r a8, .LC0
      s32i.n a8, a2, 0
      l32r a8, .LC1
      s32i.n a8, a2, 4
      l32r a8, .LC2
      s32i.n a8, a2, 8
      l32r a8, .LC3
      s32i.n a8, a2, 12
      retw.n

     ;; with -mauto-litpools
     test:
      entry sp, 32
      movi a8, -559023410
      s32i.n a8, a2, 0
      addi.n a8, a8, -1 ;; const-anchored
      s32i.n a8, a2, 4
      addi.n a8, a8, -1 ;; const-anchored
      s32i.n a8, a2, 8
      addmi a8, a8, 0x100 :: const-anchored
      s32i.n a8, a2, 12
      retw.n

Therefore, we aim to overcome the above obstacles by introducing a tweak
that legitimates a full-bitwidth CONST_INT regardless of other conditions
until a specific RTL path is reached.  Then, the most appropriate point
to switch the behavior of TARGET_LEGITIMATE_CONSTANT_P() would probably
be just before reload/LRA, but as mentioned earlier, there is an optimizer
that should be utilized in postreload, so the switchover point will be
just after that.

This patch introduces a new target-specific pass called "xt_largeconst"
to implement all of the above, which will also serves as a host for other
future optimizers related to large constants, such as "constantsynth".
As a result, this patch also resolves some of the issues mentioned in the
previous patch notes:

  - B[GE/LT]U branch instructions with immediate values of 32768 or 65536
    cannot be emitted
  - Insn combination templates matching the CLAMPS instruction cannot be
    matched against large upper and lower bounds

gcc/ChangeLog:

* config/xtensa/constraints.md (Y):
Change to reference xtensa_postreload_completed_p() instead of
xtensa_split1_finished_p().
* config/xtensa/predicates.md (move_operand): Ditto.
* config/xtensa/t-xtensa (PASSES_EXTRA):
Add xtensa-passes.def as target-specific pass description.
* config/xtensa/xtensa-passes.def:
New definition file that inserts pass_xtensa_largeconst after
pass_postreload_cse.
* config/xtensa/xtensa-protos.h (xtensa_split1_finished_p): Remove.
(xtensa_postreload_completed_p, make_pass_xtensa_largeconst):
New function prototypes.
* config/xtensa/xtensa.cc (machine_function):
Add a new member "postreload_completed".
(xtensa_emit_move_sequence):
Change to reference xtensa_postreload_completed_p() instead of
can_create_pseudo_p().
(xtensa_split1_finished_p): Remove.
(xtensa_postreload_completed_p): New function.
(xtensa_legitimate_constant_p): Change to also consider
xtensa_postreload_completed_p().
(litpool_set_src_1, litpool_set_src, do_largeconst,
rest_of_handle_largeconst):
New sub-functions for pass_xtensa_largeconst.
(pass_data_xtensa_largeconst, pass_xtensa_largeconst):
New target-specific pass definition.
(make_pass_xtensa_largeconst):
New function called by the pass manager.
* config/xtensa/xtensa.md
(The auxiliary define_split for movdi_internal):
Change to reference xtensa_postreload_completed_p() instead of
xtensa_split1_finished_p().
(The first of three auxiliary define_splits for mov[sh]i_internal):
Remove.

gcc/testsuite/ChangeLog:

* gcc.target/xtensa/BGEUI-BLTUI-32k-64k.c:
Disable optimizations and modify to also verify RTL dump in the
"expand" pass.

4 weeks agoxtensa: Implement TARGET_MD_ASM_ADJUST
Takayuki 'January June' Suwa [Fri, 19 Sep 2025 12:23:51 +0000 (21:23 +0900)] 
xtensa: Implement TARGET_MD_ASM_ADJUST

The behavior of the 'g'-constraint on asm statement operands does not
strictly match that described in the GCC User Manual:

   "'g'  Any register, memory, or immediate integer operand is allowed,
    except for registers that are not general registers."

   -- 6.12.3.1 Simple Constraints, Using the GCC (the latest)

Contrary to the quote above, the following example will produce different
results depending on whether TARGET_CONST16 or TARGET_AUTO_LITPOOLS is
enabled:

     /* example */
     void test(void) {
       asm volatile ("# %0"::"g"(65536));
     }

     ;; TARGET_CONST16 || TARGET_AUTO_LITPOOLS
     test:
      entry sp, 32
      # 65536
      retw.n

     ;; !TARGET_CONST16 && !TARGET_AUTO_LITPOOLS
      .literal_position
      .literal .LC0, 65536
     test:
      entry sp, 32
      # .LC0
      retw.n

Indeed, both of the above results satisfy the constraint, but the latter
is not an "any" constant as stated in the manual, and is therefore incon-
sistent with the former.

This is because the behavior of the 'g'-constraint on constants depends
on the general_operand() predicate, and essentially on
TARGET_LEGITIMATE_CONSTANT_P().

This patch resolves that inconsistency by adding an 'n'-constraint imme-
diately before every occurrence of 'g' in each constraint string during
the RTL generation pass, to prioritize being an integer constant for the
alternative to which 'g' belongs.

gcc/ChangeLog:

* config/xtensa/xtensa.cc
(TARGET_MD_ASM_ADJUST): New macro definition.
(xtensa_md_asm_adjust): New function prototype and definition, that
prepends all 'g'-constraints in the "constraints" vector with 'n',
if neither TARGET_CONST16 nor TARGET_AUTO_LITPOOLS is enabled.

4 weeks agotree-optimization/122212 - fix CLZ detection
Richard Biener [Thu, 9 Oct 2025 07:06:27 +0000 (09:06 +0200)] 
tree-optimization/122212 - fix CLZ detection

The following corrects a mistake with the zero value handling which
was broken because the bits bias was applied first which works
for the special-case using a bit-and but not when using a conditional
move.  Apply this after the fact instead where it also more easily
folds with an existing bias we compensate.

PR tree-optimization/122212
* tree-ssa-forwprop.cc (simplify_count_zeroes): Apply
bias for CLZ after dealing with the zero special value.

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

4 weeks agoAVR: target/122210 - Add double -> fixed-point conversions.
Georg-Johann Lay [Wed, 8 Oct 2025 18:02:53 +0000 (20:02 +0200)] 
AVR: target/122210 - Add double -> fixed-point conversions.

PR target/122210
libgcc/config/avr/libf7/
* libf7-common.mk (F7_ASM_PARTS): Add D2<fx> modules.
* libf7-asm.sx: Implement the D2<fx> modules.

gcc/testsuite/
* gcc.target/avr/dtofx.c: New test.

4 weeks agoAVR: target/122210 - Add fixed-point -> double conversions.
Georg-Johann Lay [Wed, 8 Oct 2025 18:02:53 +0000 (20:02 +0200)] 
AVR: target/122210 - Add fixed-point -> double conversions.

PR target/122210
libgcc/config/avr/libf7/
* libf7-common.mk (F7_ASM_PARTS): Add <fx>2D modules.
* libf7-asm.sx: Implement the <fx>2D modules.

gcc/testsuite/
* gcc.target/avr/fxtod.c: New test.

4 weeks agoRISC-V: Allow VLS types using up to LMUL 8
Kito Cheng [Mon, 1 Sep 2025 10:29:53 +0000 (18:29 +0800)] 
RISC-V: Allow VLS types using up to LMUL 8

We used to apply -mrvv-max-lmul= to limit VLS code gen, auto vectorizer,
and builtin string function expansion. But I think the VLS code gen part doesn't
need this limit, since it only happens when the user explicitly writes vector
types.

For example, int32x8_t under -mrvv-max-lmul=m1 with VLEN=128 would be split into
two int32x4_t, which generate more instructions and runs slower.

In this patch, I changed -mrvv-max-lmul= to only affect auto vectorization and
builtin string function expansion. Actually, the option's help text already
says it only controls the LMUL used by auto-vectorization, so I believe this
change is makes sense :)

Changes since v1:
- Add testase to make sure auto vectorizer is still constrained by
  -mrvv-max-lmul=.

gcc/ChangeLog:

* config/riscv/riscv-protos.h (vls_mode_valid_p): New argument
allow_up_to_lmul_8.
* config/riscv/riscv-v.cc (autovectorize_vector_modes): Set
allow_up_to_lmul_8 to false.
(vls_mode_valid_p): Add new argument allow_up_to_lmul_8, and use
it to determine whether to allow LMUL 8.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/vls-type-rvv-max-lmul.c: New test.
* gcc.target/riscv/rvv/vls-type-rvv-max-lmul-autovec.c: New
test.

4 weeks agoPR81358: Enable automatic linking of libatomic.
Prathamesh Kulkarni [Thu, 9 Oct 2025 07:07:24 +0000 (07:07 +0000)] 
PR81358: Enable automatic linking of libatomic.

ChangeLog:
PR driver/81358
* Makefile.def: Add no_atomic=true for libraries that don't depend on
libatomic.
* Makefile.tpl: Export TARGET_CONFIGDIRS and create rule to
add dependencies for libatomic.
* configure.ac: Add libatomic to bootstrap_target_libs.
* Makefile.in: Regenerate.
* configure: Regenerate.

gcc/ChangeLog:
PR driver/81358
* common.opt: New option -flink-libatomic.
* gcc.cc (LINK_LIBATOMIC_SPEC): New macro.
* config/alpha/linux.h (LINK_GCC_C_SEQUENCE_SPEC): Use LINK_LIBATOMIC_SPEC.
* config/arm/uclinux-elf.h: Likewise.
* config/arm/unknown-elf.h: Likewise.
* config/avr/avrlibc.h: Likewise.
* config/bfin/linux.h: Likewise.
* config/darwin.h: Likewise.
* config/gnu-user.h: Likewise.
* config/lm32/uclinux-elf.h: Likewise.
* config/rs6000/linux64.h: Likewise.
* config/rs6000/rtems.h: Likewise.
* config/sparc/sparc.h: Likewise.
* doc/invoke.texi: Document -flink-libatomic.
* configure.ac: Define TARGET_PROVIDES_LIBATOMIC.
* configure: Regenerate.
* config.in: Regenerate.
* common.opt.urls: Regenerate.

libatomic/ChangeLog:
PR driver/81358
* Makefile.am: Pass -fno-link-libatomic.
New rule all-local.
* configure.ac: Assert that CFLAGS is set and pass -fno-link-libatomic.
Use __libatomic_save_CFLAGS__ instead of save_CFLAGS.
* Makefile.in: Regenerate.
* configure: Regenerate.

Signed-off-by: Prathamesh Kulkarni <prathameshk@nvidia.com>
Co-authored-by: Matthew Malcolmson <mmalcolmson@nvidia.com>
4 weeks agovect: Remove type from misalignment hook.
Robin Dapp [Thu, 11 Sep 2025 13:20:36 +0000 (15:20 +0200)] 
vect: Remove type from misalignment hook.

This patch removes the type argument from the vector_misalignment hook.
Ever since we switched from element to byte misalignment its
semantics haven't been particularly clear and nowadays it should be
redundant.

Also, in case of gather/scatter, the patch sets misalignment to the
misalignment of one unit of the vector mode so targets can
distinguish between element size alignment and element mode alignment.

is_packed is now always set, regardless of misalignment.

gcc/ChangeLog:

* config/aarch64/aarch64.cc (aarch64_builtin_support_vector_misalignment):
Remove type.
* config/arm/arm.cc (arm_builtin_support_vector_misalignment):
Ditto.
* config/epiphany/epiphany.cc (epiphany_support_vector_misalignment):
Ditto.
* config/gcn/gcn.cc (gcn_vectorize_support_vector_misalignment):
Ditto.
* config/loongarch/loongarch.cc (loongarch_builtin_support_vector_misalignment):
Ditto.
* config/riscv/riscv.cc (riscv_support_vector_misalignment):
Ditto.
* config/rs6000/rs6000.cc (rs6000_builtin_support_vector_misalignment):
Ditto.
* config/s390/s390.cc (s390_support_vector_misalignment):
Ditto.
* doc/tm.texi: Adjust vector misalignment docs.
* target.def: Ditto.
* targhooks.cc (default_builtin_support_vector_misalignment):
Remove type.
* targhooks.h (default_builtin_support_vector_misalignment):
Ditto.
* tree-vect-data-refs.cc (vect_can_force_dr_alignment_p):
Set misalignment for gather/scatter and remove type.
(vect_supportable_dr_alignment): Ditto.

4 weeks agodoc: type-punning through a union is a GNU extension for C++
Sam James [Thu, 9 Oct 2025 02:40:58 +0000 (03:40 +0100)] 
doc: type-punning through a union is a GNU extension for C++

We didn't explicitly say that type-punning through a union is undefined
behavior in C++. Mention that, and that we support it as a GNU extension.

This was reported on LLVM's Discourse (forums) [0].

[0] https://discourse.llvm.org/t/ub-when-type-punning-through-unions/88527/6

gcc/ChangeLog:
PR c++/117219

* doc/invoke.texi (-fstrict-aliasing): Explain that type-punning
through a union in C++ is supported as a GNU extension.

4 weeks agodoc: fix grammar nit
Sam James [Thu, 9 Oct 2025 02:38:06 +0000 (03:38 +0100)] 
doc: fix grammar nit

gcc/ChangeLog:

* doc/invoke.texi: Add missing full stop.

4 weeks agodoc: mention -Wmaybe-uninitialized vs CCP
Sam James [Tue, 7 Oct 2025 00:51:55 +0000 (01:51 +0100)] 
doc: mention -Wmaybe-uninitialized vs CCP

CCP interacts poorly with -Wmaybe-uninitialized in some cases by assuming a value
which stops us warning about it (false negatives). Inform users about this
infamous interaction.

gcc/ChangeLog:
PR tree-optimization/18501

* doc/invoke.texi (-Wmaybe-uninitialized): Mention interaction with
CCP.

4 weeks agoDaily bump.
GCC Administrator [Thu, 9 Oct 2025 00:21:21 +0000 (00:21 +0000)] 
Daily bump.