]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
9 days agoGenerate Algol68 frontend online docs
Pietro Monteiro [Tue, 16 Dec 2025 12:48:06 +0000 (07:48 -0500)] 
Generate Algol68 frontend online docs

maintainer-scripts/ChangeLog:

* update_web_docs_git (MANUALS): Add ga68 and ga68-internals.

Signed-off-by: Pietro Monteiro <pietro@sociotechnical.xyz>
9 days agoRegenerate opt-urls
Jose E. Marchesi [Tue, 16 Dec 2025 12:23:55 +0000 (13:23 +0100)] 
Regenerate opt-urls

Signed-off-by: Jose E. Marchesi <jemarch@gnu.org>
gcc/ChangeLog

* common.opt.urls: Regenerate.

gcc/algol68/ChangeLog

* lang.opt.urls: Regenerate.

9 days agoa68: support for -fmodules-map and -fmodules-map-file
Jose E. Marchesi [Sun, 14 Dec 2025 10:22:35 +0000 (11:22 +0100)] 
a68: support for -fmodules-map and -fmodules-map-file

This commit adds support for two new command-line options for the
Algol 68 front-end:

  -fmodules-map=<string>
  -fmodules-map-file=<filename>

These options are used in order to specify a mapping from module
indicants to file basenames.  The compiler will base its search for
the modules on these basenames rather on the default schema of
deriving the basename from the module indicant.

Signed-off-by: Jose E. Marchesi <jemarch@gnu.org>
gcc/algol68/ChangeLog

* lang.opt (-fmodules-map): New option.
(-fmodules-map-file): Likewise.
* a68.h: Add prototype for a68_process_module_map.
* a68-imports.cc (SKIP_WHITESPACES): Define.
(PARSE_BASENAME): Likewise.
(PARSE_INDICANT): Likewise.
(a68_process_module_map): New function.
* a68-lang.cc: (a68_init): Move initialization of
A68_MODULE_FILES from there...
(a68_init_options): to here.
(a68_handle_option): Handle OPT_fmodules_map and
OPT_fmodules_map_.
* a68-parser-pragmat.cc (handle_access_in_pragmat): Normalize
module indicants to upper case.
* ga68.texi (Module search options): New section.

9 days agoa68: introduce a68_file_size and a68_file_read
Jose E. Marchesi [Mon, 15 Dec 2025 13:03:01 +0000 (14:03 +0100)] 
a68: introduce a68_file_size and a68_file_read

This commit introduces two new utility functions that replace some
ad-hoc infrastructure in the scanner.

Signed-off-by: Jose E. Marchesi <jemarch@gnu.org>
gcc/algol68/ChangeLog

* a68.h: Prototypes for a68_get_file_size and a68_file_read.
* a68-parser-scanner.cc (a68_file_size): New function.
(a68_file_read): Renamed from io_read.
(get_source_size): Deleted function.
(include_files): Use a68_file_size and a68_file_read.

9 days agoa68: fix dump of encoded string mode
Mohammad-Reza Nabipoor [Mon, 15 Dec 2025 02:27:38 +0000 (03:27 +0100)] 
a68: fix dump of encoded string mode

Signed-off-by: Mohammad-Reza Nabipoor <mnabipoor@gnu.org>
gcc/algol68/ChangeLog

* a68-imports.cc (dump_encoded_mode): Replace "basic" with
"string".

9 days agoxtensa: Improve usage of SALT/SALTU instructions
Takayuki 'January June' Suwa [Sun, 14 Dec 2025 13:08:38 +0000 (22:08 +0900)] 
xtensa: Improve usage of SALT/SALTU instructions

In the expansion of cstoresi4 insn patterns, LT[U] comparisons where the
second operand is an integer constant are canonicalized to LE[U] ones with
one less than the original.

     /* example */
     int test0(int a) {
       return a < 100;
     }
     unsigned int test1(unsigned int a) {
       return a <= 100u;
     }
     void test2(int a[], int b) {
       int i;
       for (i = 0; i < 16; ++i)
a[i] = (a[i] <= b);
     }

     ;; before (TARGET_SALT)
     test0:
      entry sp, 32
      movi a8, 0x63
      salt a2, a8, a2
      addi.n a2, a2, -1 ;; unwanted inverting
      neg a2, a2 ;;
      retw.n
     test1:
      entry sp, 32
      movi a8, 0x64
      saltu a2, a8, a2
      addi.n a2, a2, -1 ;; unwanted inverting
      neg a2, a2 ;;
      retw.n
     test2:
      entry sp, 32
      movi.n a9, 0x10
      loop a9, .L5_LEND
     .L5:
      l32i.n a8, a2, 0
      salt a8, a3, a8
      addi.n a8, a8, -1 ;; immediate cannot be hoisted out
      neg a8, a8
      s32i.n a8, a2, 0
      addi.n a2, a2, 4
      .L5_LEND:
      retw.n

This patch reverts such canonicalization by adding 1 to the comparison value
and then converting it back from LE[U] to LT[U], which better matches the
output machine instructions.  This patch also makes it easier to benefit
from other optimizations such as CSE, constant propagation, or loop-invariant
hoisting by XORing the result with a register that has a value of 1, rather
than subtracting 1 and then negating the sign to invert the truth of the
result.

     ;; after (TARGET_SALT)
     test0:
      entry sp, 32
      movi a8, 0x64
      salt a2, a2, a8
      retw.n
     test1:
      entry sp, 32
      movi a8, 0x65
      saltu a2, a2, a8
      retw.n
     test2:
      entry sp, 32
      movi.n a10, 1 ;; hoisted out
      movi.n a9, 0x10
      loop a9, .L5_LEND
     .L5:
      l32i.n a8, a2, 0
      salt a8, a3, a8
      xor a8, a8, a10
      s32i.n a8, a2, 0
      addi.n a2, a2, 4
      .L5_LEND:
      retw.n

gcc/ChangeLog:

* config/xtensa/xtensa.cc (xtensa_expand_scc_SALT):
New sub-function that emits the SALT/SALTU instructions.
(xtensa_expand_scc): Change the part related to the SALT/SALTU
instructions to a call to the above sub-function.

9 days agoxtensa: Remove variables only used to pass the return of end_sequence()
Takayuki 'January June' Suwa [Sun, 14 Dec 2025 13:04:43 +0000 (22:04 +0900)] 
xtensa: Remove variables only used to pass the return of end_sequence()

As a result of the automatic replacement by commit 4dd13988c93c24ba3605f4b9cafc97515c34f2ac,
there are several code fragments that receive the return value of
end_sequence() and immediately use it as the return value of the function
itself.

   rtx_insn *insn;
   ...
   insn = end_sequence ();
   return insn;

It is clear that in such cases, it would be more natural to pass the return
value of end_sequence() directly to the return statement without passing it
through a variable.

Applying this patch naturally does not change any functionality.

gcc/ChangeLog:

* config/xtensa/xtensa.cc
(xtensa_expand_block_set_libcall,
xtensa_expand_block_set_unrolled_loop,
xtensa_expand_block_set_small_loop, xtensa_call_tls_desc):
Change the return statement to pass the return value of
end_sequence() directly without going through a variable, and
remove the definition of that variable.

9 days agotestsuite/123137 - fix FAIL of g++.dg/vect/pr64410.cc on i?86
Richard Biener [Tue, 16 Dec 2025 12:08:19 +0000 (13:08 +0100)] 
testsuite/123137 - fix FAIL of g++.dg/vect/pr64410.cc on i?86

The following works around SRA not being able to decompose an
aggregate copy of std::complex because with x87 math ld/st pairs
are not bit-preserving by adding -msse -mfpmath=sse.  This avoids
spurious failures of the testcase.

PR testsuite/123137
* g++.dg/vect/pr64410.cc: Add -mfpmath=sse -msse on x86.

9 days agotestsuite: i386: Skip gcc.target/i386/shift-gf2p8affine-2.c on Solaris with as
Rainer Orth [Tue, 16 Dec 2025 12:02:04 +0000 (13:02 +0100)] 
testsuite: i386: Skip gcc.target/i386/shift-gf2p8affine-2.c on Solaris with as

The gcc.target/i386/shift-gf2p8affine-2.c test FAILs on Solaris with the
native assembler:

FAIL: gcc.target/i386/shift-gf2p8affine-2.c (test for excess errors)
UNRESOLVED: gcc.target/i386/shift-gf2p8affine-2.c compilation failed to produce executable

Excess errors:
Assembler: shift-gf2p8affine-2.c
        "/var/tmp//ccZMQ1Ad.s", line 30 : Illegal mnemonic
        Near line: "    vgf2p8affineqb  $0, %zmm1, %zmm0, %zmm0"
        "/var/tmp//ccZMQ1Ad.s", line 30 : Syntax error

Thus this patch only runs the test when gas is in use.

Tested on i386-pc-solaris2.11 (as and gas) and x86_64-pc-linux-gnu.

2025-12-15  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

gcc/testsuite:
* gcc.target/i386/shift-gf2p8affine-2.c: Skip on Solaris
without gas.

9 days agoaarch64: Add memtag-stack tests
Claudiu Zissulescu [Tue, 16 Dec 2025 08:19:25 +0000 (10:19 +0200)] 
aarch64: Add memtag-stack tests

Add basic tests for memtag-stack sanitizer.  Memtag stack sanitizer
uses target hooks to emit AArch64 specific MTE instructions.

gcc/testsuite:

* gcc.target/aarch64/memtag/alloca-1.c: New test.
* gcc.target/aarch64/memtag/alloca-2.c: New test.
* gcc.target/aarch64/memtag/alloca-3.c: New test.
* gcc.target/aarch64/memtag/arguments-1.c: New test.
* gcc.target/aarch64/memtag/arguments-2.c: New test.
* gcc.target/aarch64/memtag/arguments-3.c: New test.
* gcc.target/aarch64/memtag/arguments-4.c: New test.
* gcc.target/aarch64/memtag/arguments.c: New test.
* gcc.target/aarch64/memtag/basic-1.c: New test.
* gcc.target/aarch64/memtag/basic-3.c: New test.
* gcc.target/aarch64/memtag/basic-struct.c: New test.
* gcc.target/aarch64/memtag/large-array.c: New test.
* gcc.target/aarch64/memtag/local-no-escape.c: New test.
* gcc.target/aarch64/memtag/memtag.exp: New file.
* gcc.target/aarch64/memtag/no-sanitize-attribute.c: New test.
* gcc.target/aarch64/memtag/value-init.c: New test.
* gcc.target/aarch64/memtag/vararray-gimple.c: New test.
* gcc.target/aarch64/memtag/vararray.c: New test.
* gcc.target/aarch64/memtag/zero-init.c: New test.
* gcc.target/aarch64/memtag/texec-1.c: New test.
* gcc.target/aarch64/memtag/texec-2.c: New test.
* gcc.target/aarch64/memtag/texec-3.c: New test.
* gcc.target/aarch64/memtag/vla-1.c: New test.
* gcc.target/aarch64/memtag/vla-2.c: New test.
* lib/target-supports.exp (check_effective_target_aarch64_mte):
New function.

Co-authored-by: Indu Bhagat <indu.bhagat@oracle.com>
Signed-off-by: Claudiu Zissulescu <claudiu.zissulescu-ianculescu@oracle.com>
9 days agoaarch64: Add support for memetag-stack sanitizer using MTE insns
Claudiu Zissulescu [Tue, 16 Dec 2025 08:15:23 +0000 (10:15 +0200)] 
aarch64: Add support for memetag-stack sanitizer using MTE insns

MEMTAG sanitizer, which is based on the HWASAN sanitizer, will invoke
the target-specific hooks to create a random tag, add tag to memory
address, and finally tag and untag memory.

Implement the target hooks to emit MTE instructions if MEMTAG sanitizer
is in effect.  Continue to use the default target hook if HWASAN is
being used.  Following target hooks are implemented:
   - TARGET_MEMTAG_INSERT_RANDOM_TAG
   - TARGET_MEMTAG_ADD_TAG
   - TARGET_MEMTAG_EXTRACT_TAG

Apart from the target-specific hooks, set the following to values
defined by the Memory Tagging Extension (MTE) in aarch64:
   - TARGET_MEMTAG_TAG_BITSIZE
   - TARGET_MEMTAG_GRANULE_SIZE

The next instructions were (re-)defined:
   - addg/subg (used by TARGET_MEMTAG_ADD_TAG and
     TARGET_MEMTAG_COMPOSE_OFFSET_TAG hooks)
   - stg/st2g Used to tag/untag a memory granule.
   - tag_memory A target specific instruction, it will will emit MTE
     instructions to tag/untag memory of a given size.
   - compose_tag A target specific instruction that computes a tagged
     address as an offset from a base (tagged) address.
   - gmi Used for randomizing the inserting tag.
   - irg Likewise.

gcc/

* config/aarch64/aarch64.md (addg): Update pattern to use
addg/subg instructions.
(stg): Update pattern.
(st2g): New pattern.
(tag_memory): Likewise.
(compose_tag): Likewise.
(irq): Update pattern to accept xzr register.
(gmi): Likewise.
(UNSPECV_TAG_SPACE): Define.
* config/aarch64/aarch64.cc (AARCH64_MEMTAG_GRANULE_SIZE):
Define.
(AARCH64_MEMTAG_TAG_BITSIZE): Likewise.
(aarch64_override_options_internal): Error out if MTE instructions
are not available.
(aarch64_post_cfi_startproc): Emit .cfi_mte_tagged_frame.
(aarch64_can_tag_addresses): Add MEMTAG specific handling.
(aarch64_memtag_tag_bitsize): New function
(aarch64_memtag_granule_size): Likewise.
(aarch64_memtag_insert_random_tag): Likwise.
(aarch64_memtag_add_tag): Likewise.
(aarch64_memtag_extract_tag): Likewise.
(aarch64_granule16_memory_address_p): Likewise.
(aarch64_emit_stxg_insn): Likewise.
(aarch64_memtag_tag_memory_via_loop): New definition.
(aarch64_expand_tag_memory): Likewise.
(aarch64_check_memtag_ops): Likewise.
(TARGET_MEMTAG_TAG_BITSIZE): Likewise.
(TARGET_MEMTAG_GRANULE_SIZE): Likewise.
(TARGET_MEMTAG_INSERT_RANDOM_TAG): Likewise.
(TARGET_MEMTAG_ADD_TAG): Likewise.
(TARGET_MEMTAG_EXTRACT_TAG): Likewise.
* config/aarch64/aarch64-builtins.cc
(aarch64_expand_builtin_memtag): Update set tag builtin logic.
* config/aarch64/aarch64-linux.h: Pass memtag-stack sanitizer
specific options to the linker.
* config/aarch64/aarch64-protos.h
(aarch64_granule16_memory_address_p): New prototype.
(aarch64_check_memtag_ops): Likewise.
(aarch64_expand_tag_memory): Likewise.
* config/aarch64/constraints.md (Umg): New memory constraint.
(Uag): New constraint.
(Ung): Likewise.
* config/aarch64/predicates.md (aarch64_memtag_tag_offset):
Refactor it.
(aarch64_granule16_imm6): Rename from aarch64_granule16_uimm6 and
refactor it.
(aarch64_granule16_memory_operand): New constraint.
* config/aarch64/iterators.md (MTE_PP): New code iterator to be
used for mte instructions.
(stg_ops): New code attributes.
(st2g_ops): Likewise.
(mte_name): Likewise.
* config/aarch64/aarch64.opt (aarch64-tag-memory-loop-threshold):
New parameter.
* doc/invoke.texi: Update documentation.

gcc/testsuite:

* gcc.target/aarch64/acle/memtag_1.c: Update test.

Co-authored-by: Indu Bhagat <indu.bhagat@oracle.com>
Signed-off-by: Claudiu Zissulescu <claudiu.zissulescu-ianculescu@oracle.com>
9 days agoasan: memtag-stack add support for MTE instructions
Claudiu Zissulescu [Wed, 9 Jul 2025 12:53:38 +0000 (15:53 +0300)] 
asan: memtag-stack add support for MTE instructions

Memory tagging is used for detecting memory safety bugs.  On AArch64, the
memory tagging extension (MTE) helps in reducing the overheads of memory
tagging:
 - CPU: MTE instructions for efficiently tagging and untagging memory.
 - Memory: New memory type, Normal Tagged Memory, added to the Arm
   Architecture.

The MEMory TAGging (MEMTAG) sanitizer uses the same infrastructure as
HWASAN.  MEMTAG and HWASAN are both hardware-assisted solutions, and
rely on the same sanitizer machinery in parts.  So, define new
constructs that allow MEMTAG and HWASAN to share the infrastructure:

  - hwassist_sanitize_p () is true when either SANITIZE_MEMTAG or
    SANITIZE_HWASAN is true.
  - hwassist_sanitize_stack_p () is when hwassist_sanitize_p () and
    stack variables are to be sanitized.

MEMTAG and HWASAN do have differences, however, and hence, the need to
conditionalize using memtag_sanitize_p () in the relevant places. E.g.,

  - Instead of generating the libcall __hwasan_tag_memory, MEMTAG needs
    to invoke the target-specific hook TARGET_MEMTAG_TAG_MEMORY to tag
    memory.  Similar approach can be seen for handling
    handle_builtin_alloca, where instead of doing the gimple
    transformations, target hooks are used.

  - Add a new internal function HWASAN_ALLOCA_POISON to handle
    dynamically allocated stack when MEMTAG sanitizer is enabled. At
    expansion, this allows to, in turn, invoke target-hooks to increment
    tag, and use the generated tag to finally tag the dynamically allocated
    memory.

    The usual pattern:
        irg     x0, x0, x0
        subg    x0, x0, #16, #0
    creates a tag in x0 and so on.  For alloca, we need to apply the
    generated tag to the new sp.  In absense of an extract tag insn, the
    implemenation in expand_HWASAN_ALLOCA_POISON resorts to invoking irg
    again.

gcc/
* asan.cc (handle_builtin_stack_restore): Accommodate MEMTAG
sanitizer.
(handle_builtin_alloca): Expand differently if MEMTAG sanitizer.
(get_mem_refs_of_builtin_call): Include MEMTAG along with
HWASAN.
(memtag_sanitize_stack_p): New definition.
(memtag_sanitize_allocas_p): Likewise.
(memtag_memintrin): Likewise.
(hwassist_sanitize_p): Likewise.
(hwassist_sanitize_stack_p): Likewise.
(report_error_func): Include MEMTAG along with HWASAN.
(build_check_stmt): Likewise.
(instrument_derefs): MEMTAG too does not deal with globals yet.
(instrument_builtin_call): Include MEMTAG along with HWASAN.
(maybe_instrument_call): Likewise.
(asan_expand_mark_ifn): Likewise.
(asan_expand_check_ifn): Likewise.
(asan_expand_poison_ifn): Expand differently if MEMTAG sanitizer.
(asan_instrument): Include MEMTAG along with HWASAN.
(hwasan_emit_prologue): Expand differently if MEMTAG sanitizer.
(hwasan_emit_untag_frame): Likewise.
* asan.h (memtag_sanitize_stack_p): New declaration.
(memtag_sanitize_allocas_p): Likewise.
(hwassist_sanitize_p): Likewise.
(hwassist_sanitize_stack_p): Likewise.
(asan_sanitize_use_after_scope): Include MEMTAG along with
HWASAN.
* cfgexpand.cc (align_local_variable): Likewise.
(expand_one_stack_var_at): Likewise.
(expand_stack_vars): Likewise.
(expand_one_stack_var_1): Likewise.
(init_vars_expansion): Likewise.
(expand_used_vars): Likewise.
(pass_expand::execute): Likewise.
* gimplify.cc (asan_poison_variable): Likewise.
* internal-fn.cc (expand_HWASAN_ALLOCA_POISON): New definition.
(expand_HWASAN_ALLOCA_UNPOISON): Expand differently if MEMTAG
sanitizer.
(expand_HWASAN_MARK): Likewise.
* internal-fn.def (HWASAN_ALLOCA_POISON): Define new.
* params.opt: Document new param.
* sanopt.cc (pass_sanopt::execute): Include MEMTAG along with
HWASAN.
* gcc.cc (sanitize_spec_function): Add check for memtag-stack.
* doc/tm.texi: Regenerate.
* target.def (extract_tag): Update documentation.
(add_tag): Likewise.
(insert_random_tag): Likewise.

Co-authored-by: Indu Bhagat <indu.bhagat@oracle.com>
Signed-off-by: Claudiu Zissulescu <claudiu.zissulescu-ianculescu@oracle.com>
9 days agoasan: add new memtag sanitizer
Indu Bhagat [Wed, 9 Jul 2025 12:33:14 +0000 (15:33 +0300)] 
asan: add new memtag sanitizer

Add new command line option -fsanitize=memtag-stack with the following
new params:
--param memtag-instrument-alloca [0,1] (default 1) to use MTE insns
for enabling dynamic checking of stack allocas.

Along with the new SANITIZE_MEMTAG_STACK, define a SANITIZE_MEMTAG
which will be set if any kind of memtag sanitizer is in effect (e.g.,
later we may add -fsanitize=memtag-globals).  Add errors to convey
that memtag sanitizer does not work with hwaddress and address
sanitizers.  Also error out if memtag ISA extension is not enabled.

MEMTAG sanitizer will use the HWASAN machinery, but with a few
differences:
  - The tags are always generated at runtime by the hardware, so
    -fsanitize=memtag-stack enforces a --param hwasan-random-frame-tag=1

Add documentation in gcc/doc/invoke.texi.

gcc/
* builtins.def: Adjust the macro to include the new
SANTIZIE_MEMTAG_STACK.
* flag-types.h (enum sanitize_code): Add new enumerator for
SANITIZE_MEMTAG and SANITIZE_MEMTAG_STACK.
* opts.cc (finish_options): memtag-stack sanitizer conflicts with
hwaddress and address sanitizers.
(sanitizer_opts): Add new memtag-stack sanitizer.
(parse_sanitizer_options): memtag-stack sanitizer cannot recover.
* params.opt: Add new params for memtag-stack sanitizer.
* doc/invoke.texi: Update documentation.

Signed-off-by: Claudiu Zissulescu <claudiu.zissulescu-ianculescu@oracle.com>
Co-authored-by: Claudiu Zissulescu <claudiu.zissulescu-ianculescu@oracle.com>
9 days agotarget-insns.def: (compose_tag) New pattern.
Claudiu Zissulescu [Wed, 27 Aug 2025 14:38:49 +0000 (17:38 +0300)] 
target-insns.def: (compose_tag) New pattern.

Add a new target instruction used by hardware-assisted sanitizers on
architectures providing memory-tagging instructions. This instruction
is used to compute assign tags at a fixed offset from a tagged address
base. For example, in AArch64 case, this pattern instantiate `addg`
instruction.

gcc/
* target-insns.def (compose_tag): New target instruction.
* doc/md.texi (compose_tag): Add documentation.

Signed-off-by: Claudiu Zissulescu <claudiu.zissulescu-ianculescu@oracle.com>
9 days agotarget-insns.def: (tag_memory) New pattern.
Claudiu Zissulescu [Wed, 9 Jul 2025 11:46:38 +0000 (14:46 +0300)] 
target-insns.def: (tag_memory) New pattern.

Add a new target instruction. Hardware-assisted sanitizers on
architectures providing instructions to tag/untag memory can then
make use of this new instruction pattern. For example, the
memtag-stack sanitizer uses these instructions to tag and untag a
memory granule.

gcc/
* target-insns.def (tag_memory): New target instruction.
* doc/md.texi (tag_memory): Add documentation.

Signed-off-by: Claudiu Zissulescu <claudiu.zissulescu-ianculescu@oracle.com>
9 days agoAArch64: Enable dispatch scheduling for Olympus core.
Jennifer Schmitz [Tue, 21 Oct 2025 07:33:00 +0000 (00:33 -0700)] 
AArch64: Enable dispatch scheduling for Olympus core.

This patch enables dispatch scheduling for the NVIDIA Olympus core.
The dispatch constraints are based on the Olympus CPU Core Software
Optimization Guide
(https://docs.nvidia.com/olympus-cpu-core-software-optimization-guide-dp12531-001v0-7.pdf).

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

Signed-off-by: Jennifer Schmitz <jschmitz@nvidia.com>
gcc/
* config/aarch64/aarch64.md: Include olympus.md.
* config/aarch64/olympus.md: New file.
* config/aarch64/tuning_models/olympus.h: Add dispatch
constraints and enable dispatch scheduling.

9 days agoHaifa scheduler: Prevent splitting of fusion pairs in dispatch scheduling
Maxim Kuvyrkov [Mon, 15 Dec 2025 15:36:10 +0000 (16:36 +0100)] 
Haifa scheduler: Prevent splitting of fusion pairs in dispatch scheduling

gcc/Changelog

* haifa-sched.cc (choose_ready): Don't require dfa_lookahead <= 0
to schedule SCHED_GROUP_P insns first.

9 days agoipa/122456 - fix ICE during LTO profiledbootstrap
Richard Biener [Mon, 8 Dec 2025 09:25:21 +0000 (10:25 +0100)] 
ipa/122456 - fix ICE during LTO profiledbootstrap

When we have a speculated edge but we folded the call to
__builtin_unreachable () then trying to update the cgraph ICEs
in resolve_speculation because there's no symtab node for
__builtin_unreachable (). Reject this resolving attempt similar
as to when the callees decl were NULL or it were not semantically
equivalent.

I only have a LTRANS unit as testcase.

PR ipa/122456
* cgraph.cc (cgraph_edge::resolve_speculation): Handle
a NULL symtab_node::get (callee_decl).

9 days agocleanupcfg: Reject forwarder blocks where dest is eh landing pad or a non-local dest...
Andrew Pinski [Sun, 14 Dec 2025 00:23:33 +0000 (16:23 -0800)] 
cleanupcfg: Reject forwarder blocks where dest is eh landing pad or a non-local dest [PR123110]

r16-5250-g88db06d7da393f901 changed which block was doing the
check on the label being a non-local dest or an eh landing pad.
Which is fine except then when we move labels we moved them to
before the label for the non-local dest/eh landing pad.
This can be fixed a few different ways.
Add back the check for the dest block or change where the other
labels are placed.
Since this case does not happen enough to care either way, I added
back the check for the dest block. This means there is no changes
from GCC 15 to now.

Bootstrapped and tested on x86_64-linux-gnu.

PR tree-optimization/123110

gcc/ChangeLog:

* tree-cfgcleanup.cc (maybe_remove_forwarder_block): Add back
check for eh landing pad or non-local dest on the dest.

gcc/testsuite/ChangeLog:

* gcc.dg/pr123110-1.c: New test.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
9 days agofinal_cleanup: Don't create forwarder blocks for degenerate_phis that are ifconvertab...
Andrew Pinski [Sun, 14 Dec 2025 04:48:51 +0000 (20:48 -0800)] 
final_cleanup: Don't create forwarder blocks for degenerate_phis that are ifconvertable [PR123111]

So it turns out creating a forwarder block in some cases causes a regression.
The rtl ifcvt does like the case were the middle bb does not have a single predecessor.
So in some cases ifcvt does not happen any more. So the way to fix this
is not to create a forwarder block for those edges which causes out of ssa to
create a middle bb which has the constant or the copy in it.

I tried to do a simple ifcvt on the gimple level with the last phiopt but
that introduces regressions as then `v += cmp - 43;` is not optimized
and produces an extra subtraction. This is the best workaround I could come up
with until that is fixed. I filed PR 123116 for that issue.

Bootstrapped and tested on x86_64-linux-gnu.

PR tree-optimization/123111
gcc/ChangeLog:

* tree-cfg.cc (ifconvertable_edge): New function.
(make_forwarders_with_degenerate_phis): Add skip_ifcvtable argument,
check ifconvertable_edge if skip_ifcvtable is true.
* tree-cfg.h (make_forwarders_with_degenerate_phis): New argument
with default of false.
* tree-cfgcleanup.cc (execute_cleanup_cfg_post_optimizing): Update
argument to make_forwarders_with_degenerate_phis.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
9 days agoDaily bump.
GCC Administrator [Tue, 16 Dec 2025 00:16:36 +0000 (00:16 +0000)] 
Daily bump.

9 days agoipa-devirt: Add speculative direct calls based on stores to structures
Martin Jambor [Mon, 15 Dec 2025 23:44:45 +0000 (00:44 +0100)] 
ipa-devirt: Add speculative direct calls based on stores to structures

This patch extends the ipa-devirt pass with the ability to add
speculative calls for indirect calls where the target was loaded from
a record_type data structure and we have seen writes of address of
only one particular function to the same offset of that record
type (including static initializers).

The idea is basically taken from Christoph Müllner's patch from 2022
(https://gcc.gnu.org/pipermail/gcc-patches/2022-November/605934.html)
but I have re-worked it so that it stores the required information in
GC memory (which I belive is necessary) and does not require an
additional pass through gimple statements of all functions because it
uses the analysis phase of ipa-cp/ipa-fnsummary (which was an approach
we agreed on with Honza).

It also performs simple verification that the collected types match
the type of the record field.  We could verify that the function
determined as the likely target matches the call statement
expectations, but for that we would need to stream both types which is
something I decided not to do.

Co-authored by: Christoph Müllner <christoph.muellner@vrull.eu>

gcc/ChangeLog:

2025-11-28  Martin Jambor  <mjambor@suse.cz>

PR ipa/107666
* common.opt (fspeculatively-call-stored-functions): New.
* cgraph.h (cgraph_simple_indirect_info): New fields rec_type and
fld_offset.
* ipa-prop.h (ipa_analyze_var_static_initializer): Declare.
(ipa_dump_noted_record_fnptrs): Likewise.
(ipa_debug_noted_record_fnptrs): Likewise.
(ipa_single_noted_fnptr_in_record): Likewise.
(ipa_free_noted_fnptr_calls): Likewise.
* ipa-cp.cc (ipcp_generate_summary): Call
ipa_analyze_var_static_initializer on each varbool node with a static
initializer.
* ipa-devirt.cc (struct devirt_stats): New type.
(devirt_target_ok_p): New function.
(ipa_devirt): Move statistics counters to the new structure.  dump
noted function pointers stored in records.  Check for edge hotness
first and for odr_types only for polymorphic edges.  Moved a number of
checks to devirt_target_ok_p.  Also add speculative direct calls for
non-polymorphic indirect ones when ipa_single_noted_fnptr_in_record
finds a likely target.  Call ipa_free_noted_fnptr_calls.
(pass_ipa_devirt::gate): Also check the new flag.
* ipa-prop.cc (noted_fnptr_store): New type.
(struct noted_fnptr_hasher): Likewise.
(noted_fnptr_hasher::hash): New function.
(noted_fnptr_hasher::equal): Likewise.
(noted_fnptrs_in_records): New.
(is_func_ptr_from_record): New function.
(ipa_analyze_indirect_call_uses): Also simple create indirect info
structures with fnptr_loaded_from_record set.
(note_fnptr_in_record): New function.
(ipa_dump_noted_record_fnptrs): Likewise.
(ipa_debug_noted_record_fnptrs): Likewise.
(ipa_single_noted_fnptr_in_record): Likewise.
(ipa_free_noted_fnptr_calls): Likewise.
(ipa_analyze_stmt_uses): Also look for stroes of function pointers to
record structures.
(ipa_analyze_var_static_initializer): New function.
(ipa_write_indirect_edge_info): Also stream fnptr_loaded_from_record
indirec infos.
(ipa_read_indirect_edge_info): Likewise.
(ipa_prop_write_jump_functions): Also stream the contents of
noted_fnptrs_in_records.
(ipa_prop_read_section): Likewise.
* opts.cc (default_options_table): Also turn on
OPT_fspeculatively_call_stored_functions at -O2.
(common_handle_option): Turn flag_speculatively_call_stored_functions
when using profile feedback.
* doc/invoke.texi (-fspeculatively-call-stored-functions): New.

gcc/testsuite/ChangeLog:

2025-10-24  Martin Jambor  <mjambor@suse.cz>

* gcc.dg/lto/fnptr-from-rec-1_0.c: New test.
* gcc.dg/lto/fnptr-from-rec-1_1.c: Likewise.
* gcc.dg/lto/fnptr-from-rec-2_0.c: Likewise.
* gcc.dg/lto/fnptr-from-rec-2_1.c: Likewise.
* gcc.dg/lto/fnptr-from-rec-3_0.c: Likewise.
* gcc.dg/lto/fnptr-from-rec-3_1.c: Likewise.

9 days agocgraph: cgraph_indirect_call_info into a class hierachy
Martin Jambor [Mon, 15 Dec 2025 23:44:45 +0000 (00:44 +0100)] 
cgraph: cgraph_indirect_call_info into a class hierachy

Currently, an instance of cgraph_indirect_call_info is allocated for
each indirect call and it contains fields which are only usable for
some kinds of calls.  The most special are polymorphic calls
representing calls of virtual methods through an OBJ_TYPE_REF and
which need the ipa_polymorphic_context structure, among other data from
the O_T_R itself for devirtualization, which are not needed for other
types of calls.

This patch splits the class into three.  A common base which is also
used for calls which we know we cannot do anything about (when the
call statement is not known or when it is a constant integer or
something like that), a (simple) type for calls of SSA_NAMEs and a
type for polymorphic calls.  This means we no longer allocate memory
for members which we do not need in a particular situation.  Part of
the motivation to write this is also that I have a patch adding fields
to the simple variant and this reorganization makes it doable in a
clean fashion.

The base class retains the param_index field even though it really only
is meaningful in the derived classes.  This made conversion of some of
the functions operating on it easier (and I expect that vast majority
of actual instances will fall into one of the two categories anyway).

We already stream information stored in indirect information at two
places, once in call graph streaming and once in ipa-prop streaming.
I am not sure what the reason is (call graph streaming cannot do trees
so we need the ipa-prop one) but this patch preserves this.

The patch also removes a part of the comment in
ipa_make_edge_direct_to_target which said the check for member_ptr was
not necessary.  We even have a test in our testsuite showing it is and
we produce wrong code without it.

gcc/ChangeLog:

2025-10-17  Martin Jambor  <mjambor@suse.cz>

* cgraph.h (cgraph_node): Adjust the comment of member function
create_indirect_edge.
(enum cgraph_indirect_info_kind): New.
(cgraph_indirect_call_info): Convert into a base class.
(cgraph_simple_indirect_info): New.
(cgraph_polymorphic_indirect_info): Likewise.
(usable_polymorphic_info_p): Likewise.
(is_a_helper <cgraph_simple_indirect_info *>::test): Likewise.
(is_a_helper <cgraph_polymorphic_indirect_info *>::test): Likewise.
(cgraph_allocate_init_indirect_info): Remove declaration.
(ipa_polymorphic_call_context::ipa_polymorphic_call_context): Use the
appropriate derived type of indirect info.
* cgraph.cc (cgraph_allocate_init_indirect_info): Removed.
(cgraph_node::create_indirect_edge): Create an appropriate type of
indirect_info.
(cgraph_node::dump): Dump indirect info using its dump function.
(cgraph_indirect_call_info::dump): New function.
(cgraph_indirect_call_info::debug): Likewise.
* cgraphclones.cc (cgraph_edge::clone): Create an appropriate type of
indirect_info.
* cgraphunit.cc (analyze_functions): Use the appropriate derived type
of indirect info.
* ipa-cp.cc (initialize_node_lattices): Adjust the check for
polymorphic indirect info.
(ipa_get_indirect_edge_target_1): Use the appropriate derived types of
indirect info.
(ipcp_discover_new_direct_edges): Likewise.
* ipa-devirt.cc (ipa_devirt): Use the polymorphis derived type of
indirect info and check that it is usable.
* ipa-inline.cc (dump_inline_stats): Adjust the check for polymorphic
indirect info.
* ipa-profile.cc (ipa_profile): Likewise and check usability.
* ipa-prop.cc (ipa_print_node_jump_functions): Dump indirect info
using its dumping member function.
(ipa_note_param_call): Removed.
(ipa_analyze_indirect_call_uses): Use the appropriate derived type of
indirect info, set all fields of indirect info separately rather than
relying on ipa_note_param_call.
(ipa_analyze_virtual_call_uses): Use the polymorphis derived type of
indirect info and check that it is usable, set all fields of indirect
info separately rather than relying on ipa_note_param_call.
(ipa_analyze_call_uses): Use the appropriate derived type of indirect
info.
(ipa_make_edge_direct_to_target): Use the appropriate derived type of
indirect info.  Remove wrong note that member_ptr check was not
needed.  Adjust check for polymorphic call when dumping.
(try_make_edge_direct_simple_call): Use the appropriate derived type
of indirect info.
(try_make_edge_direct_virtual_call): Use the polymorphis derived type
of indirect info and check that it is usable.
(update_indirect_edges_after_inlining): Use the appropriate derived
type of indirect info.  Define local variables only before their first
use.
(ipa_write_indirect_edge_info): Also stream indirect info kind.  Use
the appropriate derived type of indirect info.
(ipa_read_indirect_edge_info): Check that the streamed in indirect
info kind matches rthe structure at hand.  Use the appropriate derived
type of indirect info.
* ipa-utils.h (possible_polymorphic_call_targets): Use the
polymorphis derived type of indirect info.  Assert it is usable.
(dump_possible_polymorphic_call_targets): Use the polymorphis
derived type of indirect info and check it is usable.
(possible_polymorphic_call_target_p): Likewise.
* ipa.cc (symbol_table::remove_unreachable_nodes): Use
usable_polymorphic_info_p.
* lto-cgraph.cc (lto_output_edge): Stream indirect info kind.
(compute_ltrans_boundary): Use usable_polymorphic_info_p.
(input_edge): Move definition of ecf_flags before its first use.
Pass true as the last parameter to create_indirect_edge.  Stream
indirect info kind and create a corresponding type to hold the
information.
* trans-mem.cc (ipa_tm_insert_gettmclone_call): Use the
polymorphis derived type of indirect info.

9 days agogengtype: Avoid Werror bootstrap fail when a subclass has no GTY fields
Martin Jambor [Mon, 15 Dec 2025 23:44:44 +0000 (00:44 +0100)] 
gengtype: Avoid Werror bootstrap fail when a subclass has no GTY fields

In a follow-up patch, I have created a GTYed subclass which does not
have any garbage collectible fields, just integers (a "sibling"
subclass does).  This leads to gengtype outputting code like this to
gtype-desc.cc:

   2722         case CIIK_SIMPLE:
   2723           {
   2724             cgraph_simple_indirect_info *sub = static_cast <cgraph_simple_indirect_info *> (x);
   2725           }
   2726           break;

And because in stage2 of our bootstrap we compile the file with -Wall
-Werror, this leads to a bootstrap failure because of
-Werror=unused-variable.

I have briefly looked into building that particular file with
-Wno-error but did not found a simple way to do that, at least not
yet.

So instead this patch generates statement "(void) sub;" after each
such static_assert to avoid the warning in the first place.

gcc/ChangeLog:

2025-10-17  Martin Jambor  <mjambor@suse.cz>

* gengtype.cc (walk_subclasses): Avoid generating code with unused
variables.

9 days agoAda: Fix ICE when comparing reduction expression with integer constant
Eric Botcazou [Mon, 15 Dec 2025 23:23:56 +0000 (00:23 +0100)] 
Ada: Fix ICE when comparing reduction expression with integer constant

This a regression present on the mainline, 15 and 14 branches: the compiler
aborts on the comparison of the result of a reduction expression, whose
prefix is an aggregate, and an integer constant, because of a type mismatch
created by the resolution of the reduction expression, which unduly forces
Integer on the expression.

gcc/ada/
PR ada/123138
* sem_attr.adb (Resolve_Attribute) <Attribute_Reduce>: Override a
universal numeric type only if the prefix is not an aggregate.

gcc/testsuite/
* gnat.dg/reduce4.adb: New test.
* gnat.dg/reduce5.adb: Likewise.

9 days agoifcombine: Replace force_gimple_operand_gsi with gimple_build [PR122987]
Pengxuan Zheng [Thu, 11 Dec 2025 20:18:32 +0000 (12:18 -0800)] 
ifcombine: Replace force_gimple_operand_gsi with gimple_build [PR122987]

This makes the code a little cleaner and might speed up the compiler slightly.

Bootstrapped and tested on x86_64 and aarch64.

PR tree-optimization/122987

gcc/ChangeLog:

* tree-ssa-ifcombine.cc (ifcombine_ifandif): Replace
force_gimple_operand_gsi with gimple_build.

Signed-off-by: Pengxuan Zheng <pengxuan.zheng@oss.qualcomm.com>
9 days agoc++: avoid in-place modification of TYPENAME_TYPE
Patrick Palka [Mon, 15 Dec 2025 20:03:43 +0000 (15:03 -0500)] 
c++: avoid in-place modification of TYPENAME_TYPE

Since we have a TYPENAME_TYPE cache, through which equivalent
TYPENAME_TYPEs are reused, in-place modification of a TYPENAME_TYPE is
generally unsafe.  This is a latent issue noticed when attempting a
different approach to fix PR122752.

gcc/cp/ChangeLog:

* parser.cc (cp_parser_template_id): Rebuild instead of modifying
a TYPENAME_TYPE corresponding to a dependently-scoped template.

Reviewed-by: Jason Merrill <jason@redhat.com>
9 days agoc++: losslessly encode TYPENAME_TYPE tag
Patrick Palka [Mon, 15 Dec 2025 20:03:39 +0000 (15:03 -0500)] 
c++: losslessly encode TYPENAME_TYPE tag

We currently have 7 distinct tag_types, but our TYPENAME_TYPE
representation effectively only differentiates between 4 of them at the
expense of struct_type (which gets conflated with class_type),
none_type and scope_type (which get conflated with typename_type).

struct_type / class_type conflation is mostly harmless, but it
probably affects -Wmismatched-tags.  none_type / typename_type too
should be harmless.  But scope_type / typename_type conflation is
problematic because scope_type indicates a type-only lookup unlike
typename_type.

This patch makes our representation of TYPENAME_TYPE encode the numeric
tag type value losslessly using the first three adjacent tree flag bits.
We already use three flag bits for the tag encoding (but inefficiently)
so no additional space is needed.

gcc/cp/ChangeLog:

* cp-tree.h (TYPENAME_TYPE_TAG_BIT_0): New.
(TYPENAME_TYPE_TAG_BIT_1): New.
(TYPENAME_TYPE_TAG_BIT_2): New.
(TYPENAME_IS_ENUM_P): Use get_typename_tag.
(TYPENAME_IS_CLASS_P): Rename to ...
(TYPENAME_IS_CLASS_OR_STRUCT_P): ... this, and use
get_typename_tag.
(TYPENAME_IS_UNION_P): Use get_typename_tag.
(TYPENAME_IS_RESOLVING_P): Use TREE_LANG_FLAG_3
instead of _2.
(get_typename_tag): New.
(set_typename_tag): New.
(tag_name): Declare.
* decl.cc (typename_info): Replace bool fields with a single
tag_types field.
(typename_hasher::equal): Adjust.
(build_typename_type): Adjust.
(tag_name): Handle none_type and scope_type.
* error.cc (dump_type) <case TYPENAME_TYPE>: Use tag_name.
* module.cc (trees_out::type_node) <case TYPENAME_TYPE>: Use
get_typename_tag.
* pt.cc (tsubst) <case TYPENAME_TYPE>: Likewise.

Reviewed-by: Jason Merrill <jason@redhat.com>
9 days agoc++: restrict TYPE_POLYMORPHIC_P to class types
Patrick Palka [Mon, 15 Dec 2025 20:03:36 +0000 (15:03 -0500)] 
c++: restrict TYPE_POLYMORPHIC_P to class types

Since TYPE_POLYMORPHIC_P shares the same storage as other flags for
TYPENAME_TYPE and DECLTYPE_TYPE, we should avoid accidentally using
this accessor on those tree codes.  This patch restricts the accessor
to RECORD/UNION_TYPE which allows callers to conveniently guard any
uses with CLASS_TYPE_P.  Otherwise with the next patch applied that
rearranges TYPENAME_TYPE flags, noexcept_override_late_checks would
not skip over a TYPENAME_TYPE base for which TYPE_POLYMORPHIC_P
nonsensically returns true, leading to an eventual ICE.

gcc/cp/ChangeLog:

* cp-tree.h (CLASSTYPE_LAMBDA_EXPR): Check CLASS_TYPE_P before
inspecting TYPE_POLYMORPHIC_P.
(TYPE_POLYMORPHIC_P): Restrict to RECORD_TYPE or UNION_TYPE.
Document its use of TREE_LANG_FLAG_2.
* parser.cc (noexcept_override_late_checks): Only
check TYPE_POLYMORPHIC_P on CLASS_TYPE_P types.
* rtti.cc (build_headof): Likewise.
(get_tinfo_ptr_dynamic): Likewise.
(build_typeid): Likewise.

Reviewed-by: Jason Merrill <jason@redhat.com>
9 days agoFortran: Fix bad read involving extra input text.
Jerry DeLisle [Sun, 14 Dec 2025 21:23:36 +0000 (13:23 -0800)] 
Fortran: Fix bad read involving extra input text.

The problem here involved DTIO mixed with non-DTIO
variables in list formatted reads.  The previous fix to
PR105361 broke the test case here by mis-handling the
end of file conditions. It was found that the code could
be significantly reduced as well.

PR libfortran/122936

libgfortran/ChangeLog:

* io/list_read.c (finish_list_read): Remove the use of hit_eof
and free_line. Simplify the logic. Add comments to clarify.

gcc/testsuite/ChangeLog:

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

9 days agoc++: nested typename type resolving to wildcard type [PR122752]
Patrick Palka [Mon, 15 Dec 2025 19:30:53 +0000 (14:30 -0500)] 
c++: nested typename type resolving to wildcard type [PR122752]

Here typename A<S>::VertexSet::size_type within the out-of-line
declaration is initially parsed at namespace scope, so the LHS
A<S>::VertexSet is treated as a dependent name and represented as a
TYPENAME_TYPE with tag_type as class_type.[1]

Once we realize we're parsing a member declarator we call
maybe_update_decl_type to reprocess the TYPENAME_TYPE relative to the
class template scope, during which make_typename_type succeeds in
resolving the lookup and returns the member typedef VertexSet (to the
TEMPLATE_TYPE_PARM S).  But then the caller tsubst complains that this
result isn't a class type as per the tag_type.

This patch just relaxes tsubst to allow TYPENAME_TYPE getting resolved
to a wildcard type regardless of the tag_type.  This does mean we lose
information about the tag_type during a subsequent tsubst, but that's
probably harmless (famous last words).

[1]: The tag_type should probably be scope_type.  Changing this seems
to be a matter of changing cp_parser_qualifying_entity to pass
scope_type instead of class_type, but I don't feel confident about that
and it seems risky.  I then got confused as to why that function passes
none_type in the !type_p case; to me it should use scope_type
unconditionally, but doing so breaks things.  This approach seems safer
to backport.

PR c++/122752

gcc/cp/ChangeLog:

* pt.cc (tsubst) <case TYPENAME_TYPE>: Allow TYPENAME_TYPE
resolving to another wildcard type.

gcc/testsuite/ChangeLog:

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

Reviewed-by: Jason Merrill <jason@redhat.com>
9 days agoc++: delay noexcept parsing for templated friends [PR122668]
Patrick Palka [Mon, 15 Dec 2025 19:23:52 +0000 (14:23 -0500)] 
c++: delay noexcept parsing for templated friends [PR122668]

The r16-5425 workaround to delay current-instantiation name lookup
within a friend's noexcept-spec is unsound because it considers the
flag cp_noexcept_operand but that indicates a noexcept-expr, not a
noexcept-spec.  We don't currently have a flag for indicating a
noexcept-spec context (and I don't think we really want one).

This patch reverts that workaround and instead makes us properly
delay noexcept-spec parsing of templated friends, which should fully
address the regression since it's applicable only to ahead of time
name lookup at class template scope.  Delaying noexcept-spec parsing
of non-templated friends is trickier since it means we need to defer
declaration matching of such friends until after delayed parsing rather
than immediately matching.  In contrast, for templated friends we
naturally defer declaration matching until instantiation time, i.e.
well after delayed parsing.

PR c++/122668
PR c++/114764

gcc/cp/ChangeLog:

* parser.cc (cp_parser_class_specifier): Adjust after
changing the element type of unparsed_noexcepts.  Pass
the class type to noexcept_override_late_checks.
(cp_parser_member_declaration): Set
CP_PARSER_FLAGS_DELAY_NOEXCEPT also for templated friends.
(noexcept_override_late_checks): Add class_type parameter.
(cp_parser_single_declaration): Set
CP_PARSER_FLAGS_DELAY_NOEXCEPT also for template friends
at class template scope.
(cp_parser_save_default_args): Push current_class_type
to unparsed_noexcepts.
* parser.h (cp_unparsed_functions_entry::noexcepts):
Change element type to cp_default_arg_entry.
* pt.cc (dependentish_scope_p): Revert r16-5425 change.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/noexcept91a.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
10 days agolibgomp: Avoid -Waddress warning
Jakub Jelinek [Mon, 15 Dec 2025 18:08:06 +0000 (19:08 +0100)] 
libgomp: Avoid -Waddress warning

The function has assert (htab_find) with a comment that that is to
avoid -Wunused-function warning.  The problem is that it triggers
a different warning,
../../../libgomp/plugin/build-target-indirect-htab.h:68:3: warning: the address of ‘htab_find’ will always evaluate as ‘true’
(or error depending on exact flags).

This uses (void) htab_find instead to avoid any diagnostics.

2025-12-15  Jakub Jelinek  <jakub@redhat.com>

* plugin/build-target-indirect-htab.h (create_target_indirect_map):
Use (void) htab_find instead of assert (htab_find) to silence
-Werror=unused-function because the latter triggers -Werror=address.

10 days agotestsuite: Support plugin testing for installed compiler
Joseph Myers [Mon, 15 Dec 2025 17:58:20 +0000 (17:58 +0000)] 
testsuite: Support plugin testing for installed compiler

Plugin tests are currently only enabled for build-tree testing.
Enable them for installed testing as well, using
-print-file-name=plugin/include to locate the installed headers in
that case.

Support is also added to contrib/test_installed for the associated
site.exp settings.  Installed testing also shows up that some plugin
tests are using text-art/*.h headers that aren't currently installed,
so add those to PLUGIN_HEADERS.

Bootstrapped with no regressions for x86_64-pc-linux-gnu, and also ran
plugin tests for an installed compiler with contrib/test_installed.

contrib/
* test_installed (--enable-plugin, --with-plugincc=)
(--with-plugincflags=, --with-gmpinc=): New options.

gcc/
* Makefile.in (PLUGIN_HEADERS): Add $(srcdir)/text-art/*.h.
(install-plugin): Preserve directory structure for text-art
headers.

gcc/testsuite/
* lib/plugin-support.exp (plugin-test-execute): Support installed
testing.
* g++.dg/plugin/plugin.exp, gcc.dg/plugin/plugin.exp,
obj-c++.dg/plugin/plugin.exp, objc.dg/plugin/plugin.exp: Do not
disable for installed testing.

10 days agoanalyzer: fix strlen(STRING_CST + OFFSET) [PR123085]
David Malcolm [Mon, 15 Dec 2025 16:48:49 +0000 (11:48 -0500)] 
analyzer: fix strlen(STRING_CST + OFFSET) [PR123085]

gcc/analyzer/ChangeLog:
PR analyzer/123085
* region-model.cc (region_model::scan_for_null_terminator_1): Use
byte offset when accessing string constant.

gcc/testsuite/ChangeLog:
PR analyzer/123085
* c-c++-common/analyzer/strlen-pr123085.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
10 days agoanalyzer: fold X + (-X) to zero [PR122975]
David Malcolm [Mon, 15 Dec 2025 16:48:49 +0000 (11:48 -0500)] 
analyzer: fold X + (-X) to zero [PR122975]

gcc/analyzer/ChangeLog:
PR analyzer/122975
* region-model-manager.cc (region_model_manager::maybe_fold_binop): Fold
X + (-X) to zero.

gcc/testsuite/ChangeLog:
PR analyzer/122975
* c-c++-common/analyzer/arith-1.c: New test.
* c-c++-common/analyzer/infinite-recursion-pr122975.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
10 days agoaarch64: Add cortex-a320 core
Alfie Richards [Fri, 14 Nov 2025 13:17:57 +0000 (13:17 +0000)] 
aarch64: Add cortex-a320 core

gcc/ChangeLog:

* config/aarch64/aarch64-cores.def (cortex-a320): New core.
* config/aarch64/aarch64-tune.md: Regenerate.

10 days agovect: Add uncounted loop unit tests
Victor Do Nascimento [Mon, 1 Dec 2025 17:23:53 +0000 (17:23 +0000)] 
vect: Add uncounted loop unit tests

gcc/testsuite/ChangeLog:

* gcc.dg/vect/vect-early-break_40.c: Fix.
* gcc.dg/gomp/static-chunk-size-one.c: Likewise.
* gcc.dg/vect/vect-uncounted_1.c: New.
* gcc.dg/vect/vect-uncounted_2.c: Likewise.
* gcc.dg/vect/vect-uncounted_3.c: Likewise.
* gcc.dg/vect/vect-uncounted_4.c: Likewise.
* gcc.dg/vect/vect-uncounted_5.c: Likewise.
* gcc.dg/vect/vect-uncounted_6.c: Likewise.
* gcc.dg/vect/vect-uncounted_7.c: Likewise.
* gcc.dg/vect/vect-uncounted-run_1.c: Likewise.
* gcc.dg/vect/vect-uncounted-run_2.c: Likewise.
* gcc.dg/vect/vect-uncounted-run_3.c: Likewise.
* gcc.dg/vect/vect-uncounted-prolog-peel_1.c: Likewise.

10 days agovect: Relax known iteration number constraint
Victor Do Nascimento [Thu, 8 May 2025 14:28:05 +0000 (15:28 +0100)] 
vect: Relax known iteration number constraint

At present we reject uncounted loops outright when doing initial loop
analysis in `vect_analyze_loop_form'.

We have the following gating condition that causes rejection of a
given loop:

 if (integer_zerop (info->assumptions)
      || !info->number_of_iterations
      || chrec_contains_undetermined (info->number_of_iterations))

We can do away with this check altogether, but not without problems,
allowing many malformed loops through which ought to be rejected as
early as possible.

We observe that a common thread running through these malformed loops
is the absence of any scalar evolution between iterations.

We have therefore adjusted the analysis replacing the checks on
`niters' for a test for the presence of scalar evolution in the loop,
which can be detected via the presence of phi nodes in the loop.

gcc/ChangeLog:

* tree-vect-loop.cc (vect_analyze_loop_form): Relax niters
condition.

10 days agovect: Enable prolog peeling for uncounted loops
Victor Do Nascimento [Thu, 6 Nov 2025 10:24:43 +0000 (10:24 +0000)] 
vect: Enable prolog peeling for uncounted loops

The categorization of uncounted loops as
LOOP_VINFO_EARLY_BREAKS_VECT_PEELED disables prolog peeling by
default.  This is due to the assumption that you have early break
exits following the IV counting main exit.  For such loops, prolog
peeling is indeed problematic.

For enabling prolog peeling in uncounted loops it is sufficient, when
duplicating the loop for the prolog, to convert the prolog loop into a
counted loop, inserting a counting IV exit at the end, thus resulting
in the kind of early-break loop already supported by the compiler.

The pre-existing exits will continue to point to the exit node, while
the new exit will point to the vectorized loop, directing control flow
there once the number of iterations required for alignment are
completed.

In order to achieve this, we note that `vect_set_loop_condition'
replaces the condition in the main exit of a counted loop, all the
while inserting the prolog IV and its update statement.  The design
strategy is thus:

  - Have `slpeel_tree_duplicate_loop_to_edge_cfg' add a dummy main
  exit to the loop in the non-exiting branch of the original "main"
  exit in the loop, between the condition-containing BB and the latch
  BB.  For the original exit, if the exit condition is true, the
  edge->dest will remain unchanged.  The dummy exit will replicate
  this control-flow, with the exiting branch of the if statement
  initially leading to the same exit BB as the preceding exit.

  - As this new basic block will contain the IV-counting exit
  condition, its exit edge will be used for the control flow when
  alignment is achieved and thus we mark it as the new `new_exit'.
  This exit is then used in `redirect_edge_and_branch_force (new_exit,
  preheader)' and its basic block passed to `vect_set_loop_condition',
  wherein its condition will be replaced accordingly, correctly
  completing the setting up of our prolog loop.

  - In order to control this new functionality in
  slpeel_tree_duplicate_loop_to_edge_cfg we are, however, required to
  add a new parameter to the function. This is to be set to true when
  we have an uncounted loop AND we're generating its prolog.  This is
  done via the `bool duplicate_main_e' parameter, defaulting to false,
  allowing existing calls to the function to remain unchanged.

gcc/ChangeLog:

* tree-vect-data-refs.cc (vect_enhance_data_refs_alignment):
Enable peeling for uncounted loops.
* tree-vect-loop-manip.cc
(slpeel_tree_duplicate_loop_to_edge_cfg): Add exit condition
duplication functionality.
* tree-vectorizer.h (slpeel_tree_duplicate_loop_to_edge_cfg):
Modify function signature.
(vect_do_peeling): Enable uncounted loop peeling.

10 days agovect: Reject uncounted loop vectorization where alias analysis may fail
Victor Do Nascimento [Thu, 4 Sep 2025 12:19:44 +0000 (13:19 +0100)] 
vect: Reject uncounted loop vectorization where alias analysis may fail

Issues with alias list pruning for uncounted loops was found to cause
as-of-yet unresolved issues in the execution of SpecV6.  Disable this
while a reduced testcase is developed and a solution implemented.

Test derived from "omp_get_partition_place_nums" from libgomp "icv.c":

unsigned len = 8;

void
alias_fail (int n[8])
{
  unsigned int i;
  for (i = 0; i < len; i++)
    *n++ = i;
}

gcc/ChangeLog:

* tree-vect-data-refs.cc (vect_prune_runtime_alias_test_list):
Reject when !operand_equal_p for any data ref pair.

10 days agovect: Disable use of partial vectors for uncounted loops
Victor Do Nascimento [Thu, 6 Nov 2025 20:50:12 +0000 (20:50 +0000)] 
vect: Disable use of partial vectors for uncounted loops

Given the current reliance of masking on niters and the fact this is
undetermined for uncounted loops, we circumvent this limitation by
disabling the use of partial vectors when vectorizing loops with an
unkown upper bound.

gcc/ChangeLog:

* tree-vect-loop.cc (vect_analyze_loop_2): Disable partial
vector use for uncounted loops.

10 days agovect: Fix uncounted PHI handling of `slpeel_tree_duplicate_loop_to_edge_cfg'
Victor Do Nascimento [Mon, 27 Oct 2025 13:48:09 +0000 (13:48 +0000)] 
vect: Fix uncounted PHI handling of `slpeel_tree_duplicate_loop_to_edge_cfg'

Given how present requirements for loops, early-break or otherwise, to
have a known iteration count, there is currently no need for
single-exit loops to reset induction variables and accumulators prior
to entering the exit loop.

For multiple-exit uncounted loops, there are provisions in the code
for resetting IVs and accumulators on exiting the loop via early
exits.  This is extended to the main exit (though only in
multiple-exit loops) if `peeled_iters' is set to `true', wherein the
definition of `peeled_iters' is equivalent to that of
LOOP_VINFO_EARLY_BREAKS_VECT_PEELED, but is evaluated independently as
the function does not have access to loop_vinfo.

Therefore, the first fix is to ensure that, just as for
LOOP_VINFO_EARLY_BREAKS_VECT_PEELED, `peeled_iters' also evaluates to
true for uncounted loops.

The second fix implemented here is: given the relevant logic is
currently hidden behind the `multiple_exits_p', we enable relevant
logic via use of the new function argument `uncounted_p'.

gcc/ChangeLog:

* tree-vect-loop-manip.cc (slpeel_tree_duplicate_loop_to_edge_cfg):
reset IVs and accumulators for all exits for uncounted loops.
* tree-vectorizer.h (slpeel_tree_duplicate_loop_to_edge_cfg):
add boolean `uncounted_p' argument.

10 days agovect: Disable niters-based skipping of uncounted vectorized loops
Victor Do Nascimento [Mon, 29 Sep 2025 15:11:08 +0000 (16:11 +0100)] 
vect: Disable niters-based skipping of uncounted vectorized loops

The iteration count profitability check is irrelevant for uncounted
loops given that, even at runtime, the number of iterations is unknown
at the start of loop execution.

Likewise, the test for skipping the vectorized version of the loop is
based on whether the number of iterations that will be run for the
loop and whether it is smaller than the vectorization factor.  As this
is undetermined, the check can never be run for uncounted loops.

Consequently, we skip these checks.

gcc/ChangeLog:

* tree-vect-loop-manip.cc (vect_do_peeling): Disable vector
loop skip checking.
(vect_loop_versioning): skip profitability check for uncounted loops.

10 days agovect: guard niters manipulation with `LOOP_VINFO_NITERS_UNCOUNTED_P'
Victor Do Nascimento [Wed, 1 Oct 2025 14:11:52 +0000 (15:11 +0100)] 
vect: guard niters manipulation with `LOOP_VINFO_NITERS_UNCOUNTED_P'

In `vect_do_peeling' and `vect_transform_loop', there are several bits
of logic reliant on niters that need to be handled differently in the
case of uncounted loops.

Firstly When we peel the loop, adding a prolog,  we subtract the
prolog peeling factor from the original number of iterations for the
main loop.

Then, upon vectorization of the main loop, we need to update the
iteration upper-bound to reflect the fact that each iteration now acts
on VF elements, such that less iterations will be needed.

Both of these updates become unnecessary when we don't have an IV
counting exit.  Therefore, it is sufficient to guard these
manipulations behind a check for whether the loop we're dealing with
is uncounted.

gcc/ChangeLog:

* tree-vect-loop-manip.cc (vect_do_peeling): Disable niters
update.
* tree-vect-loop.cc (vect_transform_loop): Likewise.

10 days agovect: Extend `vec_init_loop_exit_info' to handle uncounted loops
Victor Do Nascimento [Mon, 22 Sep 2025 09:50:25 +0000 (10:50 +0100)] 
vect: Extend `vec_init_loop_exit_info' to handle uncounted loops

In its current implementation, the loop vectorizer requires the main
exit be the counting IV exit. With uncounted loops we no longer need
to have any counting IV exits.  Furthermore, it is possible to have
reached this stage with malformed loops with no exits at all.

Consequently, we need an approach to handle malformed loops and some
logic to follow when choosing the main exit, when counting IV is no
longer a valid criterion.

For malformed loops, it is sufficient to return NULL, so that we can
reject such loops upon the function return.

In the case of multiple exits and no counting IV exit, we choose the
last one in the loop.  This is done so that we continue to have an
empty effective latch.

As a consequence of allowing the main exit to no longer be associated
with IV counting, the old nomenclature of `LOOP_VINFO_IV_EXIT' and
`vec_loop_iv_exit' no longer fully cover the usage of such fields and
accessors.  With that in mind, these are modified to replace "IV" for
"MAIN" for these.

gcc/ChangeLog:

* tree-vectorizer.h (LOOP_VINFO_IV_EXIT): Replace this...
(LOOP_VINFO_MAIN_EXIT): ...with this.
(LOOP_VINFO_EPILOGUE_IV_EXIT): Replace this...
(LOOP_VINFO_EPILOGUE_MAIN_EXIT): ...with this.
(LOOP_VINFO_SCALAR_IV_EXIT): Replace this...
(LOOP_VINFO_SCALAR_MAIN_EXIT): ...with this.
(class _loop_vec_info): s/iv/main for `vec_loop_iv_exit',
`vec_epilogue_loop_main_exit' and `scalar_loop_main_exit'
class members.
* tree-vect-data-refs.cc
(vect_enhance_data_refs_alignment):
s/LOOP_VINFO_IV_EXIT/LOOP_VINFO_MAIN_EXIT/.
* tree-vect-loop-manip.cc
(vect_set_loop_controls_directly): Likewise.
(vect_gen_vector_loop_niters_mult_vf): Likewise.
(vect_loop_versioning): Likewise.
(vect_do_peeling):
s/LOOP_VINFO_IV_EXIT/LOOP_VINFO_MAIN_EXIT/,
s/LOOP_VINFO_SCALAR_IV_EXIT/LOOP_VINFO_SCALAR_MAIN_EXIT,
s/LOOP_VINFO_EPILOGUE_IV_EXIT/LOOP_VINFO_EPILOGUE_MAIN_EXIT.
* tree-vect-loop.cc (_loop_vec_info::_loop_vec_info):
s/iv_exit/main_exit/ in initializer list.
(vec_init_loop_exit_info): Handle multiple-exit uncounted loops.
(vect_analyze_loop_form): Fix `failure_at' message.
(vect_create_loop_vinfo):
s/LOOP_VINFO_IV_EXIT/LOOP_VINFO_MAIN_EXIT/.
(vect_create_epilog_for_reduction): Likewise.
(vectorizable_live_operation): Likewise.
(vect_update_ivs_after_vectorizer_for_early_breaks): Likewise.
(vect_transform_loop):
s/LOOP_VINFO_IV_EXIT/LOOP_VINFO_MAIN_EXIT/,
s/LOOP_VINFO_SCALAR_IV_EXIT/LOOP_VINFO_SCALAR_MAIN_EXIT.
* tree-vectorizer.cc (set_uid_loop_bbs):
s/LOOP_VINFO_SCALAR_IV_EXIT/LOOP_VINFO_SCALAR_MAIN_EXIT.

10 days agovect: Make all exit conditions early breaks for uncounted loops
Victor Do Nascimento [Tue, 30 Sep 2025 12:47:27 +0000 (13:47 +0100)] 
vect: Make all exit conditions early breaks for uncounted loops

For uncounted loops, given how no information can be derived from the
max number of iterations, we wish to make no distinction between the
"main" exit and any additional exits.

That is, an epilogue is required across all exits to establish when
the exit condition was met within the final vectorized loop iteration.

This can be accomplished via a two-fold approach:

     1. The need for all exits to go to the epilogue is shared with
     counted loops with early-break exits after the IV-counting exit.
     Such counted loops have the `LOOP_VINFO_EARLY_BREAKS_VECT_PEELED'
     flag set.  By modifying the flag's definition to encompass
     uncounted loops, we can make considerable use of the code written
     for this category of counted loops.

     2. Currently, when populating the `loop_vinfo' struct for a given
     loop, there is an assumption that the first exit condition in the
     `vect_loop_form_info' struct is the IV condition and any
     subsequent conditions are early break conditions.  This
     assumption breaks down for uncounted loops where _all_ exits
     should be treated as being "early break" exits.

     This is fixed by populating `LOOP_VINFO_LOOP_IV_COND (loop_vinfo)'
     conditionally on the false evaluation of the
     `LOOP_VINFO_NITERS_UNCOUNTED_P (loop_vinfo)' predicate, such that
     if we do have an uncounted loop we leave this field unpopulated,
     storing all conditions in `LOOP_VINFO_LOOP_CONDS (loop_vinfo)'.
     This approach has a further benefit in that, give how
     `LOOP_VINFO_EARLY_BREAKS' is defined by a non-empty list of early
     break exit conditions (`LOOP_VINFO_LOOP_CONDS (loop_vinfo)'),
     having LOOP_VINFO_LOOP_CONDS populated even for single-exit
     uncounted loops means that `LOOP_VINFO_EARLY_BREAKS' evaluates to
     true for all uncounted loops, irrespective of the number of exits
     it has.

gcc/ChangeLog:

* tree-vectorizer.h (LOOP_VINFO_EARLY_BREAKS_VECT_PEELED): OR
its current definition with `LOOP_VINFO_NITERS_UNCOUNTED_P(L)'
* tree-vect-loop.cc (vect_create_loop_vinfo): Don't populate
`LOOP_VINFO_LOOP_IV_COND' for uncounted loops.

10 days agovect: Add default types & retvals for uncounted loops
Victor Do Nascimento [Mon, 22 Sep 2025 16:52:11 +0000 (17:52 +0100)] 
vect: Add default types & retvals for uncounted loops

Detecting uncounted loops:
--------------------------

Given that scalar evolution analysis of uncounted loops sets
`loop_vec_info->num_iters' to `chrec_dont_know', we use this as the
criterion for probing whether a loop is uncounted or not.
Consequently, we introduce a new access function on `loop_vec_info' to
conveniently test whether a loop in question is uncounted or not, in
the form of `LOOP_VINFO_NITERS_UNCOUNTED_P(L)'.

Default types:
--------------

While the primary exit condition for loops is no longer tied to some
upper limit in the number of executed iterations, similar limits are
still required for vectorization.  One example of this is with prolog
peeling.  The prolog will always have an IV exit associated with the
misalignment of data accesses within the loop.

Historically, the assumption held that the data-type that this counter
should have could be derived from the type of the niters limit for the
original loop, so we could get the type from `TREE_TYPE (niters)'.

Moving forward, we provide a backup type to be used for iteration
counters when the maximum number of iterations to be run is unknown.

We take this to be `sizetype', given its role in storing the maximum
size of a theoretically possible object of any type (including array).

Default return values:
----------------------

To avoid having to gate all calls to functions that query a loop's
niters value it is better to "teach" such functions how to handle
uncounted loops and have them return a sensible value that can be
handled upon a function's return.

We therefore prevent functions operating on niters from segfaulting by
adding a default `SCEV_NOT_KNOWN' return value when niters information
absent.

gcc/ChangeLog:

* tree-vect-loop-manip.cc (vect_build_loop_niters): Gracefully
handle uncounted loops.
(vect_gen_prolog_loop_niters): Add type default of `sizetype'.
(vect_gen_vector_loop_niters): Likewise.
(vect_do_peeling): Likewise.
* tree-vect-loop.cc (vect_min_prec_for_max_niters): Likewise.
(loop_niters_no_overflow): Likewise.
* tree-vectorizer.h (LOOP_VINFO_NITERS_UNCOUNTED_P): New.

10 days agodoc: Document --with-windres in install.texi [PR108866]
Peter Damianov [Thu, 11 Dec 2025 01:52:44 +0000 (01:52 +0000)] 
doc: Document --with-windres in install.texi [PR108866]

gcc/ChangeLog:

PR target/108866
* doc/install.texi: Document --with-windres configure option.

Signed-off-by: Peter Damianov <peter0x44@disroot.org>
Signed-off-by: Jonathan Yong <10walls@gmail.com>
10 days agoDriver: Implement --with-windres= argument to configure script [PR108866]
Peter Damianov [Thu, 11 Dec 2025 01:52:43 +0000 (01:52 +0000)] 
Driver: Implement --with-windres= argument to configure script [PR108866]

To align with the rest of the options (--with-ld, --with-as, --with-dsymutil),
implement --with-windres for overriding the windres binary the driver invokes
with an absolute path to a windres binary.

gcc/
PR target/108866
* gcc.cc (find_a_program): Add check for DEFAULT_WINDRES.
* configure.ac: Add --with-windres= option.
* config.in: Regenerate.
* configure: Regenerate.

Signed-off-by: Peter Damianov <peter0x44@disroot.org>
Signed-off-by: Jonathan Yong <10walls@gmail.com>
10 days agoDriver: Add support for Windows resource files (.rc, .res) [PR108866]
Peter Damianov [Thu, 11 Dec 2025 01:52:42 +0000 (01:52 +0000)] 
Driver: Add support for Windows resource files (.rc, .res) [PR108866]

This patch adds support for compiling Windows resource files
(.rc) and pre-compiled resource files (.res) directly through the
GCC driver on PECOFF targets.

Previously, users had to manually invoke windres to compile resource
files before linking:

    windres -o resource.o resource.rc
    gcc main.c resource.o -o program.exe

With this patch, GCC can handle resource files automatically:

    gcc main.c resource.rc -o program.exe
    gcc main.c resource.res -o program.exe

Now, for an explanation of each line of the spec:

If any of -E -M or -MM were passed, do nothing. No object files are output.
    "%{!E:%{!M:%{!MM:windres

Add -J so that windres does not perform autodetection of input type
Add -O so that the output type is always COFF
     -J rc -O coff \

For multilib configurations, tell windres to write out the correct COFF format.
- If -m32 is specified, use pe-i386 format
- If -m64 is specified, use pe-x86_64 format
- If neither are specified, use the correct default for the target

This is defined in WINDRES_FORMAT_SPEC which expands to:
  For 64-bit: "%{m32:-F pe-i386;m64|!m32:-F pe-x86-64}"
  For 32-bit: "%{m64:-F pe-x86-64;m32|!m64:-F pe-i386}"

Pass through -I -D -U on to windres, because it supports them.
    %{I*:-I%*} %{D*:-D%*} %{U*:-U%*} \

If -c is passed, pass through -o to windres, if it was specified. Otherwise,
 output to the input basename with .o suffix. Else, output to a
 temp file that will be deleted after linking.
    %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O} %i}}}",

gcc/ChangeLog:

PR driver/108866
* gcc.cc (default_compilers): Add EXTRA_DEFAULT_COMPILERS so the config
of a target can add an extra compiler spec to default_compilers.
* config/i386/cygming.h (WINDRES_FORMAT_SPEC): New macro to handle
PE format selection based on TARGET_64BIT_DEFAULT and -m32/-m64 flags.
(EXTRA_DEFAULT_COMPILERS): Add spec for windres.
* config/aarch64/cygming.h (EXTRA_DEFAULT_COMPILERS): Likewise.

Signed-off-by: Peter Damianov <peter0x44@disroot.org>
Signed-off-by: Jonathan Yong <10walls@gmail.com>
10 days agoopenmp: Fix next variable initialization in cp_parser_omp_clause_linear [PR123128]
Jakub Jelinek [Mon, 15 Dec 2025 12:44:20 +0000 (13:44 +0100)] 
openmp: Fix next variable initialization in cp_parser_omp_clause_linear [PR123128]

Apparently clang++ emits error on int *p = ((unsigned long) 0); while g++
accepts it without any diagnostics even with -pedantic-errors -W -Wall.
Dunno which is right, anyway, I meant to initialize with NULL, not
UNKNOWN_LOCATION.

2025-12-15  Jakub Jelinek  <jakub@redhat.com>

PR c++/123128
* parser.cc (cp_parser_omp_clause_linear): Initialize next to NULL
rather than UNKNOWN_LOCATION.

10 days agovect: add testcase from [PR123032]
Tamar Christina [Mon, 15 Dec 2025 09:36:15 +0000 (09:36 +0000)] 
vect: add testcase from [PR123032]

Adding tests to testsuite, fixed by gcc-16-6031-g8aa4ef38bd1

gcc/testsuite/ChangeLog:

PR tree-optimization/123032
* gcc.dg/vect/pr123032.c: New test.

10 days agovect: add testcase from [PR123043]
Tamar Christina [Mon, 15 Dec 2025 09:34:43 +0000 (09:34 +0000)] 
vect: add testcase from [PR123043]

Adding tests to testsuite, fixed by gcc-16-6031-g8aa4ef38bd1

gcc/testsuite/ChangeLog:

PR tree-optimization/123043
* gcc.dg/vect/pr123043.c: New test.

10 days agoAda: Fix ICE in fld_incomplete_type_of when building GtkAda with LTO
Eric Botcazou [Mon, 15 Dec 2025 08:09:13 +0000 (09:09 +0100)] 
Ada: Fix ICE in fld_incomplete_type_of when building GtkAda with LTO

This is a regression from GCC 9 present on mainline and all active branches:
the compilation of GtkAda in LTO mode trips on the assertion present in the
fld_incomplete_type_of function about the TYPE_CANONICAL of types pointed to
by pointer (or reference) types.  The problem comes from an oversight in the
update_pointer_to function on gcc-interface, which correctly propagates the
TYPE_CANONICAL of the new pointer type to the old one when there is a new
pointer type, but fails to synthesize it when there is no new pointer type.

gcc/ada/
PR ada/123060
* gcc-interface/utils.cc (update_pointer_to): Synthesize a new
TYPE_CANONICAL for the old pointer type in the case where there
is no new pointer type.  Likewise for references.

gcc/testsuite/
* gnat.dg/lto30.ads, gnat.dg/lto30.adb: New test.

10 days agoa68: add Poke description of module exports for 32-bit systems
Mohammad-Reza Nabipoor [Mon, 15 Dec 2025 02:27:37 +0000 (03:27 +0100)] 
a68: add Poke description of module exports for 32-bit systems

This commit adds new types for 32-bit systems and rename current
types to have a `_64' suffix.

Signed-off-by: Mohammad-Reza Nabipoor <mnabipoor@gnu.org>
gcc/algol68/ChangeLog

* ga68-exports.pk (ga68_text_reloc_64): Renamed and
adapted from ga68_text_reloc.
(ga68_data_reloc_64): Renamed and adapted from ga68_data_reloc.
(ga68_mode_64): Renamed and adapted from ga68_mode.
(ga68_extract_64): Renamed and adapted from ga68_extract.
(ga68_module_64): Renamed and adapted from ga68_module.
(ga68_text_reloc_32): New type.
(ga68_data_reloc_32): Likewise.
(ga68_mode_32): Likewise.
(ga68_extract_32): Likewise.
(ga68_module_32): Likewise.

10 days agoa68: fix comment and magic number in ga68-exports.pk
Mohammad-Reza Nabipoor [Mon, 15 Dec 2025 02:27:36 +0000 (03:27 +0100)] 
a68: fix comment and magic number in ga68-exports.pk

Signed-off-by: Mohammad-Reza Nabipoor <mnabipoor@gnu.org>
gcc/algol68/ChangeLog

* ga68-exports.pk: Fix comment and value for magic number.

10 days agoAdd myself to DCO section
Jose E. Marchesi [Mon, 15 Dec 2025 06:21:17 +0000 (07:21 +0100)] 
Add myself to DCO section

For contributions made under Signed-off-by: Jose E. Marchesi <jemarch@gnu.org>

ChangeLog

* MAINTAINERS: Add myself to DCO section.

10 days ago[PATCH] RISC-V: Rename UPPERCAE_NAME to UPPERCASE_NAME
Jerry Zhang Jian [Mon, 15 Dec 2025 03:09:56 +0000 (20:09 -0700)] 
[PATCH] RISC-V: Rename UPPERCAE_NAME to UPPERCASE_NAME

This is a follow-up to d99af4e12bf8.

gcc/ChangeLog:

* config/riscv/gen-riscv-ext-opt.cc: Rename UPPERCAE_NAME to
UPPERCASE_NAME.
* config/riscv/gen-riscv-ext-texi.cc: Likewise.
* config/riscv/riscv-ext-corev.def: Likewise.
* config/riscv/riscv-ext-sifive.def: Likewise.
* config/riscv/riscv-ext-thead.def: Likewise.
* config/riscv/riscv-ext-ventana.def: Likewise.

10 days ago[PATCH] Remove score files in libgcc
Peter Damianov [Mon, 15 Dec 2025 03:07:02 +0000 (20:07 -0700)] 
[PATCH] Remove score files in libgcc

This target was deleted in r5-3909-g3daa7bbf791203,
but a few files in libgcc were missed. Delete them.

libgcc/ChangeLog:

* config/score/crti.S: Delete.
* config/score/crtn.S: Delete.
* config/score/sfp-machine.h: Delete.

Signed-off-by: Peter Damianov <peter0x44@disroot.org>
10 days agoDaily bump.
GCC Administrator [Mon, 15 Dec 2025 00:16:24 +0000 (00:16 +0000)] 
Daily bump.

10 days agomiddle-end: Fix spurious -Walloc-size-larger-than warning during LTO [PR106409]
Lewis Hyatt [Sun, 14 Dec 2025 14:51:12 +0000 (09:51 -0500)] 
middle-end: Fix spurious -Walloc-size-larger-than warning during LTO [PR106409]

The implementation of -Walloc-size-larger-than has logic to avoid issuing
the warning for ::operator new[] calls emitted by the C++ front end, which
otherwise produce known false positives.  The logic for suppressing the
warning only activates in the C++ front end, and so it does not prevent the
LTO front end from issuing the warning.  Fix by applying the logic in all
cases.

gcc/ChangeLog:

PR tree-optimization/106409
* gimple-ssa-warn-access.cc (maybe_warn_alloc_args_overflow): Adjust
comment for clarity, and augment check to work in LTO as well.

gcc/testsuite/ChangeLog:

PR tree-optimization/106409
* g++.dg/lto/pr106409_0.C: New test.

11 days agocprop_hardreg: Prevent copy propagation from a non-frame related insn to a frame...
Surya Kumari Jangala [Sun, 16 Nov 2025 17:11:06 +0000 (12:11 -0500)] 
cprop_hardreg: Prevent copy propagation from a non-frame related insn to a frame related insn

The pass 'cprop_hardreg' should not propagate a value from a
non-frame-related insn to a frame-related one. This can lead to
incorrect dwarf information as noted in PR122274.

cprop_hardreg uses 'struct value_data' to hold lists of registers that
contain the same value. However, the value data does not have any
information about the instruction that sets the values in the register.

In this patch, a new field is added to 'struct value_data_entry'
which indicates if the instruction that created this
value is frame related or not. Then during copy propagation, we do not
replace registers if the copy is happening from a non-frame related insn
to a frame related insn.

2025-11-16  Surya Kumari Jangala  <jskumari@linux.ibm.com>

gcc:
PR rtl-optimization/122274
* regcprop.cc (value_data_entry): New field.
(kill_value_one_regno): Update field.
(init_value_data): Initialize field.
(kill_set_value_data): New field.
(kill_set_value): Update field.
(kill_autoinc_value): Likewise.
(copy_value): New parameter. Update field.
(incompatible_frame_status): New function.
(find_oldest_value_reg): New parameter. Compare frame relatedness of
insn and propagated value.
(replace_oldest_value_reg): Pass additional parameter to
find_oldest_value_reg().
(copyprop_hardreg_forward_1): Pass additional parameter to
find_oldest_value_reg(). Compare frame relatedness of insn and
propagated value. Call copy_value() with additional parameter.

gcc/testsuite:
PR rtl-optimization/122274
* gcc.dg/rtl/powerpc/test-frame-related.c: New test.

11 days agoDaily bump.
GCC Administrator [Sun, 14 Dec 2025 00:16:30 +0000 (00:16 +0000)] 
Daily bump.

11 days agofinal_cleanupcfg: Make sure TODO_cleanup_cfg is unset
Andrew Pinski [Sat, 13 Dec 2025 09:23:13 +0000 (01:23 -0800)] 
final_cleanupcfg: Make sure TODO_cleanup_cfg is unset

While I was looking into the code generation of PR 122727,
I noticed that TODO_cleanup_cfg could be set from the call to
execute_fixup_cfg even though cleanupcfg did nothing afterwards.
This means the forwarder blocks that were just created with
make_forwarders_with_degenerate_phis are being removed.
Instead of conditionally unsetting TODO_cleanup_cfg,
unconditionally unset TODO_cleanup_cfg after the call
to make_forwarders_with_degenerate_phis. Since we already
did the cleanup (maybe twice).

Bootstrapped and tested on x86_64-linux-gnu.

PR tree-optimization/46555
gcc/ChangeLog:

* tree-cfgcleanup.cc (execute_cleanup_cfg_post_optimizing):
Unconditionally set TODO_cleanup_cfg.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
12 days agoa68: handling of PUB in contracted declarations
Jose E. Marchesi [Sat, 13 Dec 2025 12:01:41 +0000 (13:01 +0100)] 
a68: handling of PUB in contracted declarations

This commit adds support for using 'pub' in contracted declarations.

Signed-off-by: Jose E. Marchesi <jemarch@gnu.org>
gcc/algol68/ChangeLog

* a68-parser-bottom-up.cc (a68_bottom_up_coalesce_pub): Do not
mark defining entities as publicized.
* a68-parser-extract.cc (a68_extract_indicants): Mark public
defining entities.
(a68_extract_priorities): Likewise.
(a68_extract_operators): Likewise.
(a68_extract_identities): Likewise.
(a68_extract_variables): Likewise.
(a68_extract_proc_identities): Likewise.
(a68_extract_proc_variables): Likewise.

gcc/testsuite/ChangeLog

* algol68/execute/modules/module1.a68: Also test contracted
forms.
* algol68/execute/modules/module3.a68: Likewise.
* algol68/execute/modules/module5.a68: Likewise.
* algol68/execute/modules/program-1.a68: Likewise.

12 days agomatch: disable some match patterns for non GIMPLE
Andrew Pinski [Sat, 13 Dec 2025 04:17:00 +0000 (20:17 -0800)] 
match: disable some match patterns for non GIMPLE

This disables some match (not the simplify one) patterns
for non-GIMPLE. All of the saturation related match patterns,
the clz/popcount related match patterns that are used from forwardprop.
Also cond_expr_convert_p and bitwise_induction_p match patterns.

These are only used from outside of match and simplify and only the
gimple form so there is no reason to generate the GENERIC form of
this.

THis should speed up bootstrap slightly by not generating or compiling
them. This should (when compiled without LTO) also improve the overall
size of the built binaries too.

For GCC 17, I am thinking about moving the gimple only simplify and match
patterns to their own file as match.pd is getting too big to search for
patterns.

Bootstrapped and tested on x86_64-linux-gnu.

gcc/ChangeLog:

* match.pd: Disable a few match patterns for !GIMPLE.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
12 days agoch: Improve copy header when the bbs are predicated as non-executed [PR122734]
Andrew Pinski [Wed, 19 Nov 2025 07:02:36 +0000 (23:02 -0800)] 
ch: Improve copy header when the bbs are predicated as non-executed [PR122734]

This is version based on https://gcc.gnu.org/pipermail/gcc-patches/2025-November/701533.html
review. Though the only thing is we still need an extra check for the edge probability
like it is done in single_likely_exit because probabilities are still not being tracked
correctly it seems.

I also added copy-headers-12.c which we fail by duplicating too much. But I think that is ok,
as this pattern of being the "correct" part of the loop header leading to a
noreturn function does not happen that often and when it does the header would have had a
statically figured out conditional which is already being checked.

Bootstrapped and tested on x86_64-linux-gnu.

PR tree-optimization/122734

gcc/ChangeLog:

* tree-ssa-loop-ch.cc (should_duplicate_loop_header_p): Add new argument,
canbe_neverexecuted. When canbe_neverexecuted is true, return if a loop
exit is "never executed" like we are doing an invariant conditional.
(ch_base::copy_headers): Update call to should_duplicate_loop_header_p.

gcc/testsuite/ChangeLog:

* gcc.dg/tree-ssa/20030711-1.c: Update.
* gcc.dg/tree-ssa/copy-headers-10.c: New test.
* gcc.dg/tree-ssa/copy-headers-11.c: New test.
* gcc.dg/tree-ssa/copy-headers-12.c: New test.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
12 days agoopenmp: Provide fixit hints for -Wdeprecated-openmp diagnostics from C++ FE
Jakub Jelinek [Sat, 13 Dec 2025 09:02:55 +0000 (10:02 +0100)] 
openmp: Provide fixit hints for -Wdeprecated-openmp diagnostics from C++ FE

I think especially the linear clause -Wdeprecated-openmp diagnostics
will be complete nightmare for users, when they have
linear (ref (x, y, z))
or
linear (uval (a, b, c) : 2)
they will have no clue what the new syntax is.

Here is an attempt to provide fixit hints from the C++ FE for most
of these warnings, and even -fdiagnostics-generate-patch can then be
useful for porting.

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

* parser.cc (cp_parser_omp_clause_reduction): Provide fixit hints
for -Wdeprecated-openmp diagnostics.
(cp_parser_omp_clause_linear): Likewise.
(cp_parser_omp_clause_depend): Likewise.
(cp_parser_omp_clause_map): Likewise.  Reset num_commas after the
diagnostics.
(cp_parser_omp_clause_proc_bind): Provide fixit hints for
-Wdeprecated-openmp diagnostics.
(cp_parser_omp_all_clauses): Move -Wdeprecated-openmp diagnostics
for to vs. enter here, add fixit hints for it.
(cp_parser_omp_master):Add MASTER_LOC argument.  Provide fixit hints
for -Wdeprecated-openmp diagnostics.
(cp_parser_omp_parallel): Adjust cp_parser_omp_master caller.
(cp_parser_omp_declare_target): Don't emit -Wdeprecated-openmp
warning for to vs. enter here.
(cp_parser_omp_metadirective): Provide fixit hints for
-Wdeprecated-openmp diagnostics.
(cp_parser_omp_construct): Adjust cp_parser_omp_master caller.

* g++.dg/gomp/deprecate-1.C: New test.

12 days agoopenmp: Provide fixit hints for -Wdeprecated-openmp diagnostics from C FE
Jakub Jelinek [Sat, 13 Dec 2025 09:01:30 +0000 (10:01 +0100)] 
openmp: Provide fixit hints for -Wdeprecated-openmp diagnostics from C FE

I think especially the linear clause -Wdeprecated-openmp diagnostics
will be complete nightmare for users, when they have
linear (ref (x, y, z))
or
linear (uval (a, b, c) : 2)
they will have no clue what the new syntax is.

Here is a so far lightly tested attempt to provide fixit hints for most
of these warnings, and even -fdiagnostics-generate-patch can then be
useful for porting.
And so far I've done just the C FE.

Some issues:
1) I have no idea what to do about
or their attribute variants, for pragmas the location_t one gets is
the omp keyword, not master or declare, and there is no other location_t
easily available to add a fixit hint that master -> masked or
begin inserted before declare.  And for attributes I have no idea what
location_t we get there.  Note, for omp parallel master or omp parallel
master taskloop I do emit fixit hints.
2) I think there is a missing warning for
(similar case to reduction clause with - identifier)
3) I think the map clause diagnostics for missing comma separation
will not diagnose
just missing commas in between multiple modifiers (and I've fixed it
not to emit diagnostics multiple times if only one comma is missing,
e.g.
would I think diagnose missing comma twice.

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

* c-parser.cc (c_parser_omp_clause_reduction): Provide fixit hints
for -Wdeprecated-openmp diagnostics.
(c_parser_omp_clause_linear): Likewise.
(c_parser_omp_clause_depend): Likewise.  Add HERE argument.
(c_parser_omp_clause_map): Provide fixit hints for -Wdeprecated-openmp
diagnostics.  Reset num_commas after the diagnostics.
(c_parser_omp_clause_proc_bind): Provide fixit hints for
-Wdeprecated-openmp diagnostics.
(c_parser_omp_all_clauses): Move -Wdeprecated-openmp diagnostics
for to vs. enter here, add fixit hints for it.  Adjust
c_parser_omp_clause_depend caller.
(c_parser_omp_depobj): Adjust c_parser_omp_clause_depend caller.
(c_parser_omp_master): Add MASTER_LOC argument.  Provide fixit hints
for -Wdeprecated-openmp diagnostics.
(c_parser_omp_parallel): Adjust c_parser_omp_master caller.
(c_parser_omp_declare_target): Don't emit -Wdeprecated-openmp
warning for to vs. enter here.
(c_parser_omp_metadirective): Provide fixit hints for
-Wdeprecated-openmp diagnostics.
(c_parser_omp_construct): Adjust c_parser_omp_master caller.

* c-c++-common/gomp/52-deps.c: Change locations of 2 warnings for C.
* gcc.dg/gomp/deprecate-1.c: New test.

12 days ago[testsuite] allow relative line numbers in gnat.dg/
Alexandre Oliva [Sat, 13 Dec 2025 07:11:29 +0000 (04:11 -0300)] 
[testsuite] allow relative line numbers in gnat.dg/

The wrappers for dg-warning and dg-error that handle relative line
numbers with process-message are only activated if the global
variables gcc_warning_prefix and gcc_error_prefix, respectively, are
defined.

gnat.exp didn't set these variables, so we couldn't use relative line
numbers.

Set them to empty strings, for minimal disruption.

for  gcc/testsuite/ChangeLog

* lib/gnat.exp (gnat_init): Set gcc_warning_prefix and
gcc_error_prefix.

12 days ago[testsuite] xfail vect-121.c on ia32 [PR119293]
Alexandre Oliva [Sat, 13 Dec 2025 07:12:02 +0000 (04:12 -0300)] 
[testsuite] xfail vect-121.c on ia32 [PR119293]

Once fre5 resolves conditional of the guard block for the vectorized
loop, cfgcleanup removes the edge that bypasses it, adjusting the
other edge probability, but not the edge's dest's count.  The blocks
get combined, and their counts are merged, but nothing adjusts the
counts of the block that lost an incoming edge.

The incoming counts remain inconsistent from that point on, and get
reported as "Invalid sum of incoming counts" in the tree dump where
vect-121.c checks for the absence of this error.

That was added in response to a fix for a vectorizer profile count
management problem.  This is a different profile count management
problem, so it makes sense to silence this failure marking it as
expected.

for  gcc/testsuite/ChangeLog

PR tree-optimization/119293
* gcc.dg/vect/vect-121.c: XFAIL on ia32.

12 days agodoc: make regenerate-opt-urls
Sandra Loosemore [Sat, 13 Dec 2025 04:04:11 +0000 (04:04 +0000)] 
doc: make regenerate-opt-urls

gcc/ChangeLog

* config/alpha/alpha.opt.urls: Regenerated.
* config/arc/arc.opt.urls: Regenerated.
* config/arm/arm.opt.urls: Regenerated.
* config/bpf/bpf.opt.urls: Regenerated.
* config/c6x/c6x.opt.urls: Regenerated.
* config/cris/cris.opt.urls: Regenerated.
* config/csky/csky.opt.urls: Regenerated.
* config/h8300/h8300.opt.urls: Regenerated.
* config/i386/i386.opt.urls: Regenerated.
* config/ia64/ia64.opt.urls: Regenerated.
* config/lm32/lm32.opt.urls: Regenerated.
* config/loongarch/loongarch.opt.urls: Regenerated.
* config/lynx.opt.urls: Regenerated.
* config/m32r/m32r.opt.urls: Regenerated.
* config/m68k/m68k.opt.urls: Regenerated.
* config/mcore/mcore.opt.urls: Regenerated.
* config/microblaze/microblaze.opt.urls: Regenerated.
* config/mips/mips.opt.urls: Regenerated.
* config/mn10300/mn10300.opt.urls: Regenerated.
* config/moxie/moxie.opt.urls: Regenerated.
* config/msp430/msp430.opt.urls: Regenerated.
* config/nds32/nds32.opt.urls: Regenerated.
* config/or1k/elf.opt.urls: Regenerated.
* config/pa/pa-hpux.opt.urls: Regenerated.
* config/pa/pa.opt.urls: Regenerated.
* config/pdp11/pdp11.opt.urls: Regenerated.
* config/pru/pru.opt.urls: Regenerated.
* config/riscv/riscv.opt.urls: Regenerated.
* config/rs6000/rs6000.opt.urls: Regenerated.
* config/rs6000/sysv4.opt.urls: Regenerated.
* config/s390/s390.opt.urls: Regenerated.
* config/sh/sh.opt.urls: Regenerated.
* config/sparc/sparc.opt.urls: Regenerated.
* config/v850/v850.opt.urls: Regenerated.
* config/vax/vax.opt.urls: Regenerated.
* config/visium/visium.opt.urls: Regenerated.

12 days agodoc, pru: Clean up PRU option documentation [PR122243]
Sandra Loosemore [Fri, 5 Dec 2025 17:07:33 +0000 (17:07 +0000)] 
doc, pru: Clean up PRU option documentation [PR122243]

gcc/ChangeLog
PR other/122243
* doc/invoke.texi (Option Summary) <PRU Options>: Fix whitespace
in option list.
(PRU Options): Copy-editing.  Index and list negative option forms.

12 days agodoc, pdp11: Clean up PDP-11 documentation [PR122243]
Sandra Loosemore [Fri, 5 Dec 2025 17:07:32 +0000 (17:07 +0000)] 
doc, pdp11: Clean up PDP-11 documentation [PR122243]

While working on this patch I saw that this target has an -mlra option
that still defaults to off.  Although the LRA support was added in
2018 apparently it wasn't robust enough to enable by default.  We are
supposed to be deleting reload support and all targets that don't use
LRA by default in GCC 16, so this target may be declared obsolete very
soon, but I've made the documentation of other options consistent with
the .opt files and conventions used for other targets anyway in case
either somebody who can build/test for this target switches the
default (see PR target/113947) or the reload removal is postponed.

gcc/ChangeLog
PR other/122243
* config/pdp11/pdp11.opt (m40, m45): Add RejectNegative.
* doc/invoke.texi (Option Summary) <PDP-11 Options>: Remove
redundant -mno- forms from the list.
(PDP-11 Options): Fix some markup issues.  Merge documentation
of positive and negative forms of -mac0.  Index negative forms
of -msplit, -mlra.

12 days agodoc, or1k: Clean up OpenRISC option documentation [PR122243]
Sandra Loosemore [Fri, 5 Dec 2025 17:07:31 +0000 (17:07 +0000)] 
doc, or1k: Clean up OpenRISC option documentation [PR122243]

I'm not sure what the rationale is for having "RejectNegative" on all
of the options that control instruction usage except for -mdouble-float,
but with this patch the documentation matches what is in the .opt files.

gcc/ChangeLog
PR other/122243
* config/or1k/elf.opt (mnewlib): Mark obsolete option as
"Undocumented".
* config/or1k/or1k.opt (mcmov): Don't use future tense in doc string.
(msfimm): Likewise.
(mshftimm): Likewise.
* doc/invoke.texi (Option Summary) <OpenRISC Options>: Don't
document -mnewlib.
(OpenRISC Options): Likewise.  Add @opindex entry for
-mno-double-float.  Fix more instances of incorrect use of future
tense.

12 days agodoc, nvptx: Clean up documentation of Nvidia PTX Options [PR122243]
Sandra Loosemore [Fri, 5 Dec 2025 17:07:31 +0000 (17:07 +0000)] 
doc, nvptx: Clean up documentation of Nvidia PTX Options [PR122243]

gcc/ChangeLog
PR other/122243
* doc/invoke.texi (Option Summary) <Nvidia PTX Options>: Add
several missing options.
(Nvidia PTX Options): Correct index entry for -march-map.  List
negative forms of -moptimize, muniform-simt, and -mgomp.  Fix some
Texinfo markup issues.

12 days agodoc, nds32: Clean up NDS32 option documentation [PR122243]
Sandra Loosemore [Fri, 5 Dec 2025 17:07:30 +0000 (17:07 +0000)] 
doc, nds32: Clean up NDS32 option documentation [PR122243]

gcc/ChangeLog
PR other/122243
* doc/invoke.texi (Option Summary) <NDS32 Options>: Don't list
both positive and negative option forms.
(NDS32 Options): Consolidate separate entries for positive and
negative forms of the same option.  Document missing negative
forms in the same style.

12 days agodoc, msp430: Clean up MSP430 option documentation [PR122243]
Sandra Loosemore [Fri, 5 Dec 2025 17:07:29 +0000 (17:07 +0000)] 
doc, msp430: Clean up MSP430 option documentation [PR122243]

gcc/ChangeLog
PR other/122243
* config/msp430/msp430.opt (mcpu): Mark deprecated option as
"Undocumented".
(mdevices-csv-loc=): Mark option not intended to be used by users
as "Undocumented".
* doc/invoke.texi (Option Summary) <MSP430 Options>: Fill in
argument syntax for options of the form -mfoo=@var{arg}.  Don't
list deprecated option -mcpu=.  Add missing entries for
-mwarn-devices-csv and -muse-lower-region-prefix.
(MSP430 Options): Similarly document argument syntax in the table
@item entries.  Add @opindex entries for negative forms.
Delete documentation of deprecated -mcpu= option.  Add
documentation for -muse-lower-region-prefix.  Markup and
copy-editing fixes throughout the section.

12 days agodoc, mn10300: Clean up MN10300 option documentation [PR122243]
Sandra Loosemore [Fri, 5 Dec 2025 17:07:29 +0000 (17:07 +0000)] 
doc, mn10300: Clean up MN10300 option documentation [PR122243]

gcc/ChangeLog
PR other/122243
* doc/invoke.texi (Option Summary) <MN10300 Options>: Remove
redundant -mno- forms from the list.
(MN10300 Options): Combine the documentation for -mmult-bug,
-mam33, -mliw, and -msetlb with the entries for the respective
negative forms.  List and index the negative forms -mno-am33-2,
-mno-am34, -mno-return-pointer-on-d0, -mno-mul.x.

12 days agodoc, mmix: Clean up MMIX option documentation [PR122243]
Sandra Loosemore [Fri, 5 Dec 2025 17:07:28 +0000 (17:07 +0000)] 
doc, mmix: Clean up MMIX option documentation [PR122243]

gcc/ChangeLog
PR other/122243
* doc/invoke.texi (Option Summary) <MMIX Options>: Remove redundant
-mno- forms from the list.

12 days agodoc, mips: Clean up MIPS option documentation [PR122243]
Sandra Loosemore [Fri, 5 Dec 2025 17:07:27 +0000 (17:07 +0000)] 
doc, mips: Clean up MIPS option documentation [PR122243]

gcc/ChangeLog
PR other/122243
* config/mips/mips.opt (mnoasmopt): Mark as "Undocumented".
* doc/invoke.texi (Option Summary) <MIPS Options>: Add missing
entries for -mel/-meb.  Only list one of -mfoo/-mno-foo.
(MIPS Options):  Document -meb/-mel as synonyms for -EB/-EL.
Add missing @opindex entries.  Document -mmsa and -mfix4300.
Minor copy-editing for grammar and jargon issues.

12 days agodoc, microblaze: Clean up MicroBlaze option documentation [PR122243]
Sandra Loosemore [Fri, 5 Dec 2025 17:07:27 +0000 (17:07 +0000)] 
doc, microblaze: Clean up MicroBlaze option documentation [PR122243]

gcc/ChangeLog
PR other/122243
* config/microblaze/microblaze.opt (Zxl-mode-bootstrap):
Mark as "Undocumented".
(Zxl-mode-executable): Likewise.
(Zxl-mode-novectors): Likewise.
(Zxl-mode-xilkernel): Likewise.
(Zxl-mode-xmdstub): Likewise.
(mxl-stack-check): Likewise.
(mno-clearbss): Likewise.
(mxl-mode-executable): Make help string more useful.
(mxl-mode-xmdstub): Likewise.
(mxl-mode-bootstrap): Likewise.
(mxl-mode-novectors): Likewise.
(mxl-mode-xilkernel): Mark as "Undocumented".
* doc/invoke.texi (Option Summary) <MicroBlaze Options>: Delete
entries for obsolete options now explicitly undocumented, and add
missing -mxl-prefetch option.
(MicroBlaze Options): Add missing @opindex entries for negative
option forms and list negative forms explicitly when appropriate.
Delete documentation for obsolete/deprecated options.  Add
missing @opindex entries for the m[no-]xml-mode- options.
Add missing documentation for -mxl-prefetch.

12 days agodoc, mcore: Clean up MCore option documentation [PR122243]
Sandra Loosemore [Fri, 5 Dec 2025 17:07:26 +0000 (17:07 +0000)] 
doc, mcore: Clean up MCore option documentation [PR122243]

gcc/ChangeLog
PR other/122243
* doc/invoke.texi (Option Summary) <MCore Options>: Remove
redundant -no options.
(MCore Options): Disambiguate documentation for
-mbig-endian/-mlittle-endian and -m210/-m340.

12 days agodoc, m68k: Clean up M680x0 option documentation [PR122243] [PR119404]
Sandra Loosemore [Fri, 5 Dec 2025 17:07:25 +0000 (17:07 +0000)] 
doc, m68k: Clean up M680x0 option documentation [PR122243] [PR119404]

gcc/ChangeLog
PR other/122243
PR target/119404
* config/m68k/m68k.opt (mlra): Fix typo in help string.
* doc/invoke.texi (Option Summary) <M680x0 Options>: Remove
redundant -mno- forms from the list.
(M680x0 Options): Combine documentation for -mshort, mbitfield,
-msep-data, -mid-shared-library with that for their respective
negatives that were formerly separately listed.  Add missing
@opindex entries.

12 days agodoc, m32r: Clean up documentation of M32R/D options [PR122243]
Sandra Loosemore [Fri, 5 Dec 2025 17:07:25 +0000 (17:07 +0000)] 
doc, m32r: Clean up documentation of M32R/D options [PR122243]

gcc/ChangeLog
PR other/122243
* doc/invoke.texi (Option Summary) <M32R/D Options>: Remove
redundant -mno entry.
(M32R/D Options): Regularize form of @opindex entries for
various options of the form -mfoo=@var{value}.  Combine
the documentation for -malign-loops and -mno-align-loops.

12 days agodoc, m32c: Clean up M32C option documentation [PR122243]
Sandra Loosemore [Fri, 5 Dec 2025 17:07:24 +0000 (17:07 +0000)] 
doc, m32c: Clean up M32C option documentation [PR122243]

gcc/ChangeLog
PR other/122243
* doc/invoke.texi (M32C Options): Add missing @opindex for negative
form.

12 days agodoc, loongarch: Clean up LoongArch option documentation [PR122243]
Sandra Loosemore [Fri, 5 Dec 2025 17:07:23 +0000 (17:07 +0000)] 
doc, loongarch: Clean up LoongArch option documentation [PR122243]

gcc/ChangeLog
PR other/122243
* doc/invoke.texi (Option Summary) <LoongArch Options>:
Remove redundant -mno forms from list.  Fix formatting so that
there is uniformly two spaces between options on the same line.
(LoongArch Options): Copy-editing for grammar, etc.  Add
@opindex for negative forms.

12 days agodoc, lm32: Clean up LM32 option documentation [PR122243]
Sandra Loosemore [Fri, 5 Dec 2025 17:07:23 +0000 (17:07 +0000)] 
doc, lm32: Clean up LM32 option documentation [PR122243]

gcc/ChangeLog
PR other/122243
* doc/invoke.texi (LM32 Options): Add @opindex entries for negative
option forms.

12 days agodoc, ia64: Clean up documentation of IA-64 options [PR122243]
Sandra Loosemore [Fri, 5 Dec 2025 17:07:22 +0000 (17:07 +0000)] 
doc, ia64: Clean up documentation of IA-64 options [PR122243]

This backend is no longer maintained and was supposed to have been
deleted as of GCC 15, but since it is still part of GCC and documented
in the manual, I have gone ahead and fixed up its options
documentation for consistency with other active targets.

gcc/ChangeLog
PR other/122243
* config/ia64/ia64.opt (msched-prefer-data-spec-insns): Mark as
explicitly "Undocumented".
(msched-prefer-non-control-spec-insns): Likewise.
* doc/invoke.texi (Option Summary) <IA-64 Options>: Remove
explicitly undocumented and redundant mno- forms from the list.
(IA-64 Options): Remove documentation for already-deleted option
-mfused-add and the two explicitly undocumented options.  Add
@opindex for negative forms and explicitly list the -mno-forms
of options that are enabled by default.

12 days agodoc, pa: HPPA option documentation cleanup [PR122243]
Sandra Loosemore [Fri, 5 Dec 2025 17:07:21 +0000 (17:07 +0000)] 
doc, pa: HPPA option documentation cleanup [PR122243]

Note that the default for the -mlra option on HPPA was recently
changed from 0 to 1.  This option has never been documented for this
target and reload is supposed to be going away entirely soon, so I
see no reason to document it now.

gcc/ChangeLog
PR other/122243
* config/pa/pa.opt (mbig-switch): Mark obsolete option as
"Undocumented".
(mjump-in-delay): Likewise.
(mlra): Likewise.
(mnosnake, msnake): Likewise.
* doc/invoke.texi (Option Summary) <HPPA Options>: Remove
deliberately undocumented options from list.  Remove redundant
negative/positive forms from list.  Fix formatting so there is
uniformly two spaces between options on the same line.
(HPPA Options): Remove documentation for obsolete options.
Add @opindex for negative forms.  Properly list -mwsio instead
of just referring to it in the -msio docs.  Light copy-editing to
fix markup, jargon, etc.

12 days agodoc, h8300: Clean up H8/300 option and attribute documentation [PR122243]
Sandra Loosemore [Fri, 5 Dec 2025 17:07:21 +0000 (17:07 +0000)] 
doc, h8300: Clean up H8/300 option and attribute documentation [PR122243]

Comparing the documentation in invoke.texi with hs8300.opt, I spotted
a few options in the latter that were missing documentation, and added
it.

I wanted to add a link to the "monitor" attribute
referenced in the existing docs for this option, but found that was
also missing, along with docs for the "OS_Task" attribute; so I fixed
those problems while I was at it.

gcc/ChangeLog
PR other/122243
* config/h8300/h8300.opt (mexr, mno-exr): Add FIXME re ambiguity
for -mno-exr semantics.
* doc/extend.texi (H8/300 Function Attributes): Document
monitor and OS_Task attributes.
* doc/invoke.texi (Option Summary) <H8/300 Options}: Add -msx,
-ms2600, -mquickcall, -mslowbyte.  Combine -mexr and -mno-exr.
(H8/300 Options): Likewise.  Add @opindex entries for options
that have negative forms.

12 days agodoc, arc: Clean up ARC option documentation [PR122243]
Sandra Loosemore [Fri, 5 Dec 2025 17:07:20 +0000 (17:07 +0000)] 
doc, arc: Clean up ARC option documentation [PR122243]

The ARC front end presently has a large number of options that are
explicitly deprecated, either by the "Warn" option or by being
documented as such in the GCC manual.  The manual text has documented
a long list of obsolete options with a warning that they will be removed
completely in a future release since at least GCC 5, 10+ years ago.
Some of documented options have, in fact, already been deleted.

This patch does *not* delete the remaining obsolete options, but only
marks them as "Undocumented" in the .opt file and removes the
documentation to reduce clutter in the manual.  I've also added missing
index entries for the remaining options to the manual.

gcc/ChangeLog
PR other/122243
* config/arc/arc.opt: Mark -mbig-endian, -mlittle-endian,
-mmixed-code, -mno-mpy, -margonaut, -munalign-prob-threshold=,
-mannotate-align, -malign-call, -mRcq, -mRcw, -mbbit-peephole,
-mcompact-casesi, -mq-class, -mexpand-adddi, -mcrc, -mdsp-packa,
-mdvbf, -mtelephony, -mrtsc, -EB, -EL, -mrla, -mEA, and
-multcost= as "Undocumented".
* doc/invoke.texi: Remove documentation for the above options.
plus -mmac-d16 and -mmac-24 (which were already marked as
"Undocumented").  Likewise remove documentation for
-mbarrel_shifter, -mdpfp_compact, -mdpfp_fast, -mdsp_packa,
-mmac_24, -mmac_d16, -mspfp_compact, and -mspfp_fast, which
had already been deleted from arc.opt at some point.
Add index entries for the -mno- forms of remaining options that
have them.  Document positive forms of -mno-brcc and -mno-dpfp-lrsr.

12 days agoarc: Fix positive form of -mno-brcc and -mno-dpfp-lrsr options [PR122243]
Sandra Loosemore [Thu, 6 Nov 2025 00:26:04 +0000 (00:26 +0000)] 
arc: Fix positive form of -mno-brcc and -mno-dpfp-lrsr options [PR122243]

These two options are defined in the negative form and don't have the
RejectNegative property so they end up having positive forms beginning
with "-mno-no-", which is confusing.  I've inverted the sense of the
option instead (so that the positive forms are -mbrcc and
-mdpfp-lrsr).

I'm not set up to build or test gcc for ARC but this is a straightforward
change similar to fixes I've made for other target-inspecific options.
Either this fix or adding RejectNegative would break any makefiles
that use the (undocumented) -mno-no forms, though.

gcc/ChangeLog
PR other/122243
* config/arc/arc.opt (-mno-brcc, -mno-dpfp-lrsr): Redefine in
the positive sense.

12 days agocgraph: Move next/previous from symtab to toplevel_node [PR122955]
Andrew Pinski [Wed, 3 Dec 2025 21:46:43 +0000 (13:46 -0800)] 
cgraph: Move next/previous from symtab to toplevel_node [PR122955]

Currently the GC marker functions don't support chain_next on non-toplevel
tag structures (and does not error out either). So since r16-4747-g529c25ed6e0a06
if there are a lot of chained symtab_nodes (happens most likely with LTO), the GC
marker function could cause a stack overflow because of the recusive nature of the marker.

This fixes the problem by moving next/previous to toplevel_node. I had originally
thought about doing chain_next/chain_prev and using is_a<symtab_node *> to get if
it was symtab_node and then used the next/previous from there. But it was noticed that
asm_node had a next too (though not using chain_next) so adding a previous is not going
to much more space anyways; there will not be many toplevel inline-asm anyways.

Bootstraped and tested on x86_64-linux-gnu.

PR ipa/122955
gcc/ChangeLog:

* cgraph.h (toplevel_node): Add next and previous fields.
Add chain_next and chain_prev to GTY.
(symtab_node): Remove next and previous field. Remove chain_next and chain_prev
from the GTY.
(asm_node): Remove next field.
(symtab_node::next_defined_symbol): Use save_as_a<symtab_node*> around next.
(symbol_table::unregister): Likewise
(FOR_EACH_SYMBOL): Likewise
(symbol_table::first_defined_symbol): Likewise
(symbol_table::first_variable): Likewise
(symbol_table::next_variable): Likewise
(symbol_table::first_static_initializer): Likewise
(symbol_table::next_static_initializer): Likewise
(symbol_table::first_defined_variable): Likewise
(symbol_table::next_defined_variable): Likewise
(symbol_table::first_defined_function): Likewise
(symbol_table::next_defined_function): Likewise
(symbol_table::first_function): Likewise
(symbol_table::next_function): Likewise
(symbol_table::first_function_with_gimple_body): Likewise
(symbol_table::next_function_with_gimple_body): Likewise
* cgraphunit.cc (analyze_functions): Likewise
(output_in_order): Likewise
* lto-streamer-out.cc (lto_output): Use save_as_a<asm_node*> around next.
* symtab.cc (symtab_node::verify_symtab_nodes): Likewise.

gcc/lto/ChangeLog:

* lto-partition.cc (lto_1_to_1_map): Use save_as_a<asm_node*> around next.
(create_asm_partition): Likewise.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
12 days agoDaily bump.
GCC Administrator [Sat, 13 Dec 2025 00:16:34 +0000 (00:16 +0000)] 
Daily bump.

12 days agoc++: Add missing explanations for is_constructible<Abstract>
Nathaniel Shead [Thu, 11 Dec 2025 21:57:20 +0000 (08:57 +1100)] 
c++: Add missing explanations for is_constructible<Abstract>

Checking whether an abstract class type is constructible currently is
missing an explanation.  With this patch, we now get the following
output for an abstract type:

test.cpp:7:20: error: static assertion failed
    7 | static_assert(std::is_default_constructible_v<A>);
      |               ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • ‘A’ is not default constructible, because
  • error: cannot construct an object of abstract type ‘A’
  • because the following virtual functions are pure within ‘A’:
    test.cpp:3:8:
        3 | struct A {
          |        ^
    • ‘virtual void A::foo()’
      test.cpp:4:18:
          4 |     virtual void foo() = 0;
            |                  ^~~

Before this patch, the diagnostic stopped after the "A is not default
constructible, because" message.

gcc/cp/ChangeLog:

* method.cc (constructible_expr): Emit diagnostics for abstract
types.
* typeck2.cc (abstract_virtuals_error): Use more accurate
wording for default case, and remove extranneous whitespace
in favour of a nesting level.

gcc/testsuite/ChangeLog:

* g++.dg/ext/is_constructible9.C: Add to testcase.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
12 days agoFix libgomp.fortran/dep-uses-allocators.f90
Tobias Burnus [Fri, 12 Dec 2025 21:50:39 +0000 (22:50 +0100)] 
Fix libgomp.fortran/dep-uses-allocators.f90

libgomp/ChangeLog:

* testsuite/libgomp.fortran/dep-uses-allocators.f90: Properly
escape '(..)' in dg-warning.

12 days agoOpenMP/Fortran: uses_allocators - suggest 5.2 format in the warning
Tobias Burnus [Fri, 12 Dec 2025 21:44:15 +0000 (22:44 +0100)] 
OpenMP/Fortran: uses_allocators - suggest 5.2 format in the warning

Actually mention how the new 5.2+ syntax looks like when outputting
the deprecation warning for 'uses_allocators'.

gcc/fortran/ChangeLog:

* openmp.cc (gfc_match_omp_clause_uses_allocators): Mention
new syntax in deprecation warning.

libgomp/ChangeLog:

* testsuite/libgomp.fortran/dep-uses-allocators.f90: Update
dg-warning.

12 days agoOpenMP: Small fortran/intrinsic.texi + libgomp.texi update
Tobias Burnus [Fri, 12 Dec 2025 21:06:42 +0000 (22:06 +0100)] 
OpenMP: Small fortran/intrinsic.texi + libgomp.texi update

Some followup to the OpenMP 5.2 version bump - and marking some features
as partially implemented: uses_allocators (only predefined allocators),
'declare mapper' (only C/C++, some but few loose ends), map iterator
(C/C++ only - and several loose ends, most fixed by approved patches
that still have to land after minor modifications).

gcc/fortran/ChangeLog:

* intrinsic.texi (OpenMP Modules OMP_LIB and OMP_LIB_KINDS): Link
also to OpenMP 6.0, move 'partially supported' to the end of the
list of OpenMP versions. Mark 'omp_lock_hint_...' and
'omp_atv_sequential' constants as deprecated.

libgomp/ChangeLog:

* libgomp.texi (OpenMP Implementation Status): Add missing '@tab';
claim initial partial support for 'declare mapper',
'uses_allocators', and map iterators.