Commit Graph

224024 Commits

Author SHA1 Message Date
Pierre Marie de Rodat
be496fd2aa 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.
2025-10-14 00:24:19 +02:00
Shreya Munnangi
304d7359a6 [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.
2025-10-13 16:15:02 -06:00
Jeff Law
a92369a6be [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.
2025-10-13 14:33:10 -06:00
Jonathan Wakely
fcd30bdb83 libstdc++: Fix grammatical error in comment in std::advance
libstdc++-v3/ChangeLog:

	* include/bits/stl_iterator_base_funcs.h (advance): Fix comment.
2025-10-13 21:07:30 +01:00
Jakub Jelinek
4afb257fc2 ++: 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.
2025-10-13 21:36:47 +02:00
Gaius Mulley
65acf3665e 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>
2025-10-13 16:43:07 +01:00
Alex Coplan
0c670d3845 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.
2025-10-13 16:08:38 +01:00
Yuao Ma
1c5e1093a7 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.
2025-10-13 23:03:41 +08:00
Pan Li
51b76ec931 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>
2025-10-13 21:30:59 +08:00
Jan Hubicka
7dbb61de21 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.
2025-10-13 13:14:33 +02:00
Jonathan Wakely
8adda95093 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>
2025-10-13 11:04:28 +01:00
Jonathan Wakely
fc74f4f0a2 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>
2025-10-13 11:03:44 +01:00
Robin Dapp
85ab3a22ed 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.
2025-10-13 11:57:30 +02:00
Avinash Jayakar
33b1a5d588 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.
2025-10-13 15:17:45 +05:30
Jakub Jelinek
80e82de4b8 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).
2025-10-13 09:47:09 +02:00
Richard Biener
273121cabe 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.
2025-10-13 09:37:43 +02:00
Paul Thomas
70b03019b5 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.
2025-10-13 07:55:18 +01:00
Iain Sandoe
5b57da59c1 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>
2025-10-13 07:03:12 +01:00
GCC Administrator
5509927de9 Daily bump. 2025-10-13 00:17:27 +00:00
Nathaniel Shead
ac52429911 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>
2025-10-12 22:22:30 +11:00
Paul Thomas
915fdb3bd9 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.
2025-10-12 08:21:11 +01:00
GCC Administrator
767a93886a Daily bump. 2025-10-12 00:17:20 +00:00
Gaius Mulley
66a5376706 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>
2025-10-11 18:34:25 +01:00
Bohan Lei
c9586a3e90 [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.
2025-10-11 10:24:25 -06:00
Georg-Johann Lay
e347e2b81a 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.
2025-10-11 15:36:34 +02:00
Harald Anlauf
623a0da3c3 fortran: fix bootstrap after r16-4372 [PR122257]
PR fortran/50377
	PR fortran/122257

gcc/fortran/ChangeLog:

	* resolve.cc (resolve_actual_arglist): Initialize variable.
2025-10-11 14:53:37 +02:00
Gerald Pfeifer
c1a8b4fa50 libstdc++: Update Autoconf manual link
libstdc++-v3:
	* doc/xml/manual/build_hacking.xml: Update Autoconf manual link.
	* doc/html/manual/appendix_porting.html: Regenerate.
2025-10-11 12:18:56 +02:00
Ben Boeckel
1d01a8f577 *: Fix patch email address
ChangeLog:
	* config-ml.in: Update patch email address.
	* symlink-tree: Ditto.
2025-10-11 11:08:01 +02:00
Austin Law
461fa63908 [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.
2025-10-10 21:32:14 -06:00
GCC Administrator
ddd6dff0ba Daily bump. 2025-10-11 00:21:09 +00:00
Jonathan Wakely
385984f555 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>
2025-10-11 00:09:19 +01:00
Harald Anlauf
52ee235811 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.
2025-10-10 22:02:51 +02:00
David Faust
6a77bf08e5 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>
2025-10-10 12:29:31 -07:00
Robert Dubner
0e95ebf465 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.
2025-10-10 13:19:34 -04:00
Andrew Pinski
7fe86bb107 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>
2025-10-10 08:55:28 -07:00
Patrick Palka
49ddf362f0 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>
2025-10-10 10:25:25 -04:00
Umesh Kalvakuntla
578c322e7d 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.
2025-10-10 15:51:24 +02:00
Pan Li
17d24e89c4 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>
2025-10-10 21:25:16 +08:00
Pan Li
6c8bcbc10d 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>
2025-10-10 21:25:16 +08:00
Juergen Christ
05e1cda2bd s390x: Fix fmin/fmax patterns
s390x floating point minimum and maximum functions unfortunately do
not canonicalize NaNs.  Hence, test pr105414.c fails since
c476f554e3.  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>
2025-10-10 15:16:51 +02:00
Stefan Schulze Frielinghaus
08970b2cb2 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.
2025-10-10 15:02:09 +02:00
Segher Boessenkool
73b3c59677 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.
2025-10-10 12:18:14 +00:00
Tomasz Kamiński
1084346574 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.
2025-10-10 14:03:11 +02:00
Christophe Lyon
4e541f74e5 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.
2025-10-10 11:31:18 +00:00
Christophe Lyon
81e2264403 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.
2025-10-10 11:12:11 +00:00
Andrew Stubbs
cdba274bb1 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.
2025-10-10 10:55:40 +00:00
Francois-Xavier Coudert
059eb26c03 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.
2025-10-10 12:28:08 +02:00
Richard Biener
e520fe0803 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.
2025-10-10 11:25:02 +02:00
Robin Dapp
53085a46e7 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.
2025-10-10 11:01:42 +02:00
Tobias Burnus
d2ad7e9083 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.
2025-10-10 09:48:37 +02:00