]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
2 months agolibstdc++: Remove trailing whitespace in debug/safe_iterator.h
Jonathan Wakely [Thu, 4 Jun 2026 12:54:02 +0000 (13:54 +0100)] 
libstdc++: Remove trailing whitespace in debug/safe_iterator.h

libstdc++-v3/ChangeLog:

* include/debug/safe_iterator.h: Remove trailing whitespace.

2 months agotestsuite: Add PowerPC future hardware compiler support checks
Jeevitha [Thu, 4 Jun 2026 10:11:35 +0000 (05:11 -0500)] 
testsuite: Add PowerPC future hardware compiler support checks

Add new effective-target procs to help write tests for future powerpc.
"check_effective_target_powerpc_future_compile_ok" checks whether the
compiler recognizes -mcpu=future (i.e., defines _ARCH_FUTURE).
"check_effective_target_powerpc_future_assemble_ok" checks whether the
assembler supports "powerpc future" instructions under -mcpu=future.
"check_powerpc_future_hw_available" checks at runtime whether the
hardware supports executing "powerpc future" instructions.

2026-06-04  Jeevitha Palanisamy  <jeevitha@linux.ibm.com>

gcc/testsuite/
* lib/target-supports.exp
(check_effective_target_powerpc_future_compile_ok): New target support
procedure.
(check_effective_target_powerpc_future_assemble_ok): Likewise.
(check_powerpc_future_hw_available): Likewise.
(is-effective-target): Register powerpc_future_hw.
(is-effective-target-keyword): Likewise.

2 months agoi386: Enable fusion and SSE reduction tunings for znver6
vekumar [Tue, 2 Jun 2026 11:04:10 +0000 (16:34 +0530)] 
i386: Enable fusion and SSE reduction tunings for znver6

gcc/ChangeLog:

* config/i386/x86-tune.def (X86_TUNE_FUSE_ALU_AND_BRANCH_MEM): Enable
for m_ZNVER6.
(X86_TUNE_FUSE_ALU_AND_BRANCH_MEM_IMM): Likewise.
(X86_TUNE_SSE_REDUCTION_PREFER_PSHUF): Likewise.

2 months agoada: Remove conversion to an if-statement
Viljar Indus [Wed, 6 May 2026 10:05:22 +0000 (13:05 +0300)] 
ada: Remove conversion to an if-statement

There is no need to convert the ignored pragmas into if-statements
with a statically false condition and a null body since the
ignored ghost node removal should take care of this removal
from now on.

This simplifies the detection of those ignored pragmas and
makes the code more easily identifiable and common with ignored
ghost code that should behave similarly to ignored asseritons.

gcc/ada/ChangeLog:

* expander.adb: Handle pragma statements in the expander.
* sem_ch6.adb (Check_Statement_Sequence): Handle cases where
an ignored assertion pragma is at the end of a function body
that is known to trigger an assertion.
* sem_prag.adb (Analyze_Pragma): Remove the if-statement
creation for ignored pragmas. Relocate checks for assertion
pragma conditions that were performed on these transformed
if-statements here.
* sem_res.adb (Resolve_Short_Circuit): Remove the code for
ignored assertion pragmas.
* sem_util.adb (Original_Aspect_Pragma_Name): use the identifier
name for pragma Check only when it did not come from source.
* tbuild.adb (Make_Implicit_Loop_Statement): Adjust the code
for ignored Check pragmas.

2 months agoada: Remove unnecessary workaround
Viljar Indus [Thu, 16 Apr 2026 11:02:30 +0000 (14:02 +0300)] 
ada: Remove unnecessary workaround

Technically this is no longer necessary as everything will be
removed along with the ignored ghost code removal.

gcc/ada/ChangeLog:

* sem_prag.adb (Analyze_Pragma): Remove overflow supression
workaround.

2 months agoada: Apply ignored ghost regions for ignored pragmas
Viljar Indus [Wed, 15 Apr 2026 12:55:33 +0000 (15:55 +0300)] 
ada: Apply ignored ghost regions for ignored pragmas

gcc/ada/ChangeLog:

* ghost.adb (Set_Ghost_Mode): Create ignored ghost regions
for ignored pragamas.
* sem_prag.adb (Analyze_Pragma): Mark ignored pragmas checks as
ignored ghost pragmas.

2 months agoada: Fix finalize address for arrays of protected types
Artur Pietrek [Thu, 21 May 2026 13:29:10 +0000 (15:29 +0200)] 
ada: Fix finalize address for arrays of protected types

Make_Address_For_Finalize emits a -Descriptor_Size shift whenever
the array's first subtype is unconstrained, but does not check whether
the object has a controlled component. For arrays of protected types
Has_Controlled_Component is False so no dope vector is allocated, but
at scope exit the incorrect finalize address is dereferenced, which
may lead to EXCEPTION_ACCESS_VIOLATION, or silent error.

gcc/ada/ChangeLog:

* exp_ch7.adb (Make_Address_For_Finalize): check
Has_Controlled_Component predicate before emitting the shift to be
consistant with what Is_Constr_Array_Subt_With_Bounds says.

2 months agoada: Fix again internal error on abstract primitive with access result
Eric Botcazou [Wed, 20 May 2026 17:19:42 +0000 (19:19 +0200)] 
ada: Fix again internal error on abstract primitive with access result

The previous fix was papering over the root cause, which is that the itype
built for the anonymous access result type of a derived subprogram is given
the subprogram itself as Scope, instead of the scope of the subprogram. The
incorrect code also temporarily sets the Scope of the subprogram to itself!

gcc/ada/ChangeLog:

* accessibility.adb (Type_Access_Level): Revert ealier change.
* sem_ch3.adb (Derive_Subprogram.Replace_Type): Set the Scope of
the new anonymous access type to the scope of the derived type.
Do not (temporarily) sets the Scope of the subprogram to itself.

2 months agoada: Reuse Is_Rewrite_Substitution where possible
Piotr Trojanek [Mon, 18 May 2026 18:19:07 +0000 (20:19 +0200)] 
ada: Reuse Is_Rewrite_Substitution where possible

Code cleanup; semantics is unaffected.

gcc/ada/ChangeLog:

* errout.adb, exp_util.adb, sem_case.adb, sem_ch4.adb, sem_res.adb:
Replace low-lever inequality with a high-level routine.

2 months agoada: Check intrinsic subprograms specified by an aspect
Piotr Trojanek [Wed, 20 May 2026 14:53:34 +0000 (16:53 +0200)] 
ada: Check intrinsic subprograms specified by an aspect

We only checked intrinsic subprograms specified by pragmas that come from
source, but this missed subprograms specified by an aspect (because its
internally generated corresponding pragma doesn't come from source).

gcc/ada/ChangeLog:

* sem_intr.adb (Check_Intrinsic_Subprogram): Recognize pragmas that
do not come from source because they come from aspect specification.

2 months agoada: Remove unused global variable
Ronan Desplanques [Tue, 19 May 2026 15:21:41 +0000 (17:21 +0200)] 
ada: Remove unused global variable

This variable was used for the "Community" variant of GNAT Pro. That's
gone now, so remove the variable.

gcc/ada/ChangeLog:

* opt.ads (Latest_Ada_Only): Remove.
* par-prag.adb (Prag): Adapt to removal.
* sem_prag.adb (Analyze_Pragma): Likewise.
* switch-c.adb (Scan_Front_End_Switches): Likewise.
* usage.adb (Usage): Likewise.

2 months agoada: Rename Apply_Accessibility_Check_For_Parameter
Eric Botcazou [Mon, 18 May 2026 23:16:03 +0000 (01:16 +0200)] 
ada: Rename Apply_Accessibility_Check_For_Parameter

The routine is also used for Ada 2012's stand-alone objects of an anonymous
access type, that is to say not only for access parameters. It is invoked on
an explicit or implicit conversion of the object to another access type.

gcc/ada/ChangeLog:

* accessibility.ads (Apply_Accessibility_Check_For_Parameter):
Rename to...
(Apply_Accessibility_Check_For_Conversion): ...this.
* accessibility.adb (Apply_Accessibility_Check_For_Parameter):
Rename to...
(Apply_Accessibility_Check_For_Conversion): ...this.
* exp_attr.adb (Expand_N_Attribute_Reference) <Attribute_Access>:
Adjust to above renaming.
* exp_ch4.adb (Expand_N_Type_Conversion): Likewise.
* exp_ch6.adb (Expand_Actuals): Likewise.

2 months agoada: Set Is_Local_Anonymous_Access on the anonymous access type of return objects
Eric Botcazou [Mon, 18 May 2026 22:54:00 +0000 (00:54 +0200)] 
ada: Set Is_Local_Anonymous_Access on the anonymous access type of return objects

It is already set on the anonymous access type of function results and will
prevent return objects from being treated as Ada 2012's stand-alone objects,
thus make it easier to enforce the RM 3.10.2(13.2) rule.

gcc/ada/ChangeLog:

* einfo.ads (Is_Local_Anonymous_Access): Mention return objects.
* accessibility.adb (Type_Access_Level): Call Enclosing_Subprogram.
* sem_ch3.adb (Find_Type_Of_Object): Set Is_Local_Anonymous_Access
on the anonymous access type of return objects.

2 months agoada: Null pointer dereference in Adjust for bounded indefinite holders.
Steve Baird [Mon, 18 May 2026 21:55:38 +0000 (14:55 -0700)] 
ada: Null pointer dereference in Adjust for bounded indefinite holders.

In the Adjust procedure for Ada.Containers.Bounded_Indefinite_Holders.Holder,
check to see whether the holder is empty before trying to copy its
(possibly nonexistent) element value.

gcc/ada/ChangeLog:

* libgnat/a-cbinho.adb (Adjust): Avoid null pointer dereference.

2 months agoada: Fix missing error for too deep accessibility level in aggregate return
Eric Botcazou [Wed, 13 May 2026 07:46:31 +0000 (09:46 +0200)] 
ada: Fix missing error for too deep accessibility level in aggregate return

The issue occurs when an access discriminant in an aggregate return is set
to a value obtained by means of a function call written in prefixed form.

The change also adjusts the implementation of the RM 6.5(5.9) rule, which
was hijacking the machinery of dynamic accessibility checks for a static
accessibility check, thus incorrectly flagging stand-alone objects of an
anonymous access type in Ada 2012 and later, per the RM 3.10.2(19.2) rule.

It also merges the implementations of the RM 3.10.2(28) rule for named and
anonymous access types in a single block of code.

gcc/ada/ChangeLog:

* einfo.ads (Is_Local_Anonymous_Access): Mention access results.
* accessibility.adb (Accessibility_Level): Add missing guard on
the entity for error cases.  In the component cases, retrieve the
function call if the prefix is a captured function call.  Remove
the bypass returning the library level in a return context if the
prefix is a function call.  Call Function_Call_Or_Allocator_Level
in this case when the level of the prefix is tied to that of the
result of the enclosing function.
(Check_Return_Construct_Accessibility): Change the implementation
to do a bona-fide static accessibility check.
* sem_attr.adb (Resolve_Attribute) <Attribute_Access>: Merge the
implementations of the RM 3.10.2(28) rule for named and anonymous
access types.
* sem_ch6.adb (Analyze_Expression_Function): Set the Ekind of the
entity created for the body very early.
* sem_util.adb (In_Return_Value): Fix typo in comment.

2 months agoada: Fix ICE on static predicate when all case alternatives are False
Mathias Aparicio [Mon, 4 May 2026 08:45:50 +0000 (10:45 +0200)] 
ada: Fix ICE on static predicate when all case alternatives are False

Before this patch, creating a pragma predicate with the static keyword
whose body included a case-expression where every alternative was
statically evaluated to false leads to an ICE.

When the case expression had all alternatives resolved to False,
Build_Discrete_Static_Predicate.Get_Rlist returned an Empty list and
later in the code Next was called on the Empty List.

Now return false_range in this case.

gcc/ada/ChangeLog:

* sem_ch13.adb (Build_Discrete_Static_Predicate.Get_RList): If
case expression alternatives are False return False_Range.

2 months agoada: Get rid of Effective_Extra_Accessibility function
Eric Botcazou [Sat, 16 May 2026 16:58:41 +0000 (18:58 +0200)] 
ada: Get rid of Effective_Extra_Accessibility function

The computation of accessibility levels does not consistently look through
object renamings when extra accessibility objects are used.  This attempts
to address the issue by making Extra_Accessibility do it automatically.

gcc/ada/ChangeLog:

* einfo.ads (Extra_Accessibility): Rename to...
(Extra_Accessibility_Of_Object): ...this and adjust description.
* gen_il-fields.ads (Opt_Field_Enum): Replace Extra_Accessibility
with Extra_Accessibility_Of_Object.
* gen_il-gen-gen_entities.adb (Constant_Or_Variable_Kind): Ditto.
(Formal_Kind): Ditto.
* accessibility.ads (Effective_Extra_Accessibility): Rename to...
(Extra_Accessibility): ...this.
* accessibility.adb (Apply_Accessibility_Check_For_Parameter): Do
not manually look through renamings and adjust.
(Effective_Extra_Accessibility): Rename to...
(Extra_Accessibility): ...this and add guard.
* exp_ch3.adb (Expand_N_Object_Declaration): Adjust.
* exp_ch4.adb (Expand_N_Type_Conversion): Likewise.
* exp_ch5.adb (Expand_N_Assignment_Statement): Likewise.
* exp_ch6.adb (Expand_Actuals): Likewise.
* sem_ch3.adb (Derive_Subprogram): Likewise.
* sem_ch6.adb (Create_Extra_Formals): Likewise.

2 months agoada: Disable a couple of static accessibility checks in dynamic cases
Eric Botcazou [Sat, 16 May 2026 12:09:54 +0000 (14:09 +0200)] 
ada: Disable a couple of static accessibility checks in dynamic cases

In accordance with the RM 3.10.2(19,19.1,19.2) rules.

gcc/ada/ChangeLog:

* exp_ch4.adb (Expand_Allocator_Expression): In the case of access
discriminants, pass Zero_On_Dynamic_Level to compute the static
accessibility level of the expression.
* sem_res.adb (Check_Aliased_Parameter): Pass Zero_On_Dynamic_Level
to compute the static accessibility level of actual parameters.

2 months agoada: Fix small inaccuracy in Function_Call_Or_Allocator_Level
Eric Botcazou [Sat, 16 May 2026 11:35:22 +0000 (13:35 +0200)] 
ada: Fix small inaccuracy in Function_Call_Or_Allocator_Level

In the case of an object declaration, the function returns the depth of the
enclosing static scope, instead of that of the enclosing dynamic scope like
its parent function Accessibility_Level.

The change contains a couple of cleanups in the expander, which resort to
calling Accessibility_Level in more cases instead of doing manual work.

gcc/ada/ChangeLog:

* accessibility.ads (Accessibility_Level_Kind): Tweak description.
* accessibility.adb (Function_Call_Or_Allocator_Level): Recurse on
the defining identifier for an N_Object_Declaration node.
(Accessibility_Level): Minor tweaks.
* exp_ch3.adb (Expand_N_Object_Declaration): Do not special case
function calls in the computation of accessibility levels.
* exp_ch5.adb (Expand_N_Assignment_Statement): Do not manually
compute the accessibility level of the LHS.

2 months agoada: Inline for proof without creating extra objects
Piotr Trojanek [Wed, 13 May 2026 14:56:03 +0000 (16:56 +0200)] 
ada: Inline for proof without creating extra objects

When inlining subprogram calls in GNATprove mode, we were creating object
declarations only to force checks that would be otherwise missed with object
renamings. Now ghat GNATprove emits those checks for object renamings anyway
(as required by Ada 2022), we no longer need those extra objects.

gcc/ada/ChangeLog:

* inline.adb (Establish_Actual_Mapping_For_Inlined_Call): Do not create
object declarations when actual is captured in an object renaming.

2 months agoada: Simplify code with membership test
Piotr Trojanek [Sun, 17 May 2026 18:54:01 +0000 (20:54 +0200)] 
ada: Simplify code with membership test

Code cleanup; semantics is unaffected.

gcc/ada/ChangeLog:

* sem_aux.adb (Is_Definite_Subtype): Only call Ekind if necessary.

2 months agoada: Simplify code with membership test
Piotr Trojanek [Mon, 24 Jun 2024 09:34:15 +0000 (11:34 +0200)] 
ada: Simplify code with membership test

Code cleanup; semantics is unaffected.

gcc/ada/ChangeLog:

* sem_ch13.adb (Rep_Item_Too_Late): Simplify with membership test.

2 months agoada: Tune layout in membership test
Piotr Trojanek [Fri, 21 Jun 2024 15:22:28 +0000 (17:22 +0200)] 
ada: Tune layout in membership test

Whitespace cleanup.

gcc/ada/ChangeLog:

* freeze.adb, sem_ch13.adb: Tune whitespace.

2 months agoada: Reuse Boolean_Literals in rewriting of accessibility checks
Piotr Trojanek [Tue, 25 Mar 2025 12:34:11 +0000 (13:34 +0100)] 
ada: Reuse Boolean_Literals in rewriting of accessibility checks

Code cleanup; semantics is unaffected.

gcc/ada/ChangeLog:

* exp_ch4.adb (Expand_N_In): Rewrite with True/False entity array.

2 months agoada: Remove redundant guard against empty list of declarations
Piotr Trojanek [Thu, 20 Mar 2025 18:35:55 +0000 (19:35 +0100)] 
ada: Remove redundant guard against empty list of declarations

Code cleanup; when First is called on No_List, it intentionally returns Empty.

gcc/ada/ChangeLog:

* exp_ch9.adb (Scan_Declarations): Remove redundant guard.

2 months agoada: Enforce comment with assertions
Piotr Trojanek [Sun, 17 May 2026 11:42:14 +0000 (13:42 +0200)] 
ada: Enforce comment with assertions

Code cleanup.

gcc/ada/ChangeLog:

* exp_util.adb (Full_Qualified_Name_String): Add assertions; fix style.

2 months agoada: Simplify construction of internal string from characters
Piotr Trojanek [Sun, 17 May 2026 11:39:12 +0000 (13:39 +0200)] 
ada: Simplify construction of internal string from characters

Reuse a variant of Store_String_Char routine that accepts a Character parameter
and internally calls Get_Char_Code. Code cleanup.

gcc/ada/ChangeLog:

* exp_attr.adb (Expand_N_Attribute_Reference): Store chars without
converting the actual parameters.
* exp_ch11.adb (Null_String): Likewise.
* exp_disp.adb (Make_DT): Likewise.
* exp_util.adb (Fully_Qualified_Name_String): Likewise.
* sem_attr.adb (Analyze_Attribute): Likewise.
* sem_dist.adb (Full_Qualified_Name): Likewise.
* sem_prag.adb (Process_Interface_Name, Set_Encoded_Interface_Name):
Likewise.
* stringt.adb (Store_String_Chars): Likewise.

2 months agoada: Fix unbalanced parens in comment
Piotr Trojanek [Thu, 26 Dec 2024 12:41:26 +0000 (13:41 +0100)] 
ada: Fix unbalanced parens in comment

Code cleanup.

gcc/ada/ChangeLog:

* sem_ch9.adb (Analyze_Requeue): Fix unbalanced parens.

2 months agoada: Use collective entity kinds for access-to-subprogram types
Piotr Trojanek [Fri, 25 Apr 2025 14:28:33 +0000 (16:28 +0200)] 
ada: Use collective entity kinds for access-to-subprogram types

Code cleanup; semantics is unaffected.

gcc/ada/ChangeLog:

* exp_ch4.adb, sem_attr.adb, sem_ch3.adb: Use Access_Protected_Kind
and Access_Subprogram_Kind where possible.

2 months agoada: Move gnatmake-specific logic from libgnat to gnatmake
Piotr Trojanek [Tue, 14 Apr 2026 10:18:09 +0000 (12:18 +0200)] 
ada: Move gnatmake-specific logic from libgnat to gnatmake

We had a complicated, ancient workaround for gnatmake that simply hardcoded
library names to "libXXX.a".

Note: if we ever wanted to make this platform-specific, it should probably use
__gnat_object_library_extension, which is currently used by gnatlink, but is
equal to "libXXX.a" on every platform except for VMS, which is unsupported.

gcc/ada/ChangeLog:

* adaint.c (__gnat_library_template): Move logic to gnatmake.
* make.adb (Get_Library_File): Use simple single template.

2 months agoada: Guard agains empty switches in GNAT.Command_Line.Getopt
Viljar Indus [Thu, 14 May 2026 12:05:21 +0000 (15:05 +0300)] 
ada: Guard agains empty switches in GNAT.Command_Line.Getopt

Checks for the first character in Switches being an '*'
did not include guards against an empty string in all locations.

gcc/ada/ChangeLog:

* libgnat/g-comlin.adb (Getopt): Check if Switches
are empty before looking at the first element.

2 months agoada: Fix missing error for too deep access result in generic function
Eric Botcazou [Thu, 14 May 2026 09:43:21 +0000 (11:43 +0200)] 
ada: Fix missing error for too deep access result in generic function

The problem is that, unlike in the nongeneric case, the analysis of the
access result definition in the generic function specification does not
cause Is_Local_Anonymous_Access to be set on the anonymous access type
created for the result.

The fix exposes a loophole in the calculation of the accessibility level
for formal objects of generic subprograms, as well as two illegal cases
in the GNAT.CPP_Exceptions unit of the run-time library.

gcc/ada/ChangeLog:

* accessibility.ads: Alphabetize declarations.
(Subprogram_Access_Level): Beef up description.
* accessibility.adb (Accessibility_Level): Deal with formal objects
of generic subprograms.
* sem_ch12.adb (Analyze_Generic_Subprogram_Declaration): Set the
Is_Local_Anonymous_Access flag on the access result type, if any.
* libgnat/g-cppexc.ads (Get_Access_To_Tagged_Object): Do not declare
the formal type parameter as abstract.
* libgnat/g-cppexc.adb (Get_Access_To_Object): Fix illegal code.
(Get_Access_To_Tagged_Object): Likewise.

2 months agoada: Attribute reference in subunit causes compiler Assertion_Error
Steve Baird [Wed, 13 May 2026 22:56:17 +0000 (15:56 -0700)] 
ada: Attribute reference in subunit causes compiler Assertion_Error

In the case of a separate subunit subprogram body, do not take a path that
is intended for the case where there is no enclosing declaration list.
The subunit's stub has an enclosing declaration list.

gcc/ada/ChangeLog:

* exp_attr.adb (Build_And_Insert_Type_Attr_Subp): Test for subunit case before
concluding that a subprogram body has no enclosing declaration list.

2 months agoada: GNATprove inlining/unrolling messages now controlled by two Booleans
Johannes Kanig [Wed, 29 Apr 2026 08:33:13 +0000 (08:33 +0000)] 
ada: GNATprove inlining/unrolling messages now controlled by two Booleans

The GNATprove-related messages for inlining and unrolling are now
controlled by two package-level Booleans instead of a Debug flag.

gcc/ada/ChangeLog:

* inline.ads: Introduce two new Boolean flags
* inline.adb (Cannot_Inline): Modify the negative message into
a warning, and use new flag
* sem_res.adb (Resolve_Call): Use new flag to guard issue of msg
* debug.adb: Debug flag now unused for GNATprove

2 months agoada: Fix file access time information in __gnat_copy_attribs
Tonu Naks [Fri, 8 May 2026 08:08:31 +0000 (08:08 +0000)] 
ada: Fix file access time information in __gnat_copy_attribs

gcc/ada/ChangeLog:

* adaint.c (__gnat_copy_attribs): Fix call to SetFileTime

2 months agoada: Remove forced inlining of generics for configurable run times
Viljar Indus [Mon, 11 May 2026 08:44:11 +0000 (11:44 +0300)] 
ada: Remove forced inlining of generics for configurable run times

This section of code date backs to the time when the frontend
was handling pragma Inline_Always. Technically this is no longer needed.

gcc/ada/ChangeLog:

* sem_ch12.adb (Analyze_Package_Instantiation): Remove
forced inlining in configurable run times.

2 months agoada: Minor cosmetic refactoring
Marc Poulhiès [Thu, 23 Apr 2026 09:27:58 +0000 (11:27 +0200)] 
ada: Minor cosmetic refactoring

Rewrite the sequence of:
 if V = Enum_1
   or else V = Enum_2
   or else V in Enum_R
   ...

with a membership test.

gcc/ada/ChangeLog:

* sem_util.adb (Enclosing_Declaration): Refactor membership test.

2 months agoada: Lift restriction on Valid_Scalars attribute for private tagged types
Eric Botcazou [Sat, 9 May 2026 13:50:14 +0000 (15:50 +0200)] 
ada: Lift restriction on Valid_Scalars attribute for private tagged types

This just generalizes a trick already used for discriminant checks.

gcc/ada/ChangeLog:

* doc/gnat_rm/implementation_defined_attributes.rst (Valid_Scalars):
Remove reference to private tagged types.
* exp_attr.adb  (Expand_N_Attribute_Reference) <Valid_Scalars>: Do
not bail out for private tagged types.
* sem_attr.adb (Analyze_Attribute) <Valid_Scalars>: Do not warn for
for private tagged types.
* sem_ch3.adb (Is_Visible_Component): Accept any component reference
whose prefix is a type conversion that does not come from source.
* gnat_rm.texi: Regenerate.

2 months agoada: Fix ICE on Case_Expression a Pragma_Predicate
Mathias Aparicio [Mon, 27 Apr 2026 08:53:07 +0000 (10:53 +0200)] 
ada: Fix ICE on Case_Expression a Pragma_Predicate

Before this patch, Case_Expression inside a Pragma_Predicate with a
non-static alternative (like a function call) led the Case_Expression
Node to survive unexpanded and caused gnat_to_gnu to abort
(gcc_unreachable for N_Case_Expression).

The guard in Expand_N_Case_Expression checking for non-static
Predicate_Aspect used Has_Dynamic_Predicate_Aspect, which was false
even with a function call in a Case_Expression alternative.

Now add Is_Predicate_Static to the check, which fixes the bug.
This function was private to the sem_ch13 package, so it was made public.

gcc/ada/ChangeLog:

* sem_ch13.ads (Is_Predicate_Static): Public declaration,
from the private function in the package body
* sem_ch13.adb (Is_Predicate_Static): Remove the now-redundant
local declaration
* exp_ch4.adb (Expand_N_Case_Expression): Add Is_Predicate_Static
to the static guard

2 months agoada: Fix directories being identified as executables on Windows
Mathias Aparicio [Thu, 9 Apr 2026 09:55:37 +0000 (11:55 +0200)] 
ada: Fix directories being identified as executables on Windows

On Windows the `__gnat_is_executable_file_attr` checks if a file
is executable but does not check if it is a regular file or a directory.

This may lead to the execution of a directory which will make the program
crash. This patch fixes the issue by checking if the file is regular
before checking if it is executable.

gcc/ada/ChangeLog:

* adaint.c (__gnat_is_executable_file_attr): Initialize
attr->regular using __gnat_is_regular_file_attr. Directly return
0 before checking if executable if the attr->regular is 0.
Remove the now unnecessary check for invalid_file_attributes.

2 months agoada: Update the documentation of Iterable in the GNAT RM
Claire Dross [Tue, 5 May 2026 13:11:35 +0000 (15:11 +0200)] 
ada: Update the documentation of Iterable in the GNAT RM

It now takes into account the possibility to add a Constant_Reference function
instead of an Element function.

gcc/ada/ChangeLog:

* doc/gnat_rm/implementation_defined_aspects.rst (Aspect Iterable):
A Constant_Reference function can be supplied instead of an Element
function.
* gnat_rm.texi: Regenerate.

2 months agoada: Small preliminary cleanup in Sem_Ch3.Is_Visible_Component
Eric Botcazou [Sat, 9 May 2026 09:06:52 +0000 (11:06 +0200)] 
ada: Small preliminary cleanup in Sem_Ch3.Is_Visible_Component

There should be no functional changes.

gcc/ada/ChangeLog:

* sem_ch3.adb (Is_Visible_Component): Fold Is_Local_Type predicate,
reason only on type entities, and tidy up specific processing added
for ACATS B730006 test.

2 months agoada: Improve layout of TSD (Type Specific Data) record for tagged types
Eric Botcazou [Thu, 7 May 2026 11:40:11 +0000 (13:40 +0200)] 
ada: Improve layout of TSD (Type Specific Data) record for tagged types

Compiling Ada.Tags with -gnatRh shows unused bits in the Type_Specific_Data
record type for 64-bit targets.  This saves one 64-bit word in it for them.

gcc/ada/ChangeLog:

* libgnat/a-tags.ads (Type_Specific_Data): Move Boolean components
to right after Natural components and put Is_Abstract last.
* exp_disp.adb (Make_DT): Adjust to above reordering.

2 months agoada: Fix checking context of Initialized attribute
Viljar Indus [Thu, 7 May 2026 11:40:50 +0000 (14:40 +0300)] 
ada: Fix checking context of Initialized attribute

The initialized attribute is a special attribute that can only
be used in places where ghost code can be used.

However in those cases we have no ghost entity to check. Add
guards for this situation inside Check_Ghost_Context.Is_OK_Statement.

gcc/ada/ChangeLog:

* ghost.adb (Is_OK_Statement): Avoid checking for policies and
levels when checking the context of the Initialized attribute.

2 months agoada: Basic support for a new SPARK attribute At
Piotr Trojanek [Thu, 7 May 2026 14:37:01 +0000 (16:37 +0200)] 
ada: Basic support for a new SPARK attribute At

For now, only basic legality checks are present. Expansion is not ready yet.
This should be enough to start implementing the backend support in GNATprove.

gcc/ada/ChangeLog:

* exp_attr.adb (Expand_N_Attribute_Reference): Do not expand new
attribute.
* par-ch4.adb (Scan_Apostrophe): Parse 'At as an attribute reference;
otherwise, it would be parsed as a keyword.
* sem_attr.adb (Analyze_Attribute): Basic checks for new attribute.
(Eval_Attribute): New attribute will never be evaluated.
* snames.ads-tmpl: (Preset Names): "at" is now also an attribute, not
just a keyword.
(Attribute_Id): New attribute identifier.

2 months agoada: Fix bogus validity check failure for FP component of array with reverse SSO
Eric Botcazou [Wed, 6 May 2026 08:44:28 +0000 (10:44 +0200)] 
ada: Fix bogus validity check failure for FP component of array with reverse SSO

It comes from a thinko in Sem_Util.In_Reverse_Storage_Order_Object: only the
innermost enclosing composite type needs to be considered by the predicate.

gcc/ada/ChangeLog:

* sem_util.ads (In_Reverse_Storage_Order_Object): Adjust.
* sem_util.adb (In_Reverse_Storage_Order_Object): Rewrite.

2 months agoada: Complete removal of obsolete project manager sources
Piotr Trojanek [Tue, 14 Apr 2026 10:49:49 +0000 (12:49 +0200)] 
ada: Complete removal of obsolete project manager sources

Remove a leftover from a no-longer-existing project manager.

gcc/ada/ChangeLog:

* adaint.c (__gnat_prj_add_obj_files): Remove; files that referenced
this variable were removed years ago.

2 months agoada: Improve error message for premature record freezing
Mathias Aparicio [Wed, 1 Apr 2026 13:25:14 +0000 (15:25 +0200)] 
ada: Improve error message for premature record freezing

When a record is frozen it must be completely defined. This requires that
all of its components' types must also be completely defined
ARM 3.11.1 (8).

Before this patch, if a record was frozen while one of its components
was of a private type, the compiler complained that the record had a
private component, although privacy was not the root issue.

Now, the compiler states the actual problem directly: the type is not
completely defined.

gcc/ada/ChangeLog:

* freeze.adb (Check_And_Freeze_Type): Emit a more precise error
message when a component's frozen record is incompletely defined
instead of printing private component error.
* sem_util.ads (Incompletely_Defined): New function that
traverses recursively a type and returns the first incompletely
defined component or itself if it is incompletely defined.
* sem_util.adb (Incompletely_Defined): Likewise.
(Is_Incompletely_Defined): Refactor to a test of the new
Incompletely_Defined function for equality with Empty.

2 months agoada: Fix fallout of latest change to Valid_Scalars attribute
Eric Botcazou [Wed, 6 May 2026 16:52:59 +0000 (18:52 +0200)] 
ada: Fix fallout of latest change to Valid_Scalars attribute

The attribute does not work for all private tagged types, but this was not
detected in the case where the full view alone is tagged.

gcc/ada/ChangeLog:

PR ada/124923
* exp_attr.adb  (Expand_N_Attribute_Reference) <Valid_Scalars>: Also
bail out for a private type whose full view alone is tagged.
* sem_attr.adb (Analyze_Attribute) <Valid_Scalars>: Also warn for a
private type whose only full view alone is tagged.

2 months agoada: Avoid use-before-definition within library unit subprograms.
Steve Baird [Fri, 1 May 2026 20:06:52 +0000 (13:06 -0700)] 
ada: Avoid use-before-definition within library unit subprograms.

When the compiler builds a subprogram for an attribute (either Put_Image
or one of the streaming attributes), it needs to be inserted at a place
in the tree where all callers can refer to it.
In some cases involving library unit subprograms, that insertion point was
chosen incorrectly. Gigi would then fail an assertion while processing
a call to a procedure that had not yet been declared.

gcc/ada/ChangeLog:

* exp_attr.adb
(Expand_N_Attribute_Reference.Build_And_Insert_Type_Attr_Subp):
handle the case of a library unit subprogram body; do not assume
that every subprogram body has an enclosing declaration list.

2 months agoada: Reorder code for pragma Interrupts_System_By_Default
Piotr Trojanek [Thu, 30 Apr 2026 13:36:08 +0000 (15:36 +0200)] 
ada: Reorder code for pragma Interrupts_System_By_Default

Put code for Interrupts_System_By_Default in alphabetic order. Code cleanup.

gcc/ada/ChangeLog:

* par-prag.adb (Prag): Fix order.
* sem_prag.adb (Analyze_Pragma, Sig_Flags): Likewise.
* snames.ads-tmpl (Preset Names, Pragma_Id): Likewise.

2 months agoada: Fix internal error on private tagged types in instance with -gnateV
Eric Botcazou [Sat, 2 May 2026 09:09:18 +0000 (11:09 +0200)] 
ada: Fix internal error on private tagged types in instance with -gnateV

The problem is that the full view of a private tagged type, which is visible
in the generic unit, is not restored when expanding -gnateV in the instance.

The fix uses a two-pronged approach:

  1. the Valid_Scalars attribute, on which -gnateV is piggybacked, is fixed
     to properly handle tagged extensions (only the components declared in
     the root type are currently tested for validity).

  2. the special case for tagged extensions in instance bodies implemented
     by Try_Selected_Component_In_Instance is extended to whole instances.

gcc/ada/ChangeLog:

PR ada/124923
* exp_attr.adb (Build_Record_VS_Func): Rename first parameter, fix
description and implement support for tagged extensions.
(Expand_N_Attribute_Reference) <Attribute_Valid_Scalars>: Also bail
out for the class-wide type of private tagged types and Adjust call
to Build_Record_VS_Func.
* sem_attr.adb (Analyze_Attribute) <Attribute_Valid_Scalars>: Also
warn for the class-wide type of private tagged types.
* sem_ch4.adb (Try_Selected_Component_In_Instance): Extend a special
case from instance bodies to whole instances.
* sem_util.ads (Validated_View): Adjust description.
* sem_util.adb (Validated_View): Do not recurse on the parent type
for tagged extensions.

2 months agoada: Support Constant_Reference in Iterable aspect
Claire Dross [Fri, 17 Apr 2026 15:17:13 +0000 (17:17 +0200)] 
ada: Support Constant_Reference in Iterable aspect

A Constant_Reference function returning an anonymous access-to-constant
type can be supplied instead of the Element primitive to allow
iteration over elements of a container.

gcc/ada/ChangeLog:

* exp_ch5.adb (Expand_Formal_Container_Element_Loop): Use
Constant_Reference instead of Element if necessary.
* sem_ch13.adb (Resolve_Iterable_Operation): Check Constant_Reference.
(Validate_Iterable_Aspect): Handle Constant_Reference if supplied.
* sem_ch5.adb (Analyze_Loop_Parameter_Specification): Iteration over
elements of a container is allowed if Constant_Reference is supplied.
* sem_util.adb (Get_Iterable_Type_Primitive): Fix assertion.
* snames.ads-tmpl (Name_Constant_Reference): New name.

2 months agoada: Allow limited type initialization via constructors
Javier Miranda [Thu, 30 Apr 2026 18:30:42 +0000 (18:30 +0000)] 
ada: Allow limited type initialization via constructors

This patch extends the currrent support for constructors to support the
initialization of limited types.

gcc/ada/ChangeLog:

* errout.adb (Set_Msg_Node): Improve readability of message for
constructors name, replacing the internal compiler name
generated for direct attribute definitions with a nicer name.
* erroutc.ads (Replace_With_Attribute_Definition): Promote from
a nested subprogram declaration to a public package-level
declaration.
* erroutc.adb (Replace_With_Attribute_Definition): Move its
implementation to package level.
* exp_attr.adb (Expand_N_Attribute_Reference [Attribute_Make]):
Code cleanup; handle assignment statement and limited type
object declaration.
* exp_ch3.adb (Build_Implicit_Parameterless_Constructor): Add
comment.
(Build_Default_Simple_Initialization): Add comment.
* exp_ch4.adb (Expand_N_Allocator): Fix No_Initialization for
internally generated allocators of types with constructors.
* exp_ch6.adb (Prepend_Constructor_Procedure_Prologue): Install
formals and refactor its body to be consistent with the GNAT
style.
* sem_ch3.adb (OK_For_Limited_Init_In_05): Accept T'Make since
it is semantically equivalent to a function call.
* sem_ch6.adb (Analyze_Direct_Attribute_Definition): Handle
incomplete and private type declarations.
* sem_ch13.adb (Diagnose_Misplaced_Aspects): Remove misleading
error for aspect 'Initializes.
* sem_res.adb (Resolve_Actuals): Skip check on the first actual
of init-proc and constructors because the constructor may be
invoked to initialize a constant object, which is allowed.

2 months agoada: Revert "Remove unnecessary workaround"
Viljar Indus [Thu, 30 Apr 2026 13:15:28 +0000 (16:15 +0300)] 
ada: Revert "Remove unnecessary workaround"

This reverts commit 5c0785d62ca44b9073e543b2b3dbb04f0aca83af.

2 months agoada: Call back-end even in case of errors
Johannes Kanig [Fri, 10 Apr 2026 00:06:45 +0000 (00:06 +0000)] 
ada: Call back-end even in case of errors

In GNATprove mode, still invoke the back end when frontend compilation
errors are present, so the back-end has a chance to emit error messages
for SARIF report generation.

gcc/ada/ChangeLog:

* gnat1drv.adb (Gnat1drv): In GNATprove mode, call the
back end before exiting on compilation errors.

2 months agoada: Adjust bugbox URL in GNATprove mode
Johannes Kanig [Wed, 29 Apr 2026 01:29:38 +0000 (01:29 +0000)] 
ada: Adjust bugbox URL in GNATprove mode

When an FSF frontend crash happens under GNATprove_Mode, the bugbox
should point users to the SPARK repository instead of the GCC bug
tracker.

Keep the existing GCC bug-report instructions for other FSF tools.

gcc/ada/ChangeLog:

* comperr.adb (Compiler_Abort): Use the SPARK bug-report URL in
GNATprove mode only, and keep the GCC bug-report URL for other
FSF tools.

2 months agoDaily bump.
GCC Administrator [Thu, 4 Jun 2026 08:18:58 +0000 (08:18 +0000)] 
Daily bump.

2 months agoAdd 86ff0e88764bfbff1a4989414ec83c0eaa723107 to ignored_commits
Jakub Jelinek [Thu, 4 Jun 2026 08:16:51 +0000 (10:16 +0200)] 
Add 86ff0e88764bfbff1a4989414ec83c0eaa723107 to ignored_commits

2026-06-04  Jakub Jelinek  <jakub@redhat.com>

* gcc-changelog/git_update_version.py (ignored_commits):
Add 86ff0e88764bfbff1a4989414ec83c0eaa723107.

2 months agors6000: Fix PTImode attribute handling [PR106895]
Jeevitha [Thu, 4 Jun 2026 06:52:08 +0000 (01:52 -0500)] 
rs6000: Fix PTImode attribute handling [PR106895]

PTImode is used to generate even/odd register pairs for 128-bit values.
When PTImode is specified via a type attribute, compilation fails
because no internal type exists to represent this mode.

Introduce signed and unsigned PTImode internal builtin types to handle
PTImode. These __pti_internal types are not documented, as they are not
intended for direct user use.

2026-06-04  Jeevitha Palanisamy  <jeevitha@linux.ibm.com>

gcc/
PR target/106895
* config/rs6000/rs6000.h (enum rs6000_builtin_type_index): Add
RS6000_BTI_INTPTI and RS6000_BTI_UINTPTI.
(intPTI_type_internal_node, uintPTI_type_internal_node): New
PTImode type macros.
* config/rs6000/rs6000-builtin.cc (rs6000_init_builtins): Register
signed and unsigned PTImode internal builtin types.
* config/rs6000/sync.md (trunctipti2): New splitter.
(extendptiti2): Likewise.
(zero_extendptiti2): Likewise.

gcc/testsuite/
PR target/106895
* gcc.target/powerpc/pr106895-1.c: New test.
* gcc.target/powerpc/pr106895-2.c: New test.

2 months agomatch: Disable `if (cond) (A | CST1) : (A & ~CST1)` pattern for non-GIMPLE [PR125588]
Andrew Pinski [Thu, 4 Jun 2026 00:18:56 +0000 (17:18 -0700)] 
match: Disable `if (cond) (A | CST1) : (A & ~CST1)` pattern for non-GIMPLE [PR125588]

r17-265-gf6f33ca83cb6b8 added a new pattern that converts:
cond ? (A | CST1) : (A & ~CST1)
into `(A & ~CST1) | (cond * CST1)` but fold (partly via
fold_binary_op_with_conditional_arg) will turn
that back into `cond ? (A | CST1) : (A & ~CST1)` in some
cases. In those cases we get an infinite loop and a stack overflow crash.

This fixes the problem by enabling this pattern for GIMPLE only.

Pushed as obvious after bootstrap/test on x86_64-linux-gnu.

PR middle-end/125588

gcc/ChangeLog:

* match.pd (`if (cond) (A | CST1) : (A & ~CST1)`): Enable
for GIMPLE only.

gcc/testsuite/ChangeLog:

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

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
2 months ago[PATCH v4] Replace certain uses of TEST_HARD_REG_BIT in loops with better alternatives
Kevin Stefanov [Thu, 4 Jun 2026 04:46:02 +0000 (22:46 -0600)] 
[PATCH v4] Replace certain uses of TEST_HARD_REG_BIT in loops with better alternatives

This change takes loops of the form:

  for (int <i> = 0; <i> < FIRST_PSEUDO_REGISTER; <i>++)
    if (TEST_HARD_REG_BIT (<set>, <i>))
      <body that doesn't change i or set>

and carries out the necessary refactoring to rewrite them as:

  hard_reg_set_iterator hrsi; [...]
  EXECUTE_IF_SET_IN_HARD_REG_SET (<set>, 0, <i>, hrsi)
    <body that doesn't change i or set>

in loops where expressing <set> does not involve <i>.

It also replaces the only two call sites of hard_reg_set_size
(which was internally using TEST_HARD_REG_BIT in such a loop)
with a call to hard_reg_set_popcount, as a popcount is all
that it was doing anyway. Thus, the now-unused function
hard_reg_set_size has been removed from the codebase.

Replaced one additional use of TEST_HARD_REG_BIT in such
a loop with a call to hard_reg_set_popcount.

---

Hi all,

I have made the improvements suggested by Jeffrey's review.
Thank you for that.

In v4, I remove the function hard_reg_set_size and
replace its only two call sites with calls to
hard_reg_set_popcount as Jeff suggested. Since this
is slightly different from the one recurring mechanical
refactoring I was doing so far everywhere else, but
still related to replacing TEST_HARD_REG_BIT in
loops with better alternatives, I've changed the
patch title to reflect that. The ChangeLog and commit
message have been updated too.

The formatting issues involving commas have been fixed
and I have dropped the gratuitous unrelated change
that Jeff pointed out in the review.

I also spotted some incorrect function names in my previous ChangeLog.
It was an oversight on my side. The git diff
command output shows the function name where the displayed
change dump begins, not the function being changed.
That became a source of confusion for me when the diff dump
begins at the end of the previous function's body as it appears
in the source file. I've corrected these ChangeLog entries.

Synced with trunk as of June 3rd, no merge conflicts.

Regstrapped on x86_64-pc-linux-gnu with enable-languages=c,c++.

This is my first contribution, so if anybody could push it for
me when it's ready, I'd appreciate it. Thanks.

gcc/
* config/m68k/m68k.cc (m68k_conditional_register_usage): Replace TEST_HARD_REG_BIT
with EXECUTE_IF_SET_IN_HARD_REG_SET in applicable loops.
(m68k_zero_call_used_regs): Likewise.
* config/pdp11/pdp11.cc (pdp11_conditional_register_usage): Likewise.
* ira-color.cc (create_new_allocno_hard_regs_node): Replace call to hard_reg_set_size
with hard_reg_set_popcount.
* ira-int.h (hard_reg_set_size): Remove.
* ira-lives.cc (process_bb_node_lives): Replace TEST_HARD_REG_BIT
with EXECUTE_IF_SET_IN_HARD_REG_SET in applicable loops.
* ira.cc (setup_class_hard_regs): Likewise.
(update_equiv_regs_prescan): Likewise.
(build_insn_chain): Likewise.
(setup_stack_reg_pressure_class): Replace call to hard_reg_set_size
with hard_reg_set_popcount.
* lra-eliminations.cc (spill_pseudos): Replace TEST_HARD_REG_BIT
with EXECUTE_IF_SET_IN_HARD_REG_SET in applicable loops.
* optabs.cc (expand_asm_reg_clobber_mem_blockage): Replace
TEST_HARD_REG_BIT with EXECUTE_IF_SET_IN_HARD_REG_SET in one instance
and with hard_reg_set_popcount in another.
* postreload.cc (reload_combine): Replace TEST_HARD_REG_BIT
with EXECUTE_IF_SET_IN_HARD_REG_SET in applicable loops.
* reginfo.cc (init_reg_sets_1): Likewise.
* regrename.cc (init_rename_info): Likewise.
* reload1.cc (maybe_fix_stack_asms): Likewise.
(update_eliminables_and_spill): Likewise.
* rtl-ssa/insns.cc (function_info::record_call_clobbers): Likewise.
* sched-deps.cc (sched_analyze_insn): Likewise.
* sel-sched-dump.cc (print_hard_reg_set): Likewise.

Signed-off-by: Kevin Stefanov <kevinstefanov15@gmail.com>
2 months agoi386: Extend MOVNTDQ support to cover various packed integer types
Xiaomei Xue [Thu, 4 Jun 2026 02:42:12 +0000 (02:42 +0000)] 
i386: Extend MOVNTDQ support to cover various packed integer types

As the associated mode iterator VI8 shows, MOVNTDQ is only used for
*QI and *DI packed integer modes, this patch extends it to cover *HI
and *SI packed integer modes.

gcc/ChangeLog:

* config/i386/sse.md (define_mode_attr sse2): Add V4SI/V8SI/V16SI/
V8HI/V16HI/V32HI.
(<sse2>_movnt<mode>): Change mode iterator from VI8 to VI_AVX_AVX512F.
(define_mode_iterator STORENT_MODE): Add V4SI/V8SI/V16SI/V8HI/V16HI/
V32HI/V16QI/V32QI/V64QI.

Signed-off-by: Xiaomei Xue <xuexiaomei@hygon.cn>
2 months agoc++: non-dep cmp op rewritten from <=> returning char [PR125378]
Patrick Palka [Wed, 3 Jun 2026 22:04:12 +0000 (18:04 -0400)] 
c++: non-dep cmp op rewritten from <=> returning char [PR125378]

When a user operator<=> returns an integral type smaller than int, the
rewritten form of x @ y contains an integer promotion: (int)(x <=> y) @ 0.

This patch teaches build_min_non_dep_op_overload to look through and
preserve this implicit cast.

PR c++/125378

gcc/cp/ChangeLog:

* tree.cc (build_min_non_dep_op_overload): Handle comparison
operator expressions rewritten from a <=> that contain an
integer promotion.

gcc/testsuite/ChangeLog:

* g++.dg/lookup/operator-8b.C: New test.
* g++.dg/lookup/operator-8c.C: New test.
* g++.dg/lookup/operator-9a.C: New test.
* g++.dg/lookup/operator-9b.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
Reviewed-by: Marek Polacek <polacek@redhat.com>
2 months agoc++: unchecked 'A op B' constraint-expression [PR125490]
Patrick Palka [Wed, 3 Jun 2026 22:03:14 +0000 (18:03 -0400)] 
c++: unchecked 'A op B' constraint-expression [PR125490]

Here the nonsensical constraint-expression f() == 42 isn't getting rejected
ahead of time because when parsing we pass no_toplevel_fold_p=true to
cp_parser_binary_expression, which makes it use build_min instead of
build_x_binary_op, effectively bypassing the actual processing of the
operator expression until satisfaction time.  This flag was introduced
by r145014 to avoid undesirable folding / canonicalization of OpenMP for
loop conditions, and that's still the only other user of the flag today.

But I think cp_parser_constraint_expression doesn't need to use this
flag at all because constraint-expression parsing is always templated
and we (generally) don't fold templated trees.  I think the flag is
intended to be used only by OpenMP parsing routines.

Note that without this patch we'd go on to reject the constraint-expression
at satisfaction time, so this first testcase is effectively IFNDR / QoI.
But this change isn't limited to IFNDR cases, we need to process the
operator expression at parse time for sake of correct unqualified lookup
as in the second testcase.

PR c++/125490

gcc/cp/ChangeLog:

* parser.cc (cp_parser_constraint_expression): Pass
no_toplevel_fold_p=false instead of =true to
cp_parser_binary_expression.

gcc/testsuite/ChangeLog:

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

Reviewed-by: Jason Merrill <jason@redhat.com>
2 months agoa68: fix list of worthy characters in ga68.texi
Jose E. Marchesi [Wed, 3 Jun 2026 20:29:43 +0000 (22:29 +0200)] 
a68: fix list of worthy characters in ga68.texi

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

* ga68.texi (Worthy characters): Remove spurious @ entry in the
list of worthy characters.

2 months agofortran: add INLINE and ALWAYS_INLINE attributes
Henri Menke [Fri, 29 May 2026 18:09:05 +0000 (18:09 +0000)] 
fortran: add INLINE and ALWAYS_INLINE attributes

gfortran already understands the !GCC$ ATTRIBUTES NOINLINE directive to
suppress inlining of a procedure, but there was no way to request the
opposite.  This adds two attributes:

    !GCC$ ATTRIBUTES inline :: my_procedure
    !GCC$ ATTRIBUTES always_inline :: my_procedure

INLINE is a plain hint equivalent to the C inline keyword and only sets
DECL_DECLARED_INLINE_P, so the inliner's size limits still apply.
ALWAYS_INLINE corresponds to the C always_inline attribute and
additionally sets DECL_DISREGARD_INLINE_LIMITS.  Since Fortran has no
inline keyword, DECL_DECLARED_INLINE_P is set explicitly.  Setting only
DECL_DISREGARD_INLINE_LIMITS would make the middle-end warn that the
always-inline function might not be inlinable.

INLINE and ALWAYS_INLINE are incompatible with NOINLINE.  In the
middle-end the DECL_UNINLINABLE flag set by NOINLINE always wins, so the
inline request would be silently ignored.  To avoid that surprise the
directive parser warns and drops the inline attribute when both are
applied to the same procedure, whether in one directive or in two.

The new EXT_ATTR_* values are appended at the end of the enum because the
symbol_attribute.ext_attr bitmask is written to module files.  Appending
preserves the existing bit positions and keeps modules written by older
gfortran readable.

Bootstrapped and regtested on x86_64-pc-linux-gnu with
--enable-languages=c,c++,fortran.  All three stages built and the
stage 2 and 3 comparison succeeded.  The gfortran testsuite shows no
regressions (75660 expected passes, 339 expected failures, 0 unexpected
failures) and the four new tests pass.

gcc/fortran/ChangeLog:

* gfortran.h (enum ext_attr_id_t): Add EXT_ATTR_INLINE and
EXT_ATTR_ALWAYS_INLINE at the end.  Document that new attributes
must be appended to preserve module compatibility.
* decl.cc (ext_attr_list): Add "inline" and "always_inline".
(gfc_match_gcc_attributes): Warn about and drop INLINE or
ALWAYS_INLINE when combined with NOINLINE on the same symbol.
* trans-decl.cc (build_function_decl): Handle EXT_ATTR_INLINE and
EXT_ATTR_ALWAYS_INLINE by setting DECL_DECLARED_INLINE_P, and
DECL_DISREGARD_INLINE_LIMITS for ALWAYS_INLINE.
* gfortran.texi (ATTRIBUTES directive): Document INLINE and
ALWAYS_INLINE.

gcc/testsuite/ChangeLog:

* gfortran.dg/always_inline_1.f90: New test.
* gfortran.dg/always_inline_2.f90: New test.
* gfortran.dg/inline_1.f90: New test.
* gfortran.dg/inline_2.f90: New test.

Signed-off-by: Henri Menke <henri@henrimenke.de>
2 months agocselim: Allow middle_bb to have more than one statement [PR124405]
Pengxuan Zheng [Thu, 9 Apr 2026 01:09:48 +0000 (18:09 -0700)] 
cselim: Allow middle_bb to have more than one statement [PR124405]

Currently, cselim requires the middle_bb to have only a single statement. This
patch relaxes this restriction as long as all uses (except the rhs) in the
single stmatement are also available where we insert to.

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

Changes since v1:
* v2: Revert changes to trailing_store_in_bb and do not call
      trailing_store_in_bb to get split_assign.
      Remove some unnecessary checks in cselim_candidate.
      Pass the result of cselim_candidate which is the candidate store for
      cselim as an argument to cond_store_replacement instead.
* v3: Simplify cselim_candidate by always calling trailing_store_in_bb and
      removing the legality checks.
      Generalize the cond_store_replacement legality checks to account for the
      case when the middle_bb can have more than one statement.

PR tree-optimization/124405

gcc/ChangeLog:

* tree-ssa-phiopt.cc (cond_store_replacement): Make ASSIGN (the
candidate store for cselim) an argument of the function instead. Update
legality check due to relaxing the restriction that middle_bb can have
only a single statement.
(cselim_candidate): New.
(pass_cselim::execute): Call cselim_candidate and pass the result to
cond_store_replacement.

gcc/testsuite/ChangeLog:

* gcc.dg/tree-ssa/pr124405.c: New test.

Signed-off-by: Pengxuan Zheng <pengxuan.zheng@oss.qualcomm.com>
2 months agoc23: fix TBAA error for function returning structure [PR125252]
Martin Uecker [Sun, 10 May 2026 18:21:40 +0000 (20:21 +0200)] 
c23: fix TBAA error for function returning structure [PR125252]

To fix PR122572 we globbed pointers to structure or union types nested
within other structure or union types to a void pointer when computing
the TYPE_CANONICAL.  But when doing this for function return types this
then leads to wrong aliasing decisions, because for some reason function
derivation behaves differently than pointer and array derivation.  Instead
of globbing to void, replace the nested structure or union type with an
incomplete type instead.

PR c/125252

gcc/c/ChangeLog:

* c-typeck.cc (ptr_to_tagged_member): Return type of member.
(c_type_canonical): Use incomplete type.

gcc/testsuite/ChangeLog:

* gcc.dg/pr125252.c

2 months agoc++: reference tparm refers to temporary object [PR107124]
Marek Polacek [Wed, 27 May 2026 17:23:49 +0000 (13:23 -0400)] 
c++: reference tparm refers to temporary object [PR107124]

[temp.arg.nontype] tells us that a temporary object is not an acceptable
template-argument when the corresponding template parameter has reference
type.  So

  template<const int& CRI> struct B { };
  B<1> b;

is ill-formed.  In the test below we have a tparm `const int &I` and we
are trying to deduce `I` from `A<0>`.  Since a temporary would be required
for the template argument, this should be a deduction failure.

PR c++/107124

gcc/cp/ChangeLog:

* cp-tree.h: Adjust comments to mention
maybe_build_nontype_implicit_conv instead of
maybe_convert_nontype_argument.
* pt.cc (maybe_convert_nontype_argument): Rename to...
(maybe_build_nontype_implicit_conv): ...this.
(convert_nontype_argument_maybe_dependent): New, factored
out of...
(convert_template_argument): ...here.
(unify) <case TEMPLATE_PARM_INDEX>: Call
convert_nontype_argument_maybe_dependent and return unify_invalid
if it failed.  Don't call strip_typedefs_expr.

gcc/testsuite/ChangeLog:

* g++.dg/template/deduce11.C: New test.
* g++.dg/template/deduce12.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
2 months ago[PATCH v2] RISC-V: Add XuanTie C908 tuning and scheduler model
Milan Tripkovic [Wed, 3 Jun 2026 17:33:20 +0000 (11:33 -0600)] 
[PATCH v2] RISC-V: Add XuanTie C908 tuning and scheduler model

Add tuning definitions for the XuanTie C908 core, including a
scalar scheduler model.

The scheduler model describes the scalar integer, load/store, multiply,
divide, and floating-point pipeline resources. It is based on the
XuanTie C908 R1S0 User Manual.

This patch only models scalar scheduling. Vector scheduling is left for
future work (xt-c908v).

The scheduler model was tested on a CanMV-K230-V1.1 with CoreMark and a set
of instruction throughput tests.

The instruction throughput tests are essentially unrolled loops which
have groups of instructions (a group of adds and a group of fadd instructions
we are measuring for example) which use independent registers. For the
purpose of estimating the efficiency of scheduling such an unrolled loop,
the impact of reducing pipeline stalls on measured cycle counts is noticeable.

Each test uses aligned memory access. Before taking
measurements, the benchmark performs 20 warm-up runs. The measured test
is then executed 200 times.

On a CanMV-K230-V1.1 board, this tuning gives about a 0.8% CoreMark improvement.
The instruction throughput tests show cycle-count improvements of
about 5% to 17%.

Long-latency reservations are clamped to 7 cycles, following the existing
RISC-V scheduler modelling approach introduced by commit 8265192.

gcc/ChangeLog:

* config/riscv/riscv-cores.def (RISCV_TUNE): Changed xt-c908
PIPELINE_MODEL and TUNE_INFO
* config/riscv/riscv-opts.h (enum riscv_microarchitecture_type): Add entry
for xt-c908 design
* config/riscv/riscv.cc: New tune structure
for the xt-c908 design.
* config/riscv/riscv.md: Add xt-c908 .
Include xt-c908.md.
* config/riscv/xt-c908.md: New file.

2 months agoc: fix wrong code with counted_by attribute [PR123569]
Martin Uecker [Mon, 1 Jun 2026 18:57:09 +0000 (20:57 +0200)] 
c: fix wrong code with counted_by attribute [PR123569]

For an access to a member of pointer type with counted_by attribute,
the .ACCESS_WITH_SIZE internal function is inserted at certain places
before reading the pointer.  This leads to wrong code for increment
and decrement operations.  For now, do not instrument these accesses
by using default_array_function_conversion instead of
default_array_function_read_conversion and calling mark_exp_read_
directly.  Code to undo the effect of mark_exp_read can be removed,
and the logic is moved into a helper function mark_exp_read_cond.

PR c/123569

gcc/c/ChangeLog:
* c-parser.cc (mark_exp_read_cond): New function.
(c_parser_unary_expression): Use mark_exp_read_cond.
(c_parser_postfix_expression_after_primary): Likewise.
* c-typeck.cc (build_unary_op): Remove dead code and
add checking assertion.

gcc/testsuite/ChangeLog:
* gcc.dg/pr123569.c: New test.

2 months agotree-scalar-evolution: Fold loop PHIs with known nonzero niter
Abhishek Kaushik [Wed, 27 May 2026 11:09:12 +0000 (11:09 +0000)] 
tree-scalar-evolution: Fold loop PHIs with known nonzero niter

SCEV sometimes fails to compute the final value of a loop PHI when the
entry value does not match the value produced by later iterations.  For
example:

  # y = PHI <y_next, 666>
  i_next = i + 1;
  y_next = i_next * 10;

The PHI value is:

  666, 10, 20, 30, ...

This is not a normal affine recurrence.  But if the latch count is
known to be nonzero, the entry value cannot be the value seen after
the loop.  The final value is the latch argument evaluated at iteration
niter - 1.

Teach SCEV final value replacement to handle this case.

This patch was bootstrapped and regression tested on aarch64-linux-gnu.

gcc/:

* tree-scalar-evolution.cc
(compute_final_value_from_loop_phi_latch): New function.
(final_value_replacement_loop): Use it.

gcc/testsuite/:

* gcc.dg/tree-ssa/sccp-loop-phi.c: New test.
* gcc.dg/tree-ssa/sccp-loop-phi-not-optimized.c: New test.

2 months agopasses: Move early pass_sccopy right after evrp [PR103221]
Andrew Pinski [Tue, 2 Jun 2026 20:21:11 +0000 (13:21 -0700)] 
passes: Move early pass_sccopy right after evrp [PR103221]

EVRP changes some statements into copies but then does
not do copy prop during its handling. This causes in some
cases where phiopt could have optimized the phi not to be
done. So we should move the copy prop pass (sccopy) right
after evrp instead of after phiopt.

Notes on the testsuite changes:
dse-points-to.c needs to disable sccopy1 for the same
reason why it disables all other copyprop passes.
pr45397.c had an xfail for specifically PR 103221.
pr81981.c is about a missing warning, in this case moving
sccopy swaps around which uses is first in the list.

Bootstrapped and tested on x86_64-linux-gnu.

PR tree-optimization/103221
gcc/ChangeLog:

* passes.def (early_optimizations): Move sccopy
to after evrp.

gcc/testsuite/ChangeLog:

* gcc.dg/tree-ssa/dse-points-to.c: Disable sccopy1.
* gcc.dg/tree-ssa/pr45397.c: Remove the xfail.
* gcc.dg/ubsan/pr81981.c: Swap around which one is xfailed.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
2 months agosccopy: Handle ssa info for copies in sccopy
Andrew Pinski [Tue, 2 Jun 2026 21:20:17 +0000 (14:20 -0700)] 
sccopy: Handle ssa info for copies in sccopy

Currently if the ssa info (range or aliasing) is different
between the src and dest of a copy, sccopy will reject it.
This fixes the FIXME and handles it in a similar way as copyprop
handles it.  This is needed to able to move sccopy earlier (before phiopt1)
and to act like a copyprop pass.

Bootstrapped and tested on x86_64-linux-gnu with no regressions.

gcc/ChangeLog:

* gimple-ssa-sccopy.cc (stmt_may_generate_copy): Remove restriction
on the ssa info being different for the "copy".
(scc_copy_prop::replace_scc_by_value): Call maybe_duplicate_ssa_info_at_copy
when copyproping a ssa name.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
2 months agoMAINTAINERS: Add missing account names
Richard Earnshaw [Mon, 1 Jun 2026 12:41:26 +0000 (13:41 +0100)] 
MAINTAINERS: Add missing account names

Add the missing account names to the write-after section.  All
contributors that have ever had an account on the sourceware machine(s)
are now covered.  Only one entry remains that appears never to have had
an account.

ChangeLog:

* MAINTAINERS: Add all known missing account names to
write-after.

2 months agolibstdc++: Define feature test macros for hardened implementation
Jonathan Wakely [Thu, 21 May 2026 15:38:58 +0000 (16:38 +0100)] 
libstdc++: Define feature test macros for hardened implementation

The P3471R4 and P3697R1 proposals adding hardened preconditions also
defined feature test macros that indicate whether the hardened
preconditions are checked. For our implementation, those checks are
enabled by defining _GLIBCXX_ASSERTIONS.

To implement this, I've added all the __cpp_lib_hardened_xxx macros at
the end of bits/version.def, because the simplest way to define many of
them seems to be to make the depend on the macro for the main feature
and additionally depend on defined(_GLIBCXX_ASSERTIONS).

The hardening checks were added to each component as follows:

std::array                  r11-4854-g6db082477ad839
std::bitset                 r16-7919-g1b404c574450a4
std::deque                  r7-1526-gbd2ee798d5a5a3
std::expected               since first commit
std::forward_list           r15-5721-ge7aa614d7372b5
std::inplace_vector         since first commit
std::common_iterator        since first commit
std::counted_iterator       since first commit
std::list                   r15-5721-ge7aa614d7372b5
std::shared_ptr<T[]>        since first commit
std::optional               r8-711-g2c27a627a31034
std::ranges::view_interface since first commit
std::span                   r10-2983-gb5c433ce11a140
std::basic_stacktrace       since first commit
std::basic_string           r6-3197-g2f1e8e7c4730bb
std::basic_string_view      r11-2881-g3eefb302d2bd85
std::valarray               r6-3197-g2f1e8e7c4730bb
std::vector                 r6-3197-g2f1e8e7c4730bb

This commit does not define __cpp_lib_hardened_mdspan, that was added in
r17-1258-g19def756dec1fe earlier today.

This commit does not include the LWG 4577 changes to harden
view_interface::operator[] which will be added later (with a new value
for the __cpp_lib_hardened_view_interface macro).

libstdc++-v3/ChangeLog:

* include/bits/version.def: Define macros for hardened
preconditions.
* include/bits/version.h: Regenerate.
* include/std/array: Define "want" macro for hardened
precondition macro.
* include/std/bitset: Likewise.
* include/std/deque: Likewise.
* include/std/expected: Likewise.
* include/std/forward_list: Likewise.
* include/std/inplace_vector: Likewise.
* include/std/iterator: Likewise.
* include/std/list: Likewise.
* include/std/memory: Likewise.
* include/std/optional: Likewise.
* include/std/ranges: Likewise.
* include/std/span: Likewise.
* include/std/stacktrace: Likewise.
* include/std/string: Likewise.
* include/std/string_view: Likewise.
* include/std/valarray: Likewise.
* include/std/vector: Likewise.
* testsuite/23_containers/array/tuple_interface/get_neg.cc:
Adjust dg-error line numbers.

Reviewed-by: Nathan Myers <nmyers@redhat.com>
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
2 months agoa86: add syntax on modes and nests to ga68.vw
Jose E. Marchesi [Wed, 3 Jun 2026 14:45:44 +0000 (16:45 +0200)] 
a86: add syntax on modes and nests to ga68.vw

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

* ga68.vw (Modes and nests): Incorporate syntax from the RR
chapter 7.

2 months agoRISC-V: Add testcase for unsigned scalar SAT_MUL form 11
Pan Li [Mon, 18 May 2026 09:46:05 +0000 (17:46 +0800)] 
RISC-V: Add testcase for unsigned scalar SAT_MUL form 11

The form 11 of unsigned scalar SAT_MUL has supported from
the previous change.  Thus, add the test cases to make sure
it works well.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/sat/sat_arith.h: Add test helper macros.
* gcc.target/riscv/sat/sat_u_mul-12-u16-from-u128.c: New test.
* gcc.target/riscv/sat/sat_u_mul-12-u16-from-u32.c: New test.
* gcc.target/riscv/sat/sat_u_mul-12-u16-from-u64.rv32.c: New test.
* gcc.target/riscv/sat/sat_u_mul-12-u16-from-u64.rv64.c: New test.
* gcc.target/riscv/sat/sat_u_mul-12-u32-from-u128.c: New test.
* gcc.target/riscv/sat/sat_u_mul-12-u32-from-u64.rv32.c: New test.
* gcc.target/riscv/sat/sat_u_mul-12-u32-from-u64.rv64.c: New test.
* gcc.target/riscv/sat/sat_u_mul-12-u64-from-u128.c: New test.
* gcc.target/riscv/sat/sat_u_mul-12-u8-from-u128.c: New test.
* gcc.target/riscv/sat/sat_u_mul-12-u8-from-u16.c: New test.
* gcc.target/riscv/sat/sat_u_mul-12-u8-from-u32.c: New test.
* gcc.target/riscv/sat/sat_u_mul-12-u8-from-u64.rv32.c: New test.
* gcc.target/riscv/sat/sat_u_mul-12-u8-from-u64.rv64.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-12-u16-from-u128.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-12-u16-from-u32.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-12-u16-from-u64.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-12-u32-from-u128.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-12-u32-from-u64.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-12-u64-from-u128.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-12-u8-from-u128.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-12-u8-from-u16.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-12-u8-from-u32.c: New test.
* gcc.target/riscv/sat/sat_u_mul-run-12-u8-from-u64.c: New test.

Signed-off-by: Pan Li <pan2.li@intel.com>
2 months agoMatch: Support unsigned scalar SAT_MUL form 11
Pan Li [Mon, 18 May 2026 09:43:19 +0000 (17:43 +0800)] 
Match: Support unsigned scalar SAT_MUL form 11

This patch would like to try to match the the unsigned
SAT_MUL form 11, aka below

  #define DEF_SAT_U_MUL_FMT_11(NT, WT)             \
  NT __attribute__((noinline))                     \
  sat_u_mul_##NT##_from_##WT##_fmt_11 (NT a, NT b) \
  {                                                \
    WT x = (WT)a * (WT)b;                          \
    NT max = -1;                                   \
    bool overflow_p = x >= (WT)(max);              \
    return -(NT)(overflow_p) | (NT)x;              \
  }

while WT is uint128_t, uint64_t, uint32_t and uint16_t, and
NT is uint64_t, uint32_t, uint16_t or uint8_t.

gcc/ChangeLog:

* match-sat-alu.pd: Add pattern for unsigned scalar
SAT_MUL form 11.

Signed-off-by: Pan Li <pan2.li@intel.com>
2 months agoc++/reflection: template splicing tweak
Jason Merrill [Wed, 3 Jun 2026 12:40:53 +0000 (08:40 -0400)] 
c++/reflection: template splicing tweak

Discussion of the 124794 patch observed that access_path can be null if
object_type isn't derived from scope, which means building a nonsensical
BASELINK with null BASELINK_BINFO.

PR c++/124794

gcc/cp/ChangeLog:

* parser.cc (cp_parser_splice_specifier): Use TYPE_BINFO (scope)
for not-derived case.
* search.cc (build_baselink): Assert that binfos aren't null.

2 months agoc++/reflection: member function template splicing [PR124794]
feedable [Wed, 3 Jun 2026 12:40:53 +0000 (08:40 -0400)] 
c++/reflection: member function template splicing [PR124794]

cp_parser_splice_expression is stripping BASELINKs before resolving the
expr; checks if the result is a BASELINK after that (by which point it never
is).  To fix it, stop stripping the BASELINK, add handling to
check_splice_expr instead.

In cp_parser_splice_specifier, the additional template param parsing fails
to detect that the reflection is a template if it's wrapped in a BASELINKs,
and decides not to parse the splice-specialization-specifier if the
'template' keyword is missing. Grab the data from the reflection instead.

During template instantiation, we blindly substitute the template part of a
TEMPLATE_ID_EXPR, even if it's a SPLICE_EXPR. This, in turn, substitutes the
SPLICE_EXPR as-if it had no template arguments and finishes up the
expression, which interferes with later processing by TEMPLATE_ID_EXPR.  To
fix, we defer such TEMPLATE_ID_EXPRs to tsubst_splice_expr, which itself
performs the substitution of a TEMPLATE_ID_EXPR and finishes up the
expression.

check_splice_expr now also accepts TEMPLATE_ID_EXPRs in tsubst_splice_expr;
this is uniform with cp_parser_splice_expression, and required in order to
handle `template[:dep:]<>` where `dep` does not reflect a template.

PR c++/124794
PR c++/125069

gcc/cp/ChangeLog:

* parser.cc (cp_parser_splice_specifier): Do not strip BASELINKs.
(cp_parser_splice_expression): Add parsing for member function
template specializations without the "template" keyword.
* pt.cc (tsubst_splice_expr): Handle TEMPLATE_ID_EXPR where the
template part is a SPLICE_EXPR.
(tsubst_expr): Defer to tsubst_splice_expr when the template part of
TEMPLATE_ID_EXPR is a SPLICE_EXPR.
* reflect.cc (check_splice_expr): Add handling for BASELINKs.

gcc/testsuite/ChangeLog:

* g++.dg/reflect/member19.C: Enable tests.
* g++.dg/reflect/splice15.C: New test.
* g++.dg/reflect/splice16.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
2 months agolibstdc++: Define hardening FTM and update operator[] for mdspan
Tomasz Kamiński [Wed, 3 Jun 2026 10:04:51 +0000 (12:04 +0200)] 
libstdc++: Define hardening FTM and update operator[] for mdspan

Defines __cpp_lib_hardened_mdspan.

The hardened precondition on the mdspan converting constructor,
is validated by the assert(_S_is_compatible_extents()) in the
_ExtentsStorge. This also covers user-defined mappings, as all
mappings are required to store, and thus construct extents
objects.

The operator[] implemented all required bounds checks, by:
* checking for negative values in __index_type_cast
* checking if value is representable in index_type in
  __index_type_cast
* checking against the bound by calling __is_multi_index lambda
  in operator[]
However, the last check subsumes the representability check
(static extent values are validated at compile time).
To reduce duplicated checks, this patch uses __index_int_t
(introduced in r16-7644-g43f7452026fc05 for mdspan::at), that
preserve negative values of arguments of integral type.

libstdc++-v3/ChangeLog:

* include/bits/version.def (hardened_mdspan): Define.
* include/bits/version.h: Regenerate.
* include/std/mdspan (__cpp_lib_hardened_mdspan): Define.
(mdspan::operator[]): Replace __mdspan::__index_type_cast
with cast to __index_int_t, and inline negative value checks.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2 months agoAdd CALL_INSN_ABI_ID
Richard Sandiford [Wed, 3 Jun 2026 12:11:17 +0000 (13:11 +0100)] 
Add CALL_INSN_ABI_ID

function-abi.h was originally added to cope with AArch64's
vector PCS and SVE PCS variants.  One of the key requirements
was that a call insn must say precisely which ABI the callee uses,
regardless of how the call is created.

At the time, I did this by encoding the information as an UNSPEC
in the AArch64 call patterns.  IIRC, there were three reasons for
doing it that way:

(1) To make sure that the information is not accidentally dropped.

(2) To make sure that calls using different ABIs are distinct
    (not rtx_equal_p).

(3) Because it seemed presumptious to add a new CALL_INSN field for
    something that only AArch64 was using.

However, CALL_INSN_FUNCTION_USAGE and SIBLING_CALL_P also require (1)
and at least SIBLING_CALL_P requires (2).  I'm not aware that this
has been a common source of bugs in practice.

As far as (3) goes, RISC-V now uses a similar system, and x86 is
also about to use function_abi more heavily (see HJ's patches).
Any target that wants to run CPython efficiently will probably want
to implement preserve_none, and so adopt the same kind of approach.

If we take the view that having multiple ABIs is now going to be
common for "major" targets, attaching the information to the
CALL_INSN would be both simpler and more compact.

As it stands, targets have to smuggle the ABI information from
init_cumulative_args (which supplies the function type) through
function_arg (which asks the target for the final call operand)
to call/call_value/etc. (which receive the information from
function_arg).  It's all a bit of a mess.

This patch therefore adds a new CALL_INSN_ABI_ID field to CALL_INSN
and removes the now-redundant insn_callee_abi hook.

This makes UNSPEC_CALLEE_CC unnecessary on RISC-V, so the patch
reverts the call patterns to something like their state before
r14-3733-gfdd59c0f73e9e6 (which is in no way a comment against
that patch).  In contrast, AArch64 still uses the ABI "cookie"
for other information, so it needs to be kept.

The patch reflows the CALL_INSN_FUNCTION_USAGE documentation but
otherwise just does s/@code{CALL_INSN_FUNCTION_USAGE}/This field/.

gcc/
* rtl.def (CALL_INSN): Add a new integer field.
* rtl.h (CALL_INSN_ABI_ID): New macro.
* target.def (insn_callee_abi): Delete.
* doc/rtl.texi: Document CALL_INSN_ABI_ID.
* doc/tm.texi.in (TARGET_INSN_CALLEE_ABI): Remove.
* doc/tm.texi: Regenerate.
* calls.cc: Include regs.h and function-abi.h.
(emit_call_1): Initialize CALL_INSN_ABI_ID.
* cfgcleanup.cc (old_insns_match_p): Compare CALL_INSN_ABI_IDs.
* emit-rtl.cc (try_split): Copy the original insn's CALL_INSN_ABI_ID
to the new call.
(emit_copy_of_insn_after): Likewise.
(make_call_insn_raw): Initialise CALL_INSN_ABI_ID.
* function-abi.cc (insn_callee_abi): Remove use of the insn_callee_abi
hook and instead use CALL_INSN_ABI_ID.
* recog.cc (peep2_attempt): Copy the original insn's CALL_INSN_ABI_ID
to the new call.
* config/aarch64/aarch64-protos.h (aarch64_gen_callee_cookie): Remove
arm_pcs parameter.
* config/aarch64/aarch64.cc (aarch64_gen_callee_cookie): Likewise.
(aarch64_callee_abi): Delete.
(aarch64_insn_callee_abi): Likewise.
(aarch64_function_arg): Update call to aarch64_callee_abi.
(aarch64_output_mi_thunk): Likewise.  Set CALL_INSN_ABI_ID instead.
(TARGET_INSN_CALLEE_ABI): Delete.
* config/aarch64/aarch64.md (tlsdesc_small_<mode>): Update call
to aarch64_callee_abi and set CALL_INSN_ABI_ID instead.
* config/i386/i386.cc (ix86_insn_callee_abi): Delete.
(ix86_expand_avx_vzeroupper): Set CALL_INSN_ABI_ID.
(TARGET_INSN_CALLEE_ABI): Delete.
* config/riscv/riscv-sr.cc (riscv_remove_unneeded_save_restore_calls):
Remove coding convention from calls to gen_sibcall_internal and
gen_sibcall_value_internal.  Store the ABI identifier in
CALL_INSN_ABI_ID instead.
* config/riscv/riscv.cc (riscv_output_mi_thunk): Likewise.
(riscv_call_tls_get_addr): Likewise, but calling gen_call_value.
(riscv_function_arg): Return null for the end marker.
(get_riscv_cc, riscv_insn_callee_abi): Delete.
(TARGET_INSN_CALLEE_ABI): Delete.
* config/riscv/riscv.md (UNSPEC_CALLEE_CC): Delete.
(sibcall): Revert to treating operand 2 as a placeholder.
Do not pass it to gen_sibcall_internal.
(sibcall_value): Likewise operand 3 and gen_sibcall_value_internal.
(call): Likewise operand 2 and gen_call_internal.
(call_value): Likewise operand 3 and gen_call_value_internal.
(sibcall_internal, call_internal): Remove operand 2.
(sibcall_value_internal, call_value_internal): Remove operand 3.
(untyped_call): Update call to gen_call.

gcc/testsuite/
* gcc.dg/rtl/x86_64/different-structs.c: Initialize CALL_INSN_ABI_ID.
* selftests/x86_64/call-insn.rtl: Likewise.

2 months agoFortran: Wuse-without-only bogus warning for submodules [PR105594]
Paul Thomas [Wed, 3 Jun 2026 11:02:03 +0000 (12:02 +0100)] 
Fortran: Wuse-without-only bogus warning for submodules [PR105594]

2026-06-03  Steven G. Kargl  <kargl@gcc.gnu.org>

gcc/fortran
PR fortran/105594
* module.cc (gfc_use_module): Suppress bogus warning for a missing
ONLY clause on a submodule.

gcc/testsuite/
PR fortran/105594
* gfortran.dg/pr105594.f90: New test.

2 months agoa68: fix diagnostic in recover_from_error
Jose E. Marchesi [Wed, 3 Jun 2026 10:00:21 +0000 (12:00 +0200)] 
a68: fix diagnostic in recover_from_error

The recover_from_error function calls a68_phrase_to_text in order to
get a descriptive text to emit in diagnostics.  This text, however,
may contain format tags such as %< and %>, so it has to be passed to
a68_error as a format string, therwise the format tags are not
interpreted and get printed verbatim.

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

* a68-parser-bottom-up.cc (recover_from_error): Use the output of
a68_phrase_to_text as format string so format tags are honored.

2 months agoaarch64: Make Uc[ij] constraints public
Alex Coplan [Thu, 28 May 2026 11:26:02 +0000 (12:26 +0100)] 
aarch64: Make Uc[ij] constraints public

This promotes Uci and Ucj from internal to public constraints.  They are
already both documented publically in LLVM [1] and we've had a request
from kernel folks who would like to make use of Ucj for saving/restoring
ZA contents [2].

[1] : https://llvm.org/docs/LangRef.html#supported-constraint-code-list
[2] : https://lore.kernel.org/linux-arm-kernel/ahW8Eba3SNqfVDdk@J2N7QTR9R3/

gcc/ChangeLog:

* config/aarch64/constraints.md (Uci): Drop @internal, slightly tweak
doc string.
(Ucj): Likewise.
* doc/md.texi (Machine Constraints): Document Uci and Ucj under AArch64
family.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/sme/inline-asm.c: New test.

2 months agodoc: Flesh out documentation for IFN_MASK_LOAD
Alex Coplan [Fri, 15 May 2026 15:48:24 +0000 (16:48 +0100)] 
doc: Flesh out documentation for IFN_MASK_LOAD

Following the discussion here:
https://gcc.gnu.org/pipermail/gcc-patches/2026-May/716769.html
this expands the internal function documentation for IFN_MASK_LOAD to
spell out the signature of the function and explain how it relates to
the optab.

gcc/ChangeLog:

* doc/ifn.texi (Direct Internal Functions): Flesh out
documentation for IFN_MASK_LOAD.
* doc/md.texi (Standard Names): Add anchor for maskloadmn so it
can be cross-referenced.

2 months agobackprop: Avoid double deletions [PR125579]
Richard Sandiford [Wed, 3 Jun 2026 10:04:15 +0000 (11:04 +0100)] 
backprop: Avoid double deletions [PR125579]

In this PR, two values were simplified to the same phi, which in
turn was made redundant by other simplifications.  The pass then
tried to delete the phi twice.

gcc/
PR tree-optimization/125579
* gimple-ssa-backprop.cc (backprop::execute): Avoid double deletions.

gcc/testsuite/
PR tree-optimization/125579
* gcc.dg/pr125579.c: New test.

2 months agoAda: Adjust testcase after latest change
Eric Botcazou [Wed, 3 Jun 2026 09:54:25 +0000 (11:54 +0200)] 
Ada: Adjust testcase after latest change

The size clause of 32 bits requires an alignment clause of 4 for atomicity.

gcc/testsuite/
PR ada/125581
* gnat.dg/atomic9.adb (NVIC_STIR): Add alignment clause.

2 months agovect: gate COMPLEX_MUL on FP_CONTRACT_FAST [PR125431]
Tamar Christina [Wed, 3 Jun 2026 08:42:15 +0000 (09:42 +0100)] 
vect: gate COMPLEX_MUL on FP_CONTRACT_FAST [PR125431]

The checks for FP_CONTRACT_FAST were in the wrong place for complex_mul.

The location it was in would only block FMA but not MUL.  It would also not
really reject the forming of the FMA, it would just create an invalid collection
of nodes which would fail analysis later on.

However complex multiplication is also a contraction, since it's doing

real = a*c - b*d
imag = a*d + b*c

This moves the checks up to earliest possible location and actually just returns
and adds the missing check for FMS.

gcc/ChangeLog:

PR tree-optimization/125431
* tree-vect-slp-patterns.cc (complex_mul_pattern::matches,
complex_fms_pattern::matches): Gate on FP contraction.

gcc/testsuite/ChangeLog:

PR tree-optimization/125431
* gfortran.dg/vect/pr125431.f90: New test.

2 months agovect: fix prologue peeling dominator updates [PR125509]
Tamar Christina [Wed, 3 Jun 2026 08:37:32 +0000 (09:37 +0100)] 
vect: fix prologue peeling dominator updates [PR125509]

In the change to enable vectorization without needing a scalar epilogue I
disabled the dominators update for prolog peeling with the assumption that since
I don't need to go to rewire the exits when we vectorize the main loop we don't
end up with the complicated merge block for which the updates were needed.

And indeed no test failed.  But it turns out we now get a different form so the
updates are still needed.  The merge block is still a mess so determining
manually who is the new dominator of whom is still quite difficult so I couldn't
simplify the updates.

This re-enabled dominator updates after prolog peeling.

gcc/ChangeLog:

PR tree-optimization/125509
* tree-vect-loop-manip.cc (vect_do_peeling): Re-enable dominators
update for prolog peeling.

gcc/testsuite/ChangeLog:

PR tree-optimization/125509
* gcc.dg/vect/pr125509.c: New test.

2 months agotestsuite: Skip g++.dg/modules/pr120458-1 etc. on non-UCN targets
Rainer Orth [Wed, 3 Jun 2026 08:05:10 +0000 (10:05 +0200)] 
testsuite: Skip g++.dg/modules/pr120458-1 etc. on non-UCN targets

Two new tests FAIL on Solaris with the native assembler:

FAIL: g++.dg/modules/pr120458-1 -std=c++17 link
FAIL: g++.dg/modules/pr120458-1 -std=c++20 link
FAIL: g++.dg/modules/pr120458-1 -std=c++26 link
FAIL: g++.dg/modules/pr120458-2 -std=c++17 link
FAIL: g++.dg/modules/pr120458-2 -std=c++20 link
FAIL: g++.dg/modules/pr120458-2 -std=c++26 link

They don't assemble because as lacks UCN support:

Assembler: pr120458-1_a.C
        "pr120458-1_a.s", line 3 : Syntax error
        Near line: "    .globl  _ZW6영혼1fj"
[...]
Too many errors - Goodbye

Fixed by skipping the tests on non-UCN targets.

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

2026-06-02  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

gcc/testsuite:
* g++.dg/modules/pr120458-1_a.C: Skip on non-UCN targets.
* g++.dg/modules/pr120458-2_a.C: Likewise.

2 months agoPR modula2/125512: Candidate for spell checking missed when using qualified ident
Gaius Mulley [Wed, 3 Jun 2026 08:00:20 +0000 (09:00 +0100)] 
PR modula2/125512: Candidate for spell checking missed when using qualified ident

This bug fix checks the qualified ident processing for spell checking
candidates.

gcc/m2/ChangeLog:

PR modula2/125512
* gm2-compiler/P3Build.bnf (SubDesignator): Rewrite to
include spell checking.

gcc/testsuite/ChangeLog:

PR modula2/125512
* gm2.dg/spell/iso/fail/badmodule.mod: New test.
* gm2.dg/spell/iso/fail/badrecord.mod: New test.
* gm2.dg/spell/iso/fail/color.def: New test.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2 months agolibstdc++: Add (generic_)display_string and (generic_)native_encoded_string to filesy...
Tomasz Kamiński [Thu, 28 May 2026 06:37:33 +0000 (08:37 +0200)] 
libstdc++: Add (generic_)display_string and (generic_)native_encoded_string to filesystem::path

Furthermore string and generic_string method as marked as deprecated
in C++26 mode.

This implements the P2319R5 "Prevent path presentation problem" paper,
with the rename of system_encoded_string from LWG4512,
"The system_encoded_string() and generic_system_encoded_string() member
functions of std::filesystem::path are misnamed".

The wording defines the display_string and generic_display_string
in terms of call of std::format with format string "{}" and "{:g}"
respectively. This patch inlines the effects of above, by either
returning native() or generic_string<value_type>() directly
(if value_type is char), or string constructed __unicode::_Utf_view
of above (when value_type is wchar_t).

As we currently assume that char encoding is always UTF-8, the outputs
of (generic_)native_encoded string and (generic_)display_string
are equivalent. However, the former may be adjusted in future.

libstdc++-v3/ChangeLog:

* include/bits/fs_path.h (path::string, path::generic_string):
Add deprecated attribute in C++26 via _GLIBCXX26_DEPRECATED_SUGGEST.
(path::display_string, path::native_encoded_string)
(path::generic_display_string, path::generic_native_encoded_string)
[__glibcxx_format_path >= 202506L]: Define.
* include/bits/version.def (format_path): Bump to 202506.
* include/bits/version.h: Regenerate.
* testsuite/util/testsuite_fs.h (__gnu_test::compare_paths):
Ignored deprecated declarations warning.
* testsuite/27_io/filesystem/filesystem_error/cons.cc:
Disable -Wdeprecated-declarations warning with pragmas.
* testsuite/27_io/filesystem/operations/canonical.cc: Likewise.
* testsuite/27_io/filesystem/operations/copy_file.cc: Likewise.
* testsuite/27_io/filesystem/path/concat/strings.cc: Likwise.
* testsuite/27_io/filesystem/path/itr/traversal.cc: Likewise.
* testsuite/27_io/filesystem/operations/temp_directory_path.cc:
Likewise.
* testsuite/27_io/filesystem/path/decompose/root_directory.cc:
Likewise.
* testsuite/27_io/filesystem/path/generic/generic_string.cc:
Likewise.
* testsuite/27_io/print/1.cc: Likewise.
* testsuite/27_io/print/2.cc: Likewise.
* testsuite/27_io/print/3.cc: Likewise.
* testsuite/27_io/filesystem/path/append/source.cc:
Add dg-warning for deprecated functions use.
* testsuite/27_io/filesystem/path/decompose/stem.cc: Likewise.
* testsuite/27_io/filesystem/path/native/string-char8_t.cc:
Likewise.
* testsuite/27_io/filesystem/path/generic/display_native_string.cc:
New test.
* testsuite/27_io/filesystem/path/native/display_native_string.cc:
New test.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2 months agotree-optimization/125477 - verify we can copy it before versioning an outer loop
Richard Biener [Tue, 2 Jun 2026 13:41:07 +0000 (15:41 +0200)] 
tree-optimization/125477 - verify we can copy it before versioning an outer loop

The following fixes a hole in vectorizer loop versioning which tries to
version an outer loop that the versioning condition is invariant in but
fails to verify we can actually copy it.

PR tree-optimization/125477
* tree-vect-loop-manip.cc (vect_loop_versioning): Verify we
can duplicate an outer loop before considering to version it.

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

2 months agotree-core: Remove ENUM_BITFIELD from tree-core.h [PR125507]
Andrew Pinski [Tue, 2 Jun 2026 20:05:06 +0000 (13:05 -0700)] 
tree-core: Remove ENUM_BITFIELD from tree-core.h [PR125507]

This removes ENUM_BITFIELD from tree-core.h. GCC has been written in C++ for
years now. So enums can be bitfields. There is no reason for the macro.
This removes the macro usage from tree-core.h. The other uses can be removed
by others.

Note gengtype needed to support for tree_code to remove the extra enum that is added
for other others.

Bootstrapped and tested on x86_64-linux-gnu.

PR middle-end/125507

gcc/ChangeLog:

* gengtype.cc (main): Add tree_code.
* tree-core.h (struct tree_base): Remove ENUM_BITFIELD.
(struct tree_type_common): Likewise.
(struct tree_decl_common): Likewise.
(struct tree_decl_with_vis): Likewise.
(struct tree_function_decl): Likewise.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
2 months agoRISC-V: Remove dead code in riscv_sched_reorder
Jin Ma [Tue, 2 Jun 2026 13:38:43 +0000 (21:38 +0800)] 
RISC-V: Remove dead code in riscv_sched_reorder

While investigating vsetvl ping-ponging cases recently, the ready
queue reordering hook riscv_sched_reorder was found to contain an
unconditional return that makes most of the body unreachable:

  if (!last_vconfig.valid || *nreadyp == 1)
    return riscv_issue_rate ();

  return riscv_issue_rate ();    /* dead, kills reordering below.  */
  int nready = *nreadyp;
  ...

The hook was introduced by commit 63632889651 ("[RISC-V] Reorder
ready queue slightly to avoid unnecessary vsetvl instructions").  It
is unclear whether the second return was intentional (e.g. left as a
temporary guard) or a leftover.  Either way, since the surrounding
code is specifically designed to group instructions with the same
vector configuration and reduce vsetvl ping-ponging, the dead return
defeats the hook's stated purpose.

Remove the dead return so the reordering can actually run.

A quick look at the resulting fallout is benign: re-enabling the
reordering changes the vsetvl emission pattern for the zve64f
testcases pr111037-1.c, pr111037-4.c and pr113248.c.  The reorder
now places vle64.v + vadd.vv (both with mode-derived SEW=64) before
vfmv.s.f (SEW=16), so the vsetvl pass emits

  vsetivli zero, 1, e64, m1
  ...
  vsetivli zero, 1, e16, m1

instead of the prior

  vsetivli zero, 1, e16, mf4
  ...
  vsetvli  zero, zero, e64, m1

Both sequences contain two vsetvl insns, so the total switching cost
is unchanged.  Updating the scan-assembler-times patterns to match
the new sequence therefore looks like a reasonable adjustment.

gcc/ChangeLog:

* config/riscv/riscv.cc (riscv_sched_reorder): Remove dead
return after the early-return guard.

gcc/testsuite/ChangeLog:

PR target/111037
PR target/113248
* gcc.target/riscv/rvv/vsetvl/pr111037-1.c: Update vsetvl
patterns to match post-reorder asm sequence.
* gcc.target/riscv/rvv/vsetvl/pr111037-4.c: Likewise.
* gcc.target/riscv/rvv/vsetvl/pr113248.c: Likewise.

2 months agobitmap: Fix comment about tree representation
Richard Sandiford [Tue, 2 Jun 2026 19:50:29 +0000 (20:50 +0100)] 
bitmap: Fix comment about tree representation

The bitmap_element comments appear to have the left and right children
the wrong way around: prev is the left (lower index) and next is the
right (higher index).

gcc/
* bitmap.h (bitmap_element): Fix left/right distinction in comments.

2 months agobackprop: Create new SSA names
Richard Sandiford [Tue, 2 Jun 2026 19:50:29 +0000 (20:50 +0100)] 
backprop: Create new SSA names

backprop currently takes the shortcut of reusing SSA names when changing
their value.  The original justification for this was that backprop only
makes changes that are acceptable to all (non-debug) users.  It seemed
pointless to go to the trouble of creating a new SSA name, substituting
into all users, creating new SSA names for dependent statements that also
change value, and so on.  Debug instructions could be dealt with using
insert_debug_temp_for_var_def, which would be needed in any case.
(This patch still uses insert_debug_temp_for_var_def.)

See:

  https://gcc.gnu.org/pipermail/gcc-patches/2015-October/431463.html
  https://gcc.gnu.org/pipermail/gcc-patches/2015-October/431468.html

for the original discussion.

However, Robin's upcoming changes to support backpropagating nonzero
bits information runs into the problem that we also need to update
or invalidate range information.  That update would spread to the
same places that an SSA rename would.  Rather than fight the system
regarding cached information, it seemed better to go with the system
by creating new SSA names.

This is more complicated compared to the status quo, but maybe not
much more so than the status quo plus a flow-sensitive info update.

The change also allows an SSA name to be replaced by any gimple
value.  That isn't often useful for the current pass, although
gcc.dg/tree-ssa/backprop-1.c gives an artificial example involving
phi nodes and gcc.dg/torture/pr116922.c gives an example in which
a division gets folded to 1.  However, allowing general replacements
should be useful for Robin's work, which otherwise has to create new
assignments and leave other passes to propagate them away.

Hopefully the comments in the patch explain the approach.

gcc/
* gimple-ssa-backprop.cc: Update the comment at head of the file.
(var_info::new_value, var_info::seq): New member variables.
(var_info::var_info): Initialize them.
(remove_unused_var): Replace with...
(remove_dead_stmt): ...this new function.
(note_replacement): Delete.
(backprop::prepare_change): Likewise.
(backprop::complete_change): Likewise.
(backprop::set_new_value): New function.
(backprop::subst_operand): Likewise.
(backprop::finish_stmt): Likewise.
(backprop::optimize_builtin_call): Replace the lhs and info parameters
with a var_info parameter.  Create a new statement rather than
changing the existing one.
(backprop::optimize_assign): Likewise.
(backprop::optimize_phi): Likewise.
(backprop::replace_assign_rhs): Likewise, but replace gassign and lhs
parameters.
(backprop::propagate_change): New function.
(backprop::commit_replacement): Likewise.
(backprop::execute): Update phase 3 for the above changes.  Do not
alter the original statements during phase 3.  If one SSA name
is scheduled to be replaced, also require all its users in m_vars
to be replaced.  Add a new phase that performs the scheduled
replacements.

gcc/testsuite/
* gcc.dg/tree-ssa/backprop-7.c: New test.