]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
8 weeks agoada: VAST: create treewalker
Bob Duff [Mon, 24 Mar 2025 20:21:53 +0000 (16:21 -0400)] 
ada: VAST: create treewalker

Walks all trees (not just the main unit), deals with switches and
flags. Doesn't check much of anything yet (asserts that "unused" nodes
are not present).

Move decisions (what tree(s) to check, what switches enable checking)
from the caller to the body of VAST.

gcc/ada/ChangeLog:

* vast.adb: Initial implementation.
* vast.ads: Rename procedure. Remove parameter; body should decide
what to do.
* lib.ads (ipu): Minor: Rewrite comment for brevity, and because
of an inconvenient misspelling.
(Num_Units): Not used; remove.
(Remove_Unit): Minor: Remove "Currently" (which was current a decade
ago from) comment.
* lib.adb (Num_Units): Not used; remove.
* debug_a.adb (Debug_A_Entry): Fix bug: Use Write_Name_For_Debug,
so this won't crash on the Error node.
* debug.adb: Document -gnatd_V and -gnatd_W compiler switches.
* exp_ch6.adb (Validate_Subprogram_Calls): Remove redundant check for
Serious_Errors_Detected. (We turn off code gen when errors are
detected.)
* frontend.adb: Move decisions into VAST body.
* namet.ads (Present): Remove unnecessary overriding; these are
inherited by the derived types.
* namet.adb (Present): Likewise.

8 weeks agoada: Storage_Error on Ordered_Maps container aggregate with enumeration Key_Type
Gary Dismukes [Fri, 21 Mar 2025 22:03:46 +0000 (22:03 +0000)] 
ada: Storage_Error on Ordered_Maps container aggregate with enumeration Key_Type

The compiler fails with a Storage_Error when compiling a container aggregate
for a Map type coming from an instantiation of Ada.Containers.Ordered_Maps
that specifies an enumeration type for the Key_Type formal.

gcc/ada/ChangeLog:

* exp_aggr.adb (Build_Container_Aggr_Code.To_Int): Apply Enumeration_Pos
to Entity (Expr) rather than Expr.

8 weeks agoada: Fix omission in comment
Ronan Desplanques [Mon, 24 Mar 2025 11:39:29 +0000 (12:39 +0100)] 
ada: Fix omission in comment

gcc/ada/ChangeLog:

* sem_ch3.adb (Find_Type_Of_Object): Fix comment.

8 weeks agoada: Rename constant in Analyze_Component_Declaration
Ronan Desplanques [Mon, 24 Mar 2025 11:19:07 +0000 (12:19 +0100)] 
ada: Rename constant in Analyze_Component_Declaration

"Typ" is typically used to name constants that are entity IDs for types.
Before this patch, a constant local to Analyze_Component_Declaration
designating a syntactic subtype indication had that name. This patch
renames it to "Ind".

Code cleanup; behavior is unaffected.

gcc/ada/ChangeLog:

* sem_ch3.adb (Analyze_Component_Declaration): Rename constant.

8 weeks agoada: Simplify Constrain_Array
Ronan Desplanques [Fri, 21 Mar 2025 15:49:20 +0000 (16:49 +0100)] 
ada: Simplify Constrain_Array

Before this patch, Constrain_Array had a feature where it could be
passed Empty for the first actual and would then create an Itype itself.
There was only one use of this feature and it was unnecessary, so this
patch removes it.

gcc/ada/ChangeLog:

* sem_ch3.adb (Constrain_Array): Simplify.
(Process_Subtype): Adjust.

8 weeks agoada: Fix infinite loop with aggregate in generic unit
Eric Botcazou [Thu, 20 Mar 2025 22:29:33 +0000 (23:29 +0100)] 
ada: Fix infinite loop with aggregate in generic unit

Root_Type does not return the same type for the private and the full view of
a derived private tagged type when both derive from an interface type.

gcc/ada/ChangeLog:

* sem_ch12.adb (Copy_Generic_Node): Do not call Root_Type to find
the root type of an aggregate of a derived tagged type.

8 weeks agoada: Fix use-after-free in Compute_All_Tasks
Ronan Desplanques [Tue, 18 Mar 2025 12:56:58 +0000 (13:56 +0100)] 
ada: Fix use-after-free in Compute_All_Tasks

This patch fixes a bug in System.Stack_Usage.Tasking.Compute_All_Tasks
where it would attempt to read the stack of threads that had already
completed.

gcc/ada/ChangeLog:

* libgnarl/s-stusta.adb (Compute_All_Tasks): Skip terminated tasks.

8 weeks agoada: Fix the detection of configuration pragmas
Viljar Indus [Wed, 19 Mar 2025 09:28:13 +0000 (11:28 +0200)] 
ada: Fix the detection of configuration pragmas

Some pragma nodes like the ones for Assertion_Policy are
replaced by a Null_Statement. This is not taken into account
when analyzing if the pragma is a configuration pragma.

gcc/ada/ChangeLog:

* sem_prag.adb (Is_Configuration_Pragma): Check that nodes
preceding the pragma are pragma nodes or originally were
pragma nodes.

8 weeks agoada: Fix Value_Decimal to raise Constraint_Error on boundary values
Eric Botcazou [Tue, 18 Mar 2025 21:44:15 +0000 (22:44 +0100)] 
ada: Fix Value_Decimal to raise Constraint_Error on boundary values

Even though the issue is not user-visible, it's a (minor) departure from the
specification of the procedure.

gcc/ada/ChangeLog:

* libgnat/s-valued.adb (Integer_to_Decimal): Add Extra parameter and
use its value to call Bad_Value on boundary values.
(Scan_Decimal): Adjust call to Integer_to_Decimal.
(Value_Decimal): Likewise.

8 weeks agoada: Add Incomplete_Type_OK formal to Process_Subtype
Ronan Desplanques [Tue, 18 Mar 2025 17:02:29 +0000 (18:02 +0100)] 
ada: Add Incomplete_Type_OK formal to Process_Subtype

Before this patch, Process_Subtype looked at the parent of its argument
to determine whether it was called in a context where it was OK for the
subtype mark to refer to the incomplete view of a type. This patch adds
a new formal so that it becomes the responsibility of the caller in
order to make the code simpler overall.

The only change in the behavior of the compiler is that the messages
emitted in some error situations with the -gnatf switch are slightly
different.

gcc/ada/ChangeLog:

* sem_ch3.ads (Process_Subtype): New formal.
* sem_ch3.adb (Process_Subtype): Likewise.
(Analyze_Subtype_Declaration, Access_Type_Declaration): Use new
formal.

8 weeks agoada: Fix recursive call in Process_Subtype
Ronan Desplanques [Tue, 18 Mar 2025 07:53:35 +0000 (08:53 +0100)] 
ada: Fix recursive call in Process_Subtype

Process_Subtype calls itself in some error situations. This recursive
call was not updated together with the recent addition of the
Excludes_Null formal. This does not matter in practice because there can
never be both a null exclusion and another constraint at the same time,
but this patch updates the call anyway to make the situation clearer.

gcc/ada/ChangeLog:

* sem_ch3.adb (Process_Subtype): Fix recursive call.

8 weeks agoada: Rename a couple of local variables
Eric Botcazou [Tue, 18 Mar 2025 10:36:35 +0000 (11:36 +0100)] 
ada: Rename a couple of local variables

Block_Node is the name of an entity field, so the change renames local
variables with this name for the sake of clarity.

gcc/ada/ChangeLog:

* par-ch5.adb (P_Declare_Statement): Rename local variable.
(P_Begin_Statement): Likewise.

8 weeks agoada: Remove outdated comment about reused entity fields
Piotr Trojanek [Tue, 18 Mar 2025 09:41:43 +0000 (10:41 +0100)] 
ada: Remove outdated comment about reused entity fields

With the current representation of GNAT AST the entity fields are not reused.

gcc/ada/ChangeLog:

* einfo.ads (Overridden_Operation, Static_Initialization): Remove
comments about a reused entity field.

8 weeks agoada: Tweak formatting in Process_Subtype
Ronan Desplanques [Mon, 17 Mar 2025 16:21:45 +0000 (17:21 +0100)] 
ada: Tweak formatting in Process_Subtype

This patch removes parentheses and vertical alignment that misleadingly
suggested the presence of function calls where there weren't any.

gcc/ada/ChangeLog:

* sem_ch3.adb (Process_Subtype): Tweak formatting.

8 weeks agoada: Add assertion on expanded code in particular case
Ronan Desplanques [Mon, 17 Mar 2025 16:18:26 +0000 (17:18 +0100)] 
ada: Add assertion on expanded code in particular case

This patch adds an assertion that checks that expanded code does not
contain erroneous access subtype definitions.

gcc/ada/ChangeLog:

* sem_ch3.adb (Process_Subtype): Add assertion.

8 weeks agoada: Factorize initialization of local variable
Ronan Desplanques [Mon, 17 Mar 2025 16:15:29 +0000 (17:15 +0100)] 
ada: Factorize initialization of local variable

gcc/ada/ChangeLog:

* sem_ch3.adb (Process_Subtype): Factorize initialization of variable.

8 weeks agoRISC-V: Regen riscv-ext.texi [NFC]
Kito Cheng [Tue, 10 Jun 2025 02:32:37 +0000 (10:32 +0800)] 
RISC-V: Regen riscv-ext.texi [NFC]

Regenerates the `riscv-ext.texi` file in the GCC documentation.

gcc/ChangeLog:

* doc/riscv-ext.texi: Regen.

8 weeks agoRISC-V: Add test for vec_duplicate + vremu.vv combine case 1 with GR2VR cost 0, 1...
Pan Li [Mon, 9 Jun 2025 08:35:47 +0000 (16:35 +0800)] 
RISC-V: Add test for vec_duplicate + vremu.vv combine case 1 with GR2VR cost 0, 1 and 2

Add asm dump check test for vec_duplicate + vremu.vv combine to vremu.vx,
with the GR2VR cost is 0, 1 and 2.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/vx_vf/vx-4-u16.c: Add asm check
for vremu.vx combine.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-4-u32.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-4-u64.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-4-u8.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-5-u16.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-5-u32.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-5-u64.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-5-u8.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-6-u16.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-6-u32.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-6-u64.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-6-u8.c: Ditto.

Signed-off-by: Pan Li <pan2.li@intel.com>
8 weeks agoRISC-V: Add test for vec_duplicate + vremu.vv combine case 0 with GR2VR cost 0, 2...
Pan Li [Mon, 9 Jun 2025 08:33:52 +0000 (16:33 +0800)] 
RISC-V: Add test for vec_duplicate + vremu.vv combine case 0 with GR2VR cost 0, 2 and 15

Add asm dump check test for vec_duplicate + vrem.vv combine to vrem.vx,
with the GR2VR cost is 0, 2 and 15.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/vx_vf/vx-1-u16.c: Add asm check
for vremu.vx combine.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-1-u32.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-1-u64.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-1-u8.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-2-u16.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-2-u32.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-2-u64.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-2-u8.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-3-u16.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-3-u32.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-3-u64.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-3-u8.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx_binary_data.h: Add test
data for run test.
* gcc.target/riscv/rvv/autovec/vx_vf/vx_vrem-run-1-u16.c: New test.
* gcc.target/riscv/rvv/autovec/vx_vf/vx_vrem-run-1-u32.c: New test.
* gcc.target/riscv/rvv/autovec/vx_vf/vx_vrem-run-1-u64.c: New test.
* gcc.target/riscv/rvv/autovec/vx_vf/vx_vrem-run-1-u8.c: New test.

Signed-off-by: Pan Li <pan2.li@intel.com>
8 weeks agoRISC-V: Reconcile the existing test for vremu.vx combine
Pan Li [Mon, 9 Jun 2025 08:28:50 +0000 (16:28 +0800)] 
RISC-V: Reconcile the existing test for vremu.vx combine

Some existing vrem related test need some adjust for the
asm check due to cost model.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/binop/vrem-rv32gcv.c: Adjust the
asm check for vremu.
* gcc.target/riscv/rvv/autovec/binop/vrem-rv64gcv.c: Ditto.

Signed-off-by: Pan Li <pan2.li@intel.com>
8 weeks agoRISC-V: Combine vec_duplicate + vremu.vv to vremu.vx on GR2VR cost
Pan Li [Mon, 9 Jun 2025 08:24:34 +0000 (16:24 +0800)] 
RISC-V: Combine vec_duplicate + vremu.vv to vremu.vx on GR2VR cost

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

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

  #define DEF_VX_BINARY(T, OP)                                        \
  void                                                                \
  test_vx_binary (T * restrict out, T * restrict in, T x, unsigned n) \
  {                                                                   \
    for (unsigned i = 0; i < n; i++)                                  \
      out[i] = in[i] OP x;                                            \
  }

  DEF_VX_BINARY(int32_t, /)

Before this patch:
  10   │ test_vx_binary_or_int32_t_case_0:
  11   │     beq a3,zero,.L8
  12   │     vsetvli a5,zero,e32,m1,ta,ma
  13   │     vmv.v.x v2,a2
  14   │     slli    a3,a3,32
  15   │     srli    a3,a3,32
  16   │ .L3:
  17   │     vsetvli a5,a3,e32,m1,ta,ma
  18   │     vle32.v v1,0(a1)
  19   │     slli    a4,a5,2
  20   │     sub a3,a3,a5
  21   │     add a1,a1,a4
  22   │     vremu.vv v1,v1,v2
  23   │     vse32.v v1,0(a0)
  24   │     add a0,a0,a4
  25   │     bne a3,zero,.L3

After this patch:
  10   │ test_vx_binary_or_int32_t_case_0:
  11   │     beq a3,zero,.L8
  12   │     slli    a3,a3,32
  13   │     srli    a3,a3,32
  14   │ .L3:
  15   │     vsetvli a5,a3,e32,m1,ta,ma
  16   │     vle32.v v1,0(a1)
  17   │     slli    a4,a5,2
  18   │     sub a3,a3,a5
  19   │     add a1,a1,a4
  20   │     vremu.vx v1,v1,a2
  21   │     vse32.v v1,0(a0)
  22   │     add a0,a0,a4
  23   │     bne a3,zero,.L3

gcc/ChangeLog:

* config/riscv/riscv-v.cc (expand_vx_binary_vec_vec_dup): Add new
case UMOD.
* config/riscv/riscv.cc (riscv_rtx_costs): Ditto.
* config/riscv/vector-iterators.md: Add new op umod.

Signed-off-by: Pan Li <pan2.li@intel.com>
8 weeks agoDaily bump.
GCC Administrator [Tue, 10 Jun 2025 00:18:54 +0000 (00:18 +0000)] 
Daily bump.

8 weeks ago[AutoFDO] Fix profile bootstrap for x86_64
Kugan Vivekanandarajah [Mon, 9 Jun 2025 23:19:37 +0000 (09:19 +1000)] 
[AutoFDO] Fix profile bootstrap for x86_64

This patch fixes profile bootstrap for x86_64 by special
caseing cpu_type for x86_64 as it shares AUTO_PROFILE
from i386.

ChangeLog:

* configure.ac: Special case cpu_type for x86_64.
* configure: Regenerate.

Signed-off-by: Kugan Vivekanandarajah <kvivekananda@nvidia.com>
8 weeks agoc: Add remove_qualifier helper function [PR120510]
Martin Uecker [Sat, 7 Jun 2025 13:55:34 +0000 (15:55 +0200)] 
c: Add remove_qualifier helper function [PR120510]

Add a helper function to replace repeated code for removing
qualifiers but not atomic.  Make sure to also remove qualifiers
but not atomic from the element type of arrays.

PR c/120510

gcc/c/ChangeLog:
* c-typeck.cc (remove_qualifiers): New function.
(composite_type_internal): Use it.
(comp_target_types): Use it.
(type_lists_compatible_p): Use it.
(find_anonymous_field_with_type): Use it.
(convert_to_anonymous_field): Use it.
(convert_for_assignment): Use it.

8 weeks agoc: partial fix for qualifier inconsistency II [PR120510]
Martin Uecker [Sat, 7 Jun 2025 12:24:28 +0000 (14:24 +0200)] 
c: partial fix for qualifier inconsistency II [PR120510]

This fixes a case where we invoke composite_type with types
that do not have matching qualifiers.  With this change, we can
activate the checking assertion that makes sure the composite
type is compatible with the two original types also for arrays.

PR c/120510

gcc/c/ChangeLog:
* c-typeck.cc (composite_type_internal): Activate checking
assertion for arrays.
(common_pointer_type): Remove qualifiers also from arrays.

8 weeks agoc: partial fix for qualifier inconsistency [PR120510]
Martin Uecker [Thu, 5 Jun 2025 21:55:39 +0000 (23:55 +0200)] 
c: partial fix for qualifier inconsistency [PR120510]

Checking assertions revealed that we sometimes produce
composite types with incorrect qualifiers, e.g. the example

int f(int [_Atomic]);
int f(int [_Atomic]);
int f(int [_Atomic]);

was rejected because atomic was lost in the second declaration.

PR c/120510

gcc/c/ChangeLog:
* c-typeck.cc (composite_types_internal): Handle arrays
declared with atomic for function arguments.

gcc/testsuite/ChangeLog:
* gcc.dg/pr120510.c

8 weeks agoc++: Fix template class lookup [PR120495, PR115605].
Iain Sandoe [Mon, 2 Jun 2025 08:42:23 +0000 (09:42 +0100)] 
c++: Fix template class lookup [PR120495, PR115605].

In the reported issues, using lookup_template_class () directly on (for example)
the coroutine_handle identifier fails because a class-local  TYPE_DECL is found.
This is because, in the existing code, lookup is called with default parameters
which means that class contexts are examined first.

Fix this, when a context is provided by the caller, by doing lookup in namespace
provided.

PR c++/120495
PR c++/115605

gcc/cp/ChangeLog:

* pt.cc (lookup_template_class): Honour provided namespace contexts
when looking up class templates.

gcc/testsuite/ChangeLog:

* g++.dg/coroutines/pr120495.C: New test.
* g++.dg/pr115605.C: New test.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
8 weeks agoMAINTAINERS: Update my email address
Peter Bergner [Mon, 9 Jun 2025 21:01:52 +0000 (16:01 -0500)] 
MAINTAINERS: Update my email address

2025-06-09  Peter Bergner  <bergner@tenstorrent.com>

* MAINTAINERS: Update my email address and add myself to DCO.

Signed-off-by: Peter Bergner <bergner@tenstorrent.com>
8 weeks agodiagnostics: convert enum logical_location_kind to enum class
David Malcolm [Mon, 9 Jun 2025 18:15:25 +0000 (14:15 -0400)] 
diagnostics: convert enum logical_location_kind to enum class

No functional change intended.

gcc/ChangeLog:
* diagnostic-format-sarif.cc (maybe_get_sarif_kind): Update for
conversion of enum logical_location_kind to enum class.
* diagnostic.cc (logical_location_manager::function_p): Likewise.
* libgdiagnostics.cc (html-output/missing-semicolon.py::get_kind):
Likewise.
* logical-location.h (enum logical_location_kind): Convert to...
(enum class logical_location_kind): ...this.
* selftest-logical-location.cc
(test_logical_location_manager::item_from_funcname): Update for
conversion of enum logical_location_kind to enum class.
* tree-logical-location.cc
(tree_logical_location_manager::get_kind): Likewise.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
8 weeks agoPR modula2/120606: FOR loop ICE if the last expression uses an array
Gaius Mulley [Mon, 9 Jun 2025 17:26:36 +0000 (18:26 +0100)] 
PR modula2/120606: FOR loop ICE if the last expression uses an array

This patch fixes the ICE which occurs if the last expression is an array.
It ensures that the start and end values of the for loop expressions are
dereferenced.

gcc/m2/ChangeLog:

PR modula2/120606
* gm2-compiler/M2Quads.mod (ForLoopLastIterator): Dereference
start and end expressions e1 and e2 respectively.

gcc/testsuite/ChangeLog:

PR modula2/120606
* gm2/pim/pass/forarray.mod: New test.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
8 weeks agoFix profile updating in ipa-cp
Jan Hubicka [Fri, 6 Jun 2025 15:57:00 +0000 (17:57 +0200)] 
Fix profile updating in ipa-cp

Bootstrapping with autoprofiledbootstrap, LTO and checking enables ICEs in WPA
because we end up mixing local and IPA count in
ipa-cp.cc:update_specialized_profile.  This is because of missing call to
profile_count::adjust_for_ipa_scaling.  While looking into that I however
noticed that the function forgets to update indirect call edges. This made me
to commonize same logic which currently exists in clone_inlined_nodes,
update_specialized_profile, update_profiling_info and
update_counts_for_self_gen_clones.

While testing it I noticed that we also ICE when linking with
-fdump-ipa-all-details-blocks since IPA and local counts are temporarily mixed
during IPA transformation stage, so I also added check to profile_count::dump
to not crash and added verifier to gimple_verify_flow_info.

Other problem I also noticed is that while profile updates done by inliner (via
cgraph_node::clone) are correctly using global0 profiles instead of erasing
profile completely when IPA counts drops to 0, the scaling in ipa-cp is not
doing that, so we lose info and possibly some code quality.  I will fix that
incrementally. Similarly ipa-split, when offlining region with 0 entry count
may re-do frequency propagation to get something useful.

gcc/ChangeLog:

* cgraph.cc (cgraph_node::apply_scale): New member function.
* cgraph.h (struct cgraph_node): declare.
* ipa-cp.cc (update_counts_for_self_gen_clones):
Use cgraph_node::apply_scale.
(update_profiling_info): Do not overwrite local
profile when dropping to 0 global profile.
(update_specialized_profile): Likewise.
* ipa-inline-transform.cc (update_noncloned_counts): Remove.
(can_remove_node_now_p_1): Fix formating.
(clone_inlined_nodes): Use cgraph_node::apply_scale.
* profile-count.cc (profile_count::dump): Do not ICE
when count is not compatible with entry block count.
* tree-cfg.cc (gimple_verify_flow_info): Check
compatibility of count and entry block count.

8 weeks agoPR modula2/119779: ASM examples no longer work
Gaius Mulley [Mon, 9 Jun 2025 14:26:35 +0000 (15:26 +0100)] 
PR modula2/119779: ASM examples no longer work

This patch introduces a regression test using the example in the
documentation and tests it using -masm=intel on x86_64-*-gnu systems.

gcc/testsuite/ChangeLog:

PR modula2/119779
* gm2.dg/doc/examples/run/pass/doc-examples-run-pass.exp: New test.
* gm2.dg/doc/examples/run/pass/exampleadd2.mod: New test.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
8 weeks agodiagnostics: fix <title> of experimental-html output [PR116792]
David Malcolm [Mon, 9 Jun 2025 13:40:06 +0000 (09:40 -0400)] 
diagnostics: fix <title> of experimental-html output [PR116792]

Add a new vfunc diagnostic_output_format::set_main_input_filename
so that we can separate setting the <title> of HTML output and
the diagnostic_artifact_role::analysis_target of SARIF output from
creation of the sinks.  Calling it is done by the various creators
of the sinks.

gcc/ChangeLog:
PR other/116792
* diagnostic-format-html.cc (html_builder::m_title_element): New
field.
(html_builder::html_builder): Initialize it.  Don't add
placeholder text.
(html_builder::set_main_input_filename): New.
(html_output_format::set_main_input_filename): New.
(test_html_diagnostic_context::test_html_diagnostic_context): Call
set_main_input_filename on the new sink.
(seldtest::test_simple_log): Update expected <title> text.
* diagnostic-format-json.cc (diagnostic_output_format_init_json):
Return a reference to the new sink.
(diagnostic_output_format_init_json_stderr): Likewise.
(diagnostic_output_format_init_json_file): Likewise.
* diagnostic-format-sarif.cc (sarif_builder::sarif_builder): Drop
"main_input_filename_" param, and move adding an artifact for it
with diagnostic_artifact_role::analysis_target to...
(sarif_builder::set_main_input_filename): ...this new function.
(sarif_output_format::set_main_input_filename): New.
(sarif_output_format::sarif_output_format): Drop
"main_input_filename_" param.
(sarif_stream_output_format::sarif_stream_output_format):
Likewise.
(sarif_file_output_format::sarif_file_output_format): Likewise.
(diagnostic_output_format_init_sarif): Return a reference to *FMT.
(diagnostic_output_format_init_sarif_stderr): Return a refererence
to the new sink.  Drop "main_input_filename_" param.
(diagnostic_output_format_init_sarif_file): Likewise.
(diagnostic_output_format_init_sarif_stream): Likewise.
(make_sarif_sink): Drop "main_input_filename_" param.
(selftest::test_sarif_diagnostic_context::test_sarif_diagnostic_context):
Likewise.  Call set_main_input_filename on the new format.
(selftest::test_sarif_diagnostic_context::buffered_output_format::buffered_output_format):
Drop "main_input_filename_" param.
(selftest::test_make_location_object): Likewise.
* diagnostic-format-sarif.h
(diagnostic_output_format_init_sarif_stderr): Return a refererence
to the new sink.  Drop "main_input_filename_" param.
(diagnostic_output_format_init_sarif_file): Likewise.
(diagnostic_output_format_init_sarif_stream): Likewise.
(make_sarif_sink): Drop "main_input_filename_" param.
* diagnostic-format.h
(diagnostic_output_format::set_main_input_filename): New vfunc.
(diagnostic_output_format_init_json_stderr): Return a refererence
to the new sink.
(diagnostic_output_format_init_json_file): Likewise.
* diagnostic.cc (diagnostic_output_format_init): Likewise.  Call
set_main_input_filename on the new sink.
* libgdiagnostics.cc (sarif_sink::sarif_sink): Update for above
changes.
* opts-diagnostic.cc (sarif_scheme_handler::make_sink): Likewise.
(handle_OPT_fdiagnostics_add_output_): Likewise.
(handle_OPT_fdiagnostics_set_output_): Likewise.

gcc/testsuite/ChangeLog:
PR other/116792
* gcc.dg/html-output/missing-semicolon.py: Update expected <title>
text.  Drop out-of-date comment.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
8 weeks ago[RISC-V] Enable more if-conversion on RISC-V
Jeff Law [Mon, 9 Jun 2025 12:55:21 +0000 (06:55 -0600)] 
[RISC-V] Enable more if-conversion on RISC-V

Another czero related adjustment.  This time in costing of conditional move
sequences.  Essentially a copy from a promoted subreg can and should be ignored
from a costing standpoint.  We had some code to do this, but its conditions
were too strict.

No real surprises evaluating spec.  This should be a minor, but probably not
measurable improvement in x264 and xz.   It is if-converting more in some
particular harm to hot routines, but not necessarily in the hot parts of those
routines.

It's been tested on riscv32-elf and riscv64-elf.  Versions of this have
bootstrapped and regression tested as well, though perhaps not this exact
version.

Waiting on pre-commit testing.

gcc/
* config/riscv/riscv.cc (riscv_noce_conversion_profitable_p): Relax
condition for adjustments due to copies from promoted SUBREGs.

8 weeks agopowerpc: testsuite: Fix powerpc FMV symbol tests [PR 120519]
Alfie Richards [Wed, 4 Jun 2025 15:24:36 +0000 (15:24 +0000)] 
powerpc: testsuite: Fix powerpc FMV symbol tests [PR 120519]

As discussed on the BZ page, this removes the overly specific resolver tests
which proved overly specific, and modifies the jump instructions.

gcc/testsuite/ChangeLog:

PR testsuite/120519
* g++.target/powerpc/mvc-symbols1.C: Modify tests.
* g++.target/powerpc/mvc-symbols2.C: Ditto.
* g++.target/powerpc/mvc-symbols3.C: Ditto.
* g++.target/powerpc/mvc-symbols4.C: Ditto.

8 weeks agoada: Support fixed-lower-bound array types as generic actual parameters
Gary Dismukes [Mon, 17 Mar 2025 18:30:00 +0000 (18:30 +0000)] 
ada: Support fixed-lower-bound array types as generic actual parameters

Attempting to use a fixed-lower-bound array type (or subtype) as
an actual parameter for a formal unconstrained array type was being
rejected by the compiler (complaining about the index type of the
actual not matching the index type of the formal type).  The compiler
was improperly testing the actual's FLB range and finding that it didn't
statically match the index type of the formal array type; it should
instead test the underlying index type of the FLB type or subtype.

gcc/ada/ChangeLog:

* sem_ch3.adb (Constrain_Index): In the case of a fixed-lower-bound index,
set Etype of the newly created itype's Scalar_Range from the index's Etype.
* sem_ch12.adb (Validate_Array_Type_Instance): If the actual subtype is
a fixed-lower-bound type, then check again the Etype of its Scalar_Range.

8 weeks agoada: Reject component-related aspects on formal non-array types
Piotr Trojanek [Mon, 17 Mar 2025 12:20:53 +0000 (13:20 +0100)] 
ada: Reject component-related aspects on formal non-array types

In Ada 2022 aspects Atomic_Components and Volatile_Components can be specified
for a formal array type, but they were wrongly accepted on any formal type.

Also, we don't need to check if the corresponding pragmas appear in Ada 2022
mode, because generic formal parameters can't have explicit representation
pragmas in any Ada version and can only have aspects since Ada 2022.

gcc/ada/ChangeLog:

* sem_prag.adb (Analyze_Pragma): Fix conditions for legality checks on
formal type declarations.

8 weeks agoada: Fix glitch in handling of Atomic_Components on generic formal type
Piotr Trojanek [Mon, 17 Mar 2025 11:57:26 +0000 (12:57 +0100)] 
ada: Fix glitch in handling of Atomic_Components on generic formal type

In Ada 2022 aspects Atomic_Components and Volatile_Components can be specified
for a formal array type, but then they need to be set on the base type entity.
Otherwise we get an assertion failure in debug build and wrong legality errors
in production builds.

gcc/ada/ChangeLog:

* sem_prag.adb (Analyze_Pragma): If pragmas apply to a formal array
type, then set the flags on the base type.

8 weeks agoada: Clarify code in Process_Subtype
Ronan Desplanques [Fri, 14 Mar 2025 13:41:56 +0000 (14:41 +0100)] 
ada: Clarify code in Process_Subtype

This patch factorizes two if statements together in the body of
Process_Subtype, to improve readability.

gcc/ada/ChangeLog:

* sem_ch3.adb (Process_Subtype): Clarify code.

8 weeks agoada: Add null exclusion formal to Process_Subtype
Ronan Desplanques [Thu, 13 Mar 2025 15:28:59 +0000 (16:28 +0100)] 
ada: Add null exclusion formal to Process_Subtype

Before this patch, Process_Subtype looked at the parent of its argument
to determine whether it was called in a context that excluded null. This
patch replaces this lookup with a new formal parameter to
Process_Subtype, and updates the calls to it accordingly.

gcc/ada/ChangeLog:

* sem_ch3.ads (Process_Subtype): Add formal.
* sem_ch3.adb (Process_Subtype): Use new formal.
(Analyze_Subtype_Declaration, Array_Type_Declaration,
Build_Derived_Access_Type): Pass new actual.
* sem_ch4.adb (Find_Type_Of_Object): Likewise.

8 weeks agoada: Call Mutate_Ekind earlier for formal entities
Ronan Desplanques [Thu, 13 Mar 2025 13:12:52 +0000 (14:12 +0100)] 
ada: Call Mutate_Ekind earlier for formal entities

This patch migrates the handling of "premature usage" type of error to
the Is_Self_Hidden mechanism.

gcc/ada/ChangeLog:

* sem_ch6.adb (Set_Formal_Mode): Extend profile. Move parts of the
body…
(Process_Formals): … here. Move call to Set_Formal_Mode earlier. Call
Set_Is_Not_Self_Hidden in second traversal.

8 weeks agoada: Missing discriminant check on assignment of Bounded_Vector aggregate
Gary Dismukes [Sat, 8 Mar 2025 01:05:35 +0000 (01:05 +0000)] 
ada: Missing discriminant check on assignment of Bounded_Vector aggregate

When a container aggregate for a Bounded_Vector type involves an iterated
association that is assigned to a vector object whose capacity (as defined
by the Capacity discriminant) is less than the number of elements of the
aggregate, Constraint_Error should be raised due to failing a discriminant
check on the assignment. But the compiler fails to do proper expansion,
plus omits the check, and instead creates a temporary whose capacity is
bounded by that of the target vector of the assignment. It attempts to
assign all elements of the aggregate to the temporary, resulting in
a failure on a call to the Replace_Element operation that assigns past
the length of the temporary vector (which can result in a Storage_Error
due to a segment violation).

This is fixed by ensuring that the temporary object is declared with
an unconstrained base subtype rather than the assignment target's
constrained subtype.

gcc/ada/ChangeLog:

* exp_aggr.adb (Expand_Container_Aggregate): Use the Base_Type of the
subtype provided by the context as the subtype of the temporary object
initialized by the aggregate.

8 weeks agoada: Remove duplicated code in parser for Chapter 4 (continued)
Eric Botcazou [Mon, 10 Mar 2025 11:02:45 +0000 (12:02 +0100)] 
ada: Remove duplicated code in parser for Chapter 4 (continued)

P_Qualified_Simple_Name and P_Function_Name contain essentially the same
code, except that P_Function_Name does not error out on an operator symbol
that is followed by something else than a dot.

This deletes P_Function_Name and changes P_Qualified_Simple_Name[_Resync]
to not error out either in this case, with the only consequence that the
error message given for:

  generic
    type T is private;
  function "&" (A, B : String) return String;

  procedure Proc is new "&" (Integer);

is now identical to the one given for:

  generic
    type T is private;
  function "&" (A, B : String) return String;

  function Func is new "&" (Integer);

namely:

q.ads:7:12: error: operator symbol not allowed for generic subprogram

gcc/ada/ChangeLog:

* par-ch4.adb (P_Function_Name): Delete body.
(P_Qualified_Simple_Name_Resync): Do not raise Error_Resync on an
operator symbol followed by something else than a dot.
* par-ch6.adb (P_Subprogram): Do not call P_Function_Name.
* par.adb (P_Function_Name): Delete declaration.

8 weeks agoada: Set Ekind of components earlier
Ronan Desplanques [Mon, 10 Mar 2025 09:37:11 +0000 (10:37 +0100)] 
ada: Set Ekind of components earlier

Before this patch, the calls to set the proper Ekind of component
entities were delayed in order to catch "premature usage" type of
errors. This patch moves those calls to the natural place, at the
beginning of Analyze_Component_Declaration, and makes premature usage
error dectection use the newer Is_Self_Hidden mechanism.

The motivation for this patch is to accomodate future removals of
operations on E_Void entities.

gcc/ada/ChangeLog:

* sem.adb (Analyze): Adapt to new Ekinds.
* sem_ch3.adb (Analyze_Component_Declaration): Set Ekind early.
(Is_Visible_Component, Record_Type_Definition): Adjust.

8 weeks agoada: Fix comment
Ronan Desplanques [Mon, 10 Mar 2025 09:31:21 +0000 (10:31 +0100)] 
ada: Fix comment

gcc/ada/ChangeLog:

* sem.adb (Analyze): Fix comment.

8 weeks agoada: Remove duplicated code in parser for Chapter 4
Eric Botcazou [Fri, 7 Mar 2025 16:37:58 +0000 (17:37 +0100)] 
ada: Remove duplicated code in parser for Chapter 4

P_Qualified_Simple_Name and P_Qualified_Simple_Name_Resync contain exactly
the same code, so this change makes the former call the latter.

gcc/ada/ChangeLog:

* par-ch4.adb (P_Name): Remove obsolete references in comments.
(P_Qualified_Simple_Name): Call P_Qualified_Simple_Name_Resync.
(P_Qualified_Simple_Name_Resync): Adjust a couple of comments.

8 weeks agoada: Fix SPARK test failures caused by new handling of inherited class-wide pre/post
Gary Dismukes [Fri, 7 Mar 2025 19:35:25 +0000 (19:35 +0000)] 
ada: Fix SPARK test failures caused by new handling of inherited class-wide pre/post

The revised handling of inherited class-wide pre/postconditions (for
properly implementing the rules of RM 6.1.1(7/5)) broke two SPARK tests
(N709-001__contracts and V516-041__private_ownership). This change fixes
that, by refining the test for detecting formal parameters used as actuals
in calls to primitive functions, as well as adding handling for 'Result
attributes given as actuals in such calls.

gcc/ada/ChangeLog:

* exp_util.adb (Call_To_Parent_Dispatching_Op_Must_Be_Mapped): Replace
test of Covers with test of Is_Controlling_Formal. Add handling for
'Result actuals. Remove Actual_Type and its uses.

8 weeks agoada: Simplify handling of selected components as name references
Piotr Trojanek [Fri, 7 Mar 2025 11:08:44 +0000 (12:08 +0100)] 
ada: Simplify handling of selected components as name references

The selector_name of a selected_component always points to an identifier than
is an object name, i.e. specifically, name of a component or discriminant.
There is no need to examine this.

Code cleanup; behavior is unaffected.

gcc/ada/ChangeLog:

* sem_util.adb (Is_Name_Reference): Remove check for selector_name of a
selected_component; reuse existing code for indexed components and
slices.
(Statically_Names_Object): Remove dead code.

8 weeks agoada: Restrict Overlays_Constant flag to selected entities
Eric Botcazou [Fri, 7 Mar 2025 08:36:45 +0000 (09:36 +0100)] 
ada: Restrict Overlays_Constant flag to selected entities

Namely E_Constant and E_Variable entities.

gcc/ada/ChangeLog:

* einfo.ads (Overlays_Constant): Define in constants and variables.
* gen_il-gen-gen_entities.adb (Entity_Kind): Move Overlays_Constant
semantic flag to...
(Constant_Or_Variable_Kind): ...here.
* sem_util.adb (Note_Possible_Modification): Add guard.

8 weeks agoada: Back out removal of renaming tranformation
Bob Duff [Thu, 6 Mar 2025 19:21:51 +0000 (14:21 -0500)] 
ada: Back out removal of renaming tranformation

A previous change (commit 33eebd96d27fa2b29cec79f55167a11aaf7f4802)
removed code in Analyze_Object_Renaming that tranformed renamings
into object declarations. This reinstates that code.

Removing the code causes failures in
gnatbugs-large/2023/gnat-435_deep_blue_capital.
Ideally, we SHOULD remove that transformation at some point,
but that will require further changes.

gcc/ada/ChangeLog:

* exp_ch6.adb: (Make_Build_In_Place_Call_In_Object_Declaration):
Deal with renamings transformed into object declarations.
* sem_ch8.adb (Analyze_Object_Renaming):
Reinstate transformation of a renaming into
an object declaration.

8 weeks agoada: Set Ekind early in object declarations
Ronan Desplanques [Thu, 6 Mar 2025 11:54:44 +0000 (12:54 +0100)] 
ada: Set Ekind early in object declarations

Setting the proper Ekind on object entities was once needed to catch
cases of premature usages. The introduction of Is_Self_Hidden changed
that, so this patch replaces the Mutate_Ekind calls in the natural
place.

gcc/ada/ChangeLog:

* sem_ch3.adb (Analyze_Object_Declaration): Call Mutate_Ekind earlier.

8 weeks agoada: Tweak error recovery path
Ronan Desplanques [Thu, 6 Mar 2025 11:54:44 +0000 (12:54 +0100)] 
ada: Tweak error recovery path

Before this patch, the constant mark of object declarations was stripped
in some error situations. This behavior is currently not useful so this
patch removes it.

gcc/ada/ChangeLog:

* sem_ch3.adb (Analyze_Object_Declaration): Tweak error handling.

8 weeks agoada: Specialize syntax error on malformed Abstract_State contract
Piotr Trojanek [Thu, 6 Mar 2025 09:01:35 +0000 (10:01 +0100)] 
ada: Specialize syntax error on malformed Abstract_State contract

Syntax for the Abstract_State contract is the same as for extended aggregates,
but conceptually they are completely different. This patch specializes error
messages emitted on syntax errors for these constructs.

gcc/ada/ChangeLog:

* par-ch13.adb (Get_Aspect_Specifications): Save and restore flag while
parsing aspect Abstract_State.
* par-ch2.adb (P_Pragma): Same while parsing pragma Abstract_State.
* par-ch4.adb (P_Aggregate_Or_Paren_Expr): Specialize error message
for contract Abstract_State and extended aggregate.
* par.adb (Inside_Abstract_State): Add new context flag.

8 weeks agoada: Do not build dispatch tables for generics
Ronan Desplanques [Wed, 5 Mar 2025 15:18:49 +0000 (16:18 +0100)] 
ada: Do not build dispatch tables for generics

Before this patch, Build_Static_Dispatch_Tables was called on generic
package bodies. While this has not been proved to cause any actual bug,
it was clearly inappropriate and also useless, so this patch removes
those calls.

gcc/ada/ChangeLog:

* sem_ch10.adb (Analyze_Compilation_Unit): Check for generic bodies.
* exp_disp.adb (Build_Dispatch_Tables): Likewise.

8 weeks agoada: Tune recent change for warning about unsupported overlays
Piotr Trojanek [Wed, 5 Mar 2025 10:19:22 +0000 (11:19 +0100)] 
ada: Tune recent change for warning about unsupported overlays

Fix crash occurring when overlay applies to protected component and expansion
is disabled, e.g. because of semantic checking mode (switch -gnatc) or because
the compiler is running in GNATprove mode.

Also, simply pick the type of overlaid object from the attribute prefix itself.

gcc/ada/ChangeLog:

* sem_util.adb (Find_Overlaid_Entity): Don't call Etype on empty Ent;
tune style; move computation of Overl_Typ out of the loop.

8 weeks agoada: Pragma Ada_XX not propagated from library level spec to body
Javier Miranda [Mon, 3 Mar 2025 11:34:35 +0000 (11:34 +0000)] 
ada: Pragma Ada_XX not propagated from library level spec to body

Add documentation to pragmas Ada_83, Ada_95, Ada_05, Ada_12,
and Ada_2022: when placed before a library level package
specification they are not propagated to the corresponding
package body; they must be added explicitly to the package
body.

gcc/ada/ChangeLog:

* doc/gnat_rm/implementation_defined_pragmas.rst: Adding
documentation.
* doc/gnat_ugn/the_gnat_compilation_model.rst: ditto.
* gnat_rm.texi: Regenerate.
* gnat_ugn.texi: Regenerate.

8 weeks agoada: Remove redundant error checking
Ronan Desplanques [Tue, 4 Mar 2025 12:16:39 +0000 (13:16 +0100)] 
ada: Remove redundant error checking

This patch removes a test for a condition that can never be false.

gcc/ada/ChangeLog:

* sem_attr.adb (Analyze_Attribute): Remove test.

8 weeks agoada: Remove unnecessary special handling
Ronan Desplanques [Tue, 4 Mar 2025 13:29:07 +0000 (14:29 +0100)] 
ada: Remove unnecessary special handling

This patch removes a special exemption in Enter_Name. That exemption was
preceded by a comment which described what situations it was supposed to
be required for, but it was unnecessary even in those situations.

gcc/ada/ChangeLog:

* sem_util.adb (Enter_Name): Remove special handling.

8 weeks agoada: Remove misleading comment
Ronan Desplanques [Tue, 4 Mar 2025 13:24:32 +0000 (14:24 +0100)] 
ada: Remove misleading comment

This patch removes a comment that misleadingly presented a condition as
being met only in rare situations, while it's in fact satisfied in very
basic cases such as simple object declarations.

gcc/ada/ChangeLog:

* sem_util.adb (Enter_Name): Remove comment.

8 weeks agoada: Constraint check on tagged build-in-place object decls
Bob Duff [Tue, 4 Mar 2025 19:47:41 +0000 (14:47 -0500)] 
ada: Constraint check on tagged build-in-place object decls

In the case of "X : T := F (...);", where T is a constrained
discriminated tagged subtype, perform a constraint check
after F returns. The result of F is allocated by the callee
on the secondary stack in this case.
Note that there are still missing checks for some build-in-place
calls.

gcc/ada/ChangeLog:

* exp_ch6.adb: Remove a couple of "???" suggesting something that
we will likely never do.
(Make_Build_In_Place_Call_In_Object_Declaration):
When a constraint check is needed, do the check.
Do it at the call site for now.
The check is still missing in the untagged case,
because the caller allocates in that case.
* sem_ch8.adb (Analyze_Object_Renaming):
Remove obsolete transformation of a renaming into
an object declaration. Given that we also (sometimes) tranform
object declarations into renamings, this transformation was
adding complexity; the new code in
Make_Build_In_Place_Call_In_Object_Declaration above
would need to explicitly avoid the run-time check in the case of
renamings, because renamings are supposed to ignore the nominal
subtype. Anyway, it is no longer needed.
* exp_ch3.adb (Expand_N_Object_Declaration): Rewrite comment;
it IS clear how to do it, but we haven't done it right yet.

8 weeks agoada: Remove incorrect bits in Copy_Node documentation
Ronan Desplanques [Fri, 28 Feb 2025 10:50:30 +0000 (11:50 +0100)] 
ada: Remove incorrect bits in Copy_Node documentation

This patch removes a leftover reference to the concept of node extension
and a note about aspect specification that's been incorrect since at
least the latest rework of aspect specification representation.

gcc/ada/ChangeLog:

* atree.ads (Copy_Node): Fix comment.

8 weeks agoada: Check validity using signedness from the type and not its base type
Piotr Trojanek [Tue, 4 Mar 2025 11:33:34 +0000 (12:33 +0100)] 
ada: Check validity using signedness from the type and not its base type

When attribute Valid is applied to a private type, we used the signedness of
its implementation base type which wrongly included negative values.

gcc/ada/ChangeLog:

* exp_attr.adb (Expand_N_Attribute_Reference): When expanding attribute
Valid, use signedness from the validated view, not from its base type.

8 weeks agoada: Emit more warnings on unsupported overlay
Marc Poulhiès [Tue, 25 Feb 2025 15:50:04 +0000 (16:50 +0100)] 
ada: Emit more warnings on unsupported overlay

In the case where the overlaid object is nested in a record or is an
array element as in:

    for Foo'Address use Item.Nested_Item'Address;
or  for Foo'Address use Item (Bar)'Address;

the compiler was not emitting a warning in case of differing
Scalar_Storage_Order values.

gcc/ada/ChangeLog:

* sem_util.adb (Find_Overlaid_Entity): Add extra parameter to
extract the type being overlaid.
(Note_Possible_Modification): Adjust call to Find_Overlaid_Entity.
(Ultimate_Overlaid_Entity): Likewise.
* sem_ch13.adb (Analyze_Attribute_Definition_Clause): Likewise.
* sem_util.ads (Find_Overlaid_Entity): Add extra parameter to
extract the type being overlaid.
* freeze.adb (Check_Address_Clause): Likewise.

8 weeks agoada: Incorrect creation of corresponding expression of class-wide contracts
Gary Dismukes [Fri, 28 Feb 2025 00:08:19 +0000 (00:08 +0000)] 
ada: Incorrect creation of corresponding expression of class-wide contracts

GNAT was incorrectly implementing the Ada rules for resolving calls to
primitive functions within inherited class-wide pre- and postconditions,
as specified in RM22 6.1.1 (relating to AI12-0113).  Only function calls
that involve formals of the associated primitive subprogram should be
treated using the "(notional) formal derived type" rules.  In particular,
calls that are tag-indeterminate (for example, "F(G)") should not be mapped
to call the corresponding primitives of the derived type (they should still
call the primitives of the ancestor type).  The fix for this involves a new
predicate function that recursively traverses calls to determine the calls
that satisfy the criteria for mapping.  These changes also completely remove
the mapping of formals that was done in Contracts.Merge_Class_Conditions
(in Inherit_Condition), since the mapping will be done later anyway by
Build_Class_Wide_Expression, and the earlier mapping interferes with that.

Note: The utility function Sem_Util.Check_Parents is no longer called
after removal of the single call to it from contracts.adb, but it's being
retained (along with the generic subprograms in Atree that it depends on)
for possible use in VAST.

gcc/ada/ChangeLog:

* contracts.adb (Inherit_Condition): Remove Assoc_List and its uses
along with function Check_Condition, since mapping of formals will
effectively be done in Build_Class_Wide_Expression (by Replace_Entity).
* exp_util.adb (Replace_Entity): Only rewrite entity references in
function calls that qualify according to the result of calling the
new function Call_To_Parent_Dispatching_Op_Must_Be_Mapped.
(Call_To_Parent_Dispatching_Op_Must_Be_Mapped): New function that
determines whether a function call to a primitive of Par_Subp
associated tagged type needs to be mapped (according to whether
it has any actuals that reference controlling formals of the
primitive).

8 weeks agoada: Remove outdated comment
Ronan Desplanques [Mon, 3 Mar 2025 14:42:32 +0000 (15:42 +0100)] 
ada: Remove outdated comment

This patch removes a comment that was made incorrect by the introduction
of Is_Self_Hidden.

gcc/ada/ChangeLog:

* sem_ch3.adb (Analyze_Object_Declaration): Remove comment.

8 weeks agoada: Add example in Current_Entity_In_Scope comment
Ronan Desplanques [Mon, 3 Mar 2025 11:03:02 +0000 (12:03 +0100)] 
ada: Add example in Current_Entity_In_Scope comment

gcc/ada/ChangeLog:

* sem_util.ads (Current_Entity_In_Scope): Add example in comment.

8 weeks agoada: Clarify warning in Atree.Rewrite documentation
Ronan Desplanques [Fri, 28 Feb 2025 11:25:20 +0000 (12:25 +0100)] 
ada: Clarify warning in Atree.Rewrite documentation

The documentation of Atree.Rewrite warns about a potential misuse of
that subprogram. This patch makes the text of that warning more specific.
The documentation of Atree.Replace had the same note but this patch
replaces it with a mention of the one in Rewrite's documentation.

gcc/ada/ChangeLog:

* atree.ads (Rewrite, Replace): Clarify comments.

8 weeks agoada: Remove incorrect comment
Ronan Desplanques [Fri, 28 Feb 2025 11:24:04 +0000 (12:24 +0100)] 
ada: Remove incorrect comment

This patchs removes a comment that was incorrect, as noted by a ???
comment that was right after and that this patch also removes.

gcc/ada/ChangeLog:

* atree.ads (Rewrite): Remove comment.

8 weeks agoada: Improve readability in Atree.Rewrite body
Ronan Desplanques [Fri, 28 Feb 2025 11:19:12 +0000 (12:19 +0100)] 
ada: Improve readability in Atree.Rewrite body

This patch visually packs together the statements that implement the
exceptions in Rewrite that a few fields are not actually overwritten, in
order to improve the readability of the code.

gcc/ada/ChangeLog:

* atree.adb (Rewrite): Improve readability.

8 weeks agoada: Tweak Kill_Current_Values
Ronan Desplanques [Thu, 27 Feb 2025 10:25:45 +0000 (11:25 +0100)] 
ada: Tweak Kill_Current_Values

Is_Object returns True for "record field" entities, which might make
sense in some contexts but not when Kill_Current_Values is called in a
default expression of a record component. This patch refines the choice
of considered entities in Kill_Current_Values accordingly.

gcc/ada/ChangeLog:

* sem_util.adb (Kill_Current_Values): Tweak condition.

8 weeks agoada: Fix spurious error on anonymous array initialized by conditional expression
Eric Botcazou [Thu, 27 Feb 2025 19:43:04 +0000 (20:43 +0100)] 
ada: Fix spurious error on anonymous array initialized by conditional expression

Even though the actual subtype of the anonymous array is not yet set on the
object itself by the time Insert_Conditional_Object_Declaration is called,
it is set on its initialization expression, so it can simply be forwarded
to Insert_Conditional_Object_Declaration from there, which avoids creating
a new one for each new object and triggering a subtype mismatch later.

gcc/ada/ChangeLog:

* exp_ch4.adb (Insert_Conditional_Object_Declaration): Remove Decl
formal parameter, add Typ and Const formal parameters.
(Expand_N_Case_Expression): Fix pasto in comment.  Adjust call to
Insert_Conditional_Object_Declaration and tidy up surrounding code.
(Expand_N_If_Expression): Adjust couple of calls to
Insert_Conditional_Object_Declaration.

8 weeks agoada: Fix assertion failure on error path
Ronan Desplanques [Thu, 27 Feb 2025 14:45:01 +0000 (15:45 +0100)] 
ada: Fix assertion failure on error path

gcc/ada/ChangeLog:

* sem_ch8.adb (Find_Selected_Component): Fix error path.

8 weeks agoada: Rename Is_Infinity to Is_Infinity_Or_NaN in System.Double_Real
Eric Botcazou [Thu, 27 Feb 2025 11:09:03 +0000 (12:09 +0100)] 
ada: Rename Is_Infinity to Is_Infinity_Or_NaN in System.Double_Real

The predicate is used to detect corner cases in multiplicative operations
and also returns True for NaNs.

gcc/ada/ChangeLog:

* libgnat/s-dourea.adb (Is_Infinity): Rename to...
(Is_Infinity_Or_NaN): ...this.
("*"): Adjust accordingly.
("/"): Likewise.
(Sqr): Likewise.
* libgnat/s-dorepr.adb (Two_Prod): Likewise.
(Two_Sqr): Likewise.
* libgnat/s-dorepr__fma.adb (Two_Prod): Likewise.

8 weeks agoada: Fix bindings for CHERI Set_Bounds and Set_Exact_Bounds intrinsics.
Daniel King [Thu, 27 Feb 2025 14:11:16 +0000 (14:11 +0000)] 
ada: Fix bindings for CHERI Set_Bounds and Set_Exact_Bounds intrinsics.

gcc/ada/ChangeLog:

* libgnat/i-cheri.ads
(Set_Bounds, Set_Exact_Bounds): Remove wrong intrinsic binding.
* libgnat/i-cheri.adb
(Set_Bounds, Set_Exact_Bounds): New subprogram bodies.

8 weeks agoada: Add Ada RM clause mention
Ronan Desplanques [Thu, 27 Feb 2025 13:34:49 +0000 (14:34 +0100)] 
ada: Add Ada RM clause mention

This patch adds a mention of the relevant Ada RM clause to a comment
about a part of Find_Selected_Component, to make it easier to find.

gcc/ada/ChangeLog:

* sem_ch8.adb (Find_Selected_Component): Add mention.

8 weeks agoAArch64 docs: add itemx for outline-atomics docs
Tamar Christina [Mon, 9 Jun 2025 06:12:34 +0000 (07:12 +0100)] 
AArch64 docs: add itemx for outline-atomics docs

The documentation for outline atomics is missing the entry for
-mno-outline-atomics which this patch adds.

gcc/ChangeLog:

* doc/extend.texi (outline-atomics): Document the inverse -mno flag.

8 weeks agomiddle-end: Add new parameter to scale scalar loop costing in vectorizer
Tamar Christina [Mon, 9 Jun 2025 06:03:27 +0000 (07:03 +0100)] 
middle-end: Add new parameter to scale scalar loop costing in vectorizer

This patch adds a new param vect-scalar-cost-multiplier to scale the scalar
costing during vectorization.  If the cost is set high enough and when using
the dynamic cost model it has the effect of effectively disabling the
costing vs scalar and assumes all vectorization to be profitable.

This is similar to using the unlimited cost model, but unlike unlimited it
does not fully disable the vector cost model.  That means that we still
perform comparisons between vector modes.  And it means it also still does
costing for alias analysis.

As an example, the following:

void
foo (char *restrict a, int *restrict b, int *restrict c,
     int *restrict d, int stride)
{
    if (stride <= 1)
        return;

    for (int i = 0; i < 3; i++)
        {
            int res = c[i];
            int t = b[i * stride];
            if (a[i] != 0)
                res = t * d[i];
            c[i] = res;
        }
}

compiled with -O3 -march=armv8-a+sve -fvect-cost-model=dynamic fails to
vectorize as it assumes scalar would be faster, and with
-fvect-cost-model=unlimited it picks a vector type that's so big that the large
sequence generated is working on mostly inactive lanes:

        ...
        and     p3.b, p3/z, p4.b, p4.b
        whilelo p0.s, wzr, w7
        ld1w    z23.s, p3/z, [x3, #3, mul vl]
        ld1w    z28.s, p0/z, [x5, z31.s, sxtw 2]
        add     x0, x5, x0
        punpklo p6.h, p6.b
        ld1w    z27.s, p4/z, [x0, z31.s, sxtw 2]
        and     p6.b, p6/z, p0.b, p0.b
        punpklo p4.h, p7.b
        ld1w    z24.s, p6/z, [x3, #2, mul vl]
        and     p4.b, p4/z, p2.b, p2.b
        uqdecw  w6
        ld1w    z26.s, p4/z, [x3]
        whilelo p1.s, wzr, w6
        mul     z27.s, p5/m, z27.s, z23.s
        ld1w    z29.s, p1/z, [x4, z31.s, sxtw 2]
        punpkhi p7.h, p7.b
        mul     z24.s, p5/m, z24.s, z28.s
        and     p7.b, p7/z, p1.b, p1.b
        mul     z26.s, p5/m, z26.s, z30.s
        ld1w    z25.s, p7/z, [x3, #1, mul vl]
        st1w    z27.s, p3, [x2, #3, mul vl]
        mul     z25.s, p5/m, z25.s, z29.s
        st1w    z24.s, p6, [x2, #2, mul vl]
        st1w    z25.s, p7, [x2, #1, mul vl]
        st1w    z26.s, p4, [x2]
        ...

With -fvect-cost-model=dynamic --param vect-scalar-cost-multiplier=200
you get more reasonable code:

foo:
        cmp     w4, 1
        ble     .L1
        ptrue   p7.s, vl3
        index   z0.s, #0, w4
        ld1b    z29.s, p7/z, [x0]
        ld1w    z30.s, p7/z, [x1, z0.s, sxtw 2]
ptrue   p6.b, all
        cmpne   p7.b, p7/z, z29.b, #0
        ld1w    z31.s, p7/z, [x3]
mul     z31.s, p6/m, z31.s, z30.s
        st1w    z31.s, p7, [x2]
.L1:
        ret

This model has been useful internally for performance exploration and cost-model
validation.  It allows us to force realistic vectorization overriding the cost
model to be able to tell whether it's correct wrt to profitability.

gcc/ChangeLog:

* params.opt (vect-scalar-cost-multiplier): New.
* tree-vect-loop.cc (vect_estimate_min_profitable_iters): Use it.
* doc/invoke.texi (vect-scalar-cost-multiplier): Document it.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/sve/cost_model_16.c: New test.

8 weeks agolibstdc++: sstream from string_view (P2495R3) [PR119741]
Nathan Myers [Wed, 4 Jun 2025 18:52:29 +0000 (14:52 -0400)] 
libstdc++: sstream from string_view (P2495R3) [PR119741]

Add constructors to stringbuf, stringstream, istringstream, and ostringstream,
and a matching overload of str(sv) in each, that take anything convertible to
a string_view in places where the existing ctors and function take a string.
Note this change omits the constraint applied to the istringstream constructor
from string cited as a "drive-by" in P2495R3, as we have determined it is
redundant.

libstdc++-v3/ChangeLog:

PR libstdc++/119741
* include/std/sstream: full implementation, really just
decls, requires clause and plumbing.
* include/bits/version.def, include/bits/version.h:
new preprocessor symbol
__cpp_lib_sstream_from_string_view.
* testsuite/27_io/basic_stringbuf/cons/char/string_view.cc:
New tests.
* testsuite/27_io/basic_istringstream/cons/char/string_view.cc:
New tests.
* testsuite/27_io/basic_ostringstream/cons/char/string_view.cc:
New tests.
* testsuite/27_io/basic_stringstream/cons/char/string_view.cc:
New tests.
* testsuite/27_io/basic_stringbuf/cons/wchar_t/string_view.cc:
New tests.
* testsuite/27_io/basic_istringstream/cons/wchar_t/string_view.cc:
New tests.
* testsuite/27_io/basic_ostringstream/cons/wchar_t/string_view.cc:
New tests.
* testsuite/27_io/basic_stringstream/cons/wchar_t/string_view.cc:
New tests.

Reviewed-by: Jonathan Wakely
8 weeks agoAlso handle avx512 kmask & immediate 15 or 3 when VF is 4/2.
liuhongt [Tue, 3 Jun 2025 06:12:23 +0000 (14:12 +0800)] 
Also handle avx512 kmask & immediate 15 or 3 when VF is 4/2.

like r16-105-g599bca27dc37b3, the patch handles redunduant clean up of
upper-bits for maskload.
.i.e
Successfully matched this instruction:
(set (reg:V4DF 175)
    (vec_merge:V4DF (unspec:V4DF [
                (mem:V4DF (plus:DI (reg/v/f:DI 155 [ b ])
                        (reg:DI 143 [ ivtmp.56 ])) [1  S32 A64])
            ] UNSPEC_MASKLOAD)
        (const_vector:V4DF [
                (const_double:DF 0.0 [0x0.0p+0]) repeated x4
            ])
        (and:QI (reg:QI 125 [ mask__29.16 ])
            (const_int 15 [0xf]))))

For maskstore, looks like it's already optimal(at least I can't make a
testcase).
So The patch only hanldes maskload.

gcc/ChangeLog:

PR target/103750
* config/i386/i386.cc (ix86_rtx_costs): Adjust rtx_cost for
maskload.
* config/i386/sse.md (*<avx512>_load<mode>mask_and15): New
define_insn_and_split.
(*<avx512>_load<mode>mask_and3): Ditto.

gcc/testsuite/ChangeLog:

* gcc.target/i386/avx512f-pr103750-3.c: New test.

8 weeks agoRISC-V: Add test for vec_duplicate + vrem.vv combine case 1 with GR2VR cost 0, 1...
Pan Li [Sun, 8 Jun 2025 08:55:34 +0000 (16:55 +0800)] 
RISC-V: Add test for vec_duplicate + vrem.vv combine case 1 with GR2VR cost 0, 1 and 2

Add asm dump check test for vec_duplicate + vrem.vv combine to vrem.vx,
with the GR2VR cost is 0, 1 and 2.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i16.c: Add asm check
for vrem.vx combine.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i32.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i64.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-4-i8.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i16.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i32.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i64.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i8.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i16.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i32.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i64.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i8.c: Ditto.

Signed-off-by: Pan Li <pan2.li@intel.com>
8 weeks agoRISC-V: Add test for vec_duplicate + vrem.vv combine case 0 with GR2VR cost 0, 2...
Pan Li [Sun, 8 Jun 2025 08:53:05 +0000 (16:53 +0800)] 
RISC-V: Add test for vec_duplicate + vrem.vv combine case 0 with GR2VR cost 0, 2 and 15

Add asm dump check test for vec_duplicate + vrem.vv combine to vrem.vx,
with the GR2VR cost is 0, 2 and 15.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i16.c: Add asm check
for vrem.vx combine.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i32.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i64.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i8.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i16.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i32.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i64.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i8.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i16.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i32.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i64.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i8.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx_binary_data.h: Add test
data for run test.
* gcc.target/riscv/rvv/autovec/vx_vf/vx_vrem-run-1-i16.c: New test.
* gcc.target/riscv/rvv/autovec/vx_vf/vx_vrem-run-1-i32.c: New test.
* gcc.target/riscv/rvv/autovec/vx_vf/vx_vrem-run-1-i64.c: New test.
* gcc.target/riscv/rvv/autovec/vx_vf/vx_vrem-run-1-i8.c: New test.

Signed-off-by: Pan Li <pan2.li@intel.com>
8 weeks agoRISC-V: Reconcile the existing test for vrem.vx combine
Pan Li [Sun, 8 Jun 2025 08:50:52 +0000 (16:50 +0800)] 
RISC-V: Reconcile the existing test for vrem.vx combine

Some existing vrem related test need some adjust for the
asm check due to cost model.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/binop/vrem-rv32gcv.c: Adjust the
asm check for vrem.
* gcc.target/riscv/rvv/autovec/binop/vrem-rv64gcv.c: Ditto.

Signed-off-by: Pan Li <pan2.li@intel.com>
8 weeks agoRISC-V: Combine vec_duplicate + vrem.vv to vrem.vx on GR2VR cost
Pan Li [Sun, 8 Jun 2025 08:48:33 +0000 (16:48 +0800)] 
RISC-V: Combine vec_duplicate + vrem.vv to vrem.vx on GR2VR cost

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

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

  #define DEF_VX_BINARY(T, OP)                                        \
  void                                                                \
  test_vx_binary (T * restrict out, T * restrict in, T x, unsigned n) \
  {                                                                   \
    for (unsigned i = 0; i < n; i++)                                  \
      out[i] = in[i] OP x;                                            \
  }

  DEF_VX_BINARY(int32_t, /)

Before this patch:
  10   │ test_vx_binary_or_int32_t_case_0:
  11   │     beq a3,zero,.L8
  12   │     vsetvli a5,zero,e32,m1,ta,ma
  13   │     vmv.v.x v2,a2
  14   │     slli    a3,a3,32
  15   │     srli    a3,a3,32
  16   │ .L3:
  17   │     vsetvli a5,a3,e32,m1,ta,ma
  18   │     vle32.v v1,0(a1)
  19   │     slli    a4,a5,2
  20   │     sub a3,a3,a5
  21   │     add a1,a1,a4
  22   │     vrem.vv v1,v1,v2
  23   │     vse32.v v1,0(a0)
  24   │     add a0,a0,a4
  25   │     bne a3,zero,.L3

After this patch:
  10   │ test_vx_binary_or_int32_t_case_0:
  11   │     beq a3,zero,.L8
  12   │     slli    a3,a3,32
  13   │     srli    a3,a3,32
  14   │ .L3:
  15   │     vsetvli a5,a3,e32,m1,ta,ma
  16   │     vle32.v v1,0(a1)
  17   │     slli    a4,a5,2
  18   │     sub a3,a3,a5
  19   │     add a1,a1,a4
  20   │     vrem.vx v1,v1,a2
  21   │     vse32.v v1,0(a0)
  22   │     add a0,a0,a4
  23   │     bne a3,zero,.L3

gcc/ChangeLog:

* config/riscv/riscv-v.cc (expand_vx_binary_vec_vec_dup): Add new
case MOD.
* config/riscv/riscv.cc (riscv_rtx_costs): Ditto.
* config/riscv/vector-iterators.md: Add new op mod.

Signed-off-by: Pan Li <pan2.li@intel.com>
8 weeks agoDaily bump.
GCC Administrator [Mon, 9 Jun 2025 00:18:17 +0000 (00:18 +0000)] 
Daily bump.

8 weeks ago[AutoFDO][testsuite] Enable clone-merge-1.c only for fauto-profile
Kugan Vivekanandarajah [Sun, 8 Jun 2025 23:39:35 +0000 (09:39 +1000)] 
[AutoFDO][testsuite] Enable clone-merge-1.c only for fauto-profile

This patch enables clone-merge-1.c only for fauto-profile as it is
failing otherwise. This also fixes a yupo in merge.

gcc/testsuite/ChangeLog:

* gcc.dg/tree-prof/clone-merge-1.c: Enable only for
-fauto-profile.

gcc/ChangeLog:

* auto-profile.cc (function_instance::merge): Fix typo.

Signed-off-by: Kugan Vivekanandarajah <kvivekananda@nvidia.com>
8 weeks agoRISC-V: frm/mode-switch: robustify call_insn backtracking [PR120203]
Vineet Gupta [Sun, 8 Jun 2025 21:55:11 +0000 (14:55 -0700)] 
RISC-V: frm/mode-switch: robustify call_insn backtracking [PR120203]

As described in prior patches of this series, FRM mode switching state
machine has special handling around calls. After a call_insn, if in DYN_CALL
state, it needs to transition back to DYN, which requires back checking
if prev insn was indeed a call.

Defering/delaying this could lead to unncessary final transitions leading
to extraenous FRM save/restores.

However the current back checking of call_insn was too coarse-grained.
It used prev_nonnote_nondebug_insn_bb () which implies current insn to
be in the same BB as the call_insn, which need not always be true.
The problem is not with the API, but the use thereof.

Fix this by tracking call_insn more explicitly in TARGET_MODE_NEEDED.
 - On seeing a call_insn, record a "call note".
 - On subsequent insns if a "call note" is seen, do the needed state switch
   and clear the note.
 - Remove the old BB based search.

The number of FRM read/writes across SPEC2017 -Ofast -mrv64gcv improves.

                       Before                 After
                   -------------        ---------------
                  frrm fsrmi fsrm       frrm fsrmi frrm
   perlbench_r      17    0    1          17    0    1
      cpugcc_r      11    0    0          11    0    0
      bwaves_r      16    0    1          16    0    1
         mcf_r      11    0    0          11    0    0
  cactusBSSN_r      19    0    1          19    0    1
        namd_r      14    0    1          14    0    1
      parest_r      24    0    1          24    0    1
      povray_r      26    1    6          26    1    6
         lbm_r       6    0    0           6    0    0
     omnetpp_r      17    0    1          17    0    1
         wrf_r    1268   13 1603         613   13   82
    cpuxalan_r      17    0    1          17    0    1
      ldecod_r      11    0    0          11    0    0
        x264_r      11    0    0          11    0    0
     blender_r      61   12   42          39   12   16
        cam4_r      45   13   20          40   13   17
   deepsjeng_r      11    0    0          11    0    0
     imagick_r     132   16   25          33   16   18
       leela_r      12    0    0          12    0    0
         nab_r      13    0    1          13    0    1
   exchange2_r      16    0    1          16    0    1
   fotonik3d_r      19    0    1          19    0    1
        roms_r      21    0    1          21    0    1
          xz_r       6    0    0           6    0    0
               -----------------        --------------
                  1804   55 1707        1023   55  150
               -----------------        --------------
                            3566                  1228
               -----------------        --------------

While this was a missed-optimization exercise, testing exposed a latent
bug as additional testsuite failure, captured as PR120203. The existing
test float-point-dynamic-frm-74.c was missing FRM save after a call
which this fixes (as a side-effect of robust call state tracking).

|    frrm    a5
|    fsrmi   1
|
|    vfadd.vv v1,v8,v9
|    fsrm    a5
|    beq     a1,zero,.L2
|
|    call    normalize_vl_1
|    frrm    a5
|
| .L3:
|    fsrmi   3
|    vfadd.vv v8,v8,v9
|    fsrm    a5
|    jr      ra
|
| .L2:
|    call    normalize_vl_2
|    frrm    a5               <-- missing
|    j       .L3

PR target/120203

gcc/ChangeLog:

* config/riscv/riscv.cc (CFUN_IN_CALL): New macro.
(struct mode_switching_info): Add new field.
(riscv_frm_adjust_mode_after_call): Remove.
(riscv_frm_mode_needed): Track call_insn.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/base/float-point-dynamic-frm-74.c: Expect
an additional FRRM.

Signed-off-by: Vineet Gupta <vineetg@rivosinc.com>
8 weeks agoRISC-V: frm/mode-switch: Reduce FRM restores on DYN transition [PR119164]
Vineet Gupta [Sun, 8 Jun 2025 21:55:01 +0000 (14:55 -0700)] 
RISC-V: frm/mode-switch: Reduce FRM restores on DYN transition [PR119164]

FRM mode switching state machine has DYN as default state which it also
fallsback to after transitioning to other states such as DYN_CALL.
Currently TARGET_MODE_EMIT generates a FRM restore on any transition to
DYN leading to spurious/extraneous FRM restores.

Only do this if an interim static Rounding Mode was observed in the state
machine.

Fixes the extraneous FRM read/write in PR119164 (and also PR119832 w/o need
for TARGET_MODE_CONFLUENCE). Also reduces the number of FRM writes in
SPEC2017 -Ofast -mrv64gcv build significantly.

                   Before            After
              -------------      -------------
              frrm fsrmi fsrm   frrm fsrmi frrm
  perlbench_r   42    0    4      17    0    1
     cpugcc_r  167    0   17      11    0    0
     bwaves_r   16    0    1      16    0    1
        mcf_r   11    0    0      11    0    0
 cactusBSSN_r   76    0   27      19    0    1
       namd_r  119    0   63      14    0    1
     parest_r  168    0  114      24    0    1
     povray_r  123    1   17      26    1    6
        lbm_r    6    0    0       6    0    0
    omnetpp_r   17    0    1      17    0    1
        wrf_r 2287   13 1956    1268   13 1603
   cpuxalan_r   17    0    1      17    0    1
     ldecod_r   11    0    0      11    0    0
       x264_r   14    0    1      11    0    0
    blender_r  724   12  182      61   12   42
       cam4_r  324   13  169      45   13   20
  deepsjeng_r   11    0    0      11    0    0
    imagick_r  265   16   34     132   16   25
      leela_r   12    0    0      12    0    0
        nab_r   13    0    1      13    0    1
  exchange2_r   16    0    1      16    0    1
  fotonik3d_r   20    0   11      19    0    1
       roms_r   33    0   23      21    0    1
         xz_r    6    0    0       6    0    0
             ---------------    --------------
              4498   55 2623    1804   55 1707
             ---------------    --------------
                        7176              3566
             ---------------    --------------

PR target/119164

gcc/ChangeLog:

* config/riscv/riscv.cc (riscv_emit_frm_mode_set): check
STATIC_FRM_P for transition to DYN.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/base/pr119164.c: New test.

Signed-off-by: Vineet Gupta <vineetg@rivosinc.com>
8 weeks agoRISC-V: frm/mode-switch: remove dubious frm edge insertion before call_insn
Vineet Gupta [Sun, 8 Jun 2025 21:54:37 +0000 (14:54 -0700)] 
RISC-V: frm/mode-switch: remove dubious frm edge insertion before call_insn

This showed up when debugging the testcase for PR119164.

RISC-V FRM mode-switching state machine has special handling for transitions
to and from a call_insn as FRM needs to saved/restored around calls
despite it not being a callee-saved reg; rather it's a "global" reg
which can be temporarily modified "locally" with a static RM.
Thus a call needs to see the prior global state, hence the restore (from a
prior backup) before the call. Corollarily any call can potentially clobber
the FRM, thus post-call it needs to be it needs to be re-read/saved.

The following example demostrate this:
 - insns 2, 4, 6 correspond to actual user code,
 - rest 1, 3, 5, 6 are frm save/restore insns generated by mode switch for the
   above described ABI semantics.

        test_float_point_frm_static:
        1:  frrm    a5 <--
     2:     fsrmi   2
        3:  fsrm    a5 <--
     4:     call    normalize_vl
        5:  frrm    a5 <--
     6:     fsrmi   3
        7:  fsrm    a5 <--

Current implementation of RISC-V TARGET_MODE_NEEDED has special handling
if the call_insn is last insn of BB, to ensure FRM save/reads are emitted
on all the edges. However it doesn't work as intended and is borderline
bogus for following reasons:

 - It fails to detect call_insn as last of BB (PR119164 test) if the
   next BB starts with a code label (say due to call being conditional).
   Granted this is a deficiency of API next_nonnote_nondebug_insn_bb ()
   which incorrectly returns next BB code_label as opposed to returning
   NULL (and this behavior is kind of relied upon by much of gcc).
   This causes missed/delayed state transition to DYN.

 - If code is tightened to actually detect above such as:

     -  rtx_insn *insn = next_nonnote_nondebug_insn_bb (cur_insn);
     -  if (!insn)
     +  if (BB_END (BLOCK_FOR_INSN (cur_insn)) == cur_insn)

   edge insertion happens but ends up splitting the BB which generic
   mode-sw doesn't expect and ends up hittng an ICE.

 - TARGET_MODE_NEEDED hook typically don't modify the CFG.

 - For abnormal edges, insert_insn_end_basic_block () is called, which
   by design on encountering call_insn as last in BB, inserts new insn
   BEFORE the call, not after.

So this is just all wrong and ripe for removal. Moreover there seems to
be no testsuite coverage for this code path at all. Results don't change
at all if this is removed.

The total number of FRM read/writes emitted (static count) across all
benchmarks of a SPEC2017 -Ofast -march=rv64gcv build decrease slightly
so its a net win even if minimal but the real gain is reduced complexity
and maintenance.

                   Before             Patch
               ----------------  ---------------
                frrm fsrmi fsrm   frrm fsrmi frrm
    perlbench_r   42    0    4      42    0    4
       cpugcc_r  167    0   17     167    0   17
       bwaves_r   16    0    1      16    0    1
          mcf_r   11    0    0      11    0    0
   cactusBSSN_r   79    0   27      76    0   27
         namd_r  119    0   63     119    0   63
       parest_r  218    0  114     168    0  114 <--
       povray_r  123    1   17     123    1   17
          lbm_r    6    0    0       6    0    0
      omnetpp_r   17    0    1      17    0    1
          wrf_r 2287   13 1956    2287   13 1956
     cpuxalan_r   17    0    1      17    0    1
       ldecod_r   11    0    0      11    0    0
         x264_r   14    0    1      14    0    1
      blender_r  724   12  182     724   12  182
         cam4_r  324   13  169     324   13  169
    deepsjeng_r   11    0    0      11    0    0
      imagick_r  265   16   34     265   16   34
        leela_r   12    0    0      12    0    0
          nab_r   13    0    1      13    0    1
    exchange2_r   16    0    1      16    0    1
    fotonik3d_r   20    0   11      20    0   11
         roms_r   33    0   23      33    0   23
           xz_r    6    0    0       6    0    0
              ----------------   ---------------
                4551   55 2623    4498   55 2623

gcc/ChangeLog:
* config/riscv/riscv.cc (riscv_frm_emit_after_bb_end): Delete.
(riscv_frm_mode_needed): Remove call riscv_frm_emit_after_bb_end.

Signed-off-by: Vineet Gupta <vineetg@rivosinc.com>
8 weeks agoRISC-V: frm/mode-switch: remove TARGET_MODE_CONFLUENCE
Vineet Gupta [Sun, 8 Jun 2025 21:44:29 +0000 (14:44 -0700)] 
RISC-V: frm/mode-switch: remove TARGET_MODE_CONFLUENCE

This is effectively reverting e5d1f538bb7d
"(RISC-V: Allow different dynamic floating point mode to be merged)"
while retaining the testcase.

The change itself is valid, however it obfuscates the deficiencies in
current frm mode switching code.

Also for a SPEC2017 -Ofast -march=rv64gcv build, it ends up generating
net more FRM restores (writes) vs. the rest of this changeset.

gcc/ChangeLog:

* config/riscv/riscv.cc (riscv_dynamic_frm_mode_p): Remove.
(riscv_mode_confluence): Ditto.
(TARGET_MODE_CONFLUENCE): Ditto.

Signed-off-by: Vineet Gupta <vineetg@rivosinc.com>
8 weeks agoemit-rtl: document next_nonnote_nondebug_insn_bb () can breach into next BB
Vineet Gupta [Sun, 8 Jun 2025 21:44:23 +0000 (14:44 -0700)] 
emit-rtl: document next_nonnote_nondebug_insn_bb () can breach into next BB

gcc/ChangeLog:

* emit-rtl.cc (next_nonnote_nondebug_insn): Update comments.

Signed-off-by: Vineet Gupta <vineetg@rivosinc.com>
8 weeks agocselim: Move else_vdef definition to the usage
Andrew Pinski [Sun, 8 Jun 2025 20:01:41 +0000 (13:01 -0700)] 
cselim: Move else_vdef definition to the usage

This is based on the review of cond_if_else_store_replacement_limited
(https://gcc.gnu.org/pipermail/gcc-patches/2025-June/686076.html).

Moves else_vdef definition/assignment to be next to the usage in
single_trailing_store_in_bb.

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

gcc/ChangeLog:

* tree-ssa-phiopt.cc (cond_if_else_store_replacement): Move
definitin of else_vdef to right before the usage. Reformat
slightly.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
8 weeks agophi-opt: Do limited form of cselim from phiopt [PR120533]
Andrew Pinski [Fri, 6 Jun 2025 18:34:48 +0000 (11:34 -0700)] 
phi-opt: Do limited form of cselim from phiopt [PR120533]

So currently cselim is limited to targets which have conditional move
and also happens later in the pipeline. This adds the limited form of cselim;
where there is only one store in the two sides and no loads after the store.

This fixes phiprop-2.c for gcn target and now can match the MIN in phiopt1
so it moves the matching of MIN to phiopt1.

The other testcases already disable cselim so they need to disable phiopt too.

Bootstrapped and tested on x86_64-linux-gnu.

PR tree-optimization/120533
gcc/ChangeLog:

* tree-ssa-phiopt.cc (cond_if_else_store_replacement_limited): New function.
(pass_phiopt::execute): Call cond_if_else_store_replacement_limited
for diamand case.

gcc/testsuite/ChangeLog:

* gcc.dg/tree-ssa/pr35286.c: Add -fno-ssa-phiopt.
* gcc.dg/tree-ssa/split-path-6.c: Likewise.
* gcc.dg/tree-ssa/split-path-7.c: Likewise.
* gcc.dg/tree-ssa/phiprop-2.c: Move the check for MIN_EXPR to phiopt1.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
8 weeks agocselim: change how to detect no load/stores after store in single_trailing_store_in_bb
Andrew Pinski [Fri, 6 Jun 2025 18:07:57 +0000 (11:07 -0700)] 
cselim: change how to detect no load/stores after store in single_trailing_store_in_bb

So the current code iterates through the uses of the vdef of the store to see if there
is an use of the vdef inside the bb. Except in this case we know the only usage will
be a phi node, so change the loop into calling single_imm_use and then checking if the
usage statement was the PHI node.

Bootstrapped and tested on x86_64-linux-gnu.

Also did a quick test by adding a return false after the checks of single_trailing_store_in_bb
in cond_if_else_store_replacement to make sure this code still does the correct thing.

gcc/ChangeLog:

* tree-ssa-phiopt.cc (single_trailing_store_in_bb): Add vphi argument.
Check for single use of the vdef of the store instead of a loop
and check vdef's single use statement is the same as vphi.
(cond_if_else_store_replacement): Update call to single_trailing_store_in_bb.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
8 weeks agocselim: Use get_virtual_phi instead of a loop in cond_if_else_store_replacement
Andrew Pinski [Sun, 8 Jun 2025 18:12:46 +0000 (11:12 -0700)] 
cselim: Use get_virtual_phi instead of a loop in cond_if_else_store_replacement

Don't inline finding of the virtual op phi node, instead use get_virtual_phi.
This is based on the review of a different patch (https://gcc.gnu.org/pipermail/gcc-patches/2025-June/686076.html).

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

gcc/ChangeLog:

* tree-ssa-phiopt.cc (cond_if_else_store_replacement): Use get_virtual_phi
instead of inlining it.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
8 weeks agolibstdc++-v3: Update baseline symbols for hppa-linux
John David Anglin [Sun, 8 Jun 2025 15:48:14 +0000 (11:48 -0400)] 
libstdc++-v3: Update baseline symbols for hppa-linux

Duplicate symbol names with no version are removed.

2025-06-08  John David Anglin  <danglin@gcc.gnu.org>

libstdc++-v3/ChangeLog:
* config/abi/post/hppa-linux-gnu/baseline_symbols.txt: Update.

8 weeks ago[RISC-V] Handle 32bit operands in condition for conditional moves
Shreya Munnangi [Sun, 8 Jun 2025 14:42:53 +0000 (08:42 -0600)] 
[RISC-V] Handle 32bit operands in condition for conditional moves

So here's the next chunk of conditional move work from Shreya.

It's been a long standing wart that the conditional move expander does not
support sub-word operands in the comparison.  Particularly since we have
support routines to handle the necessary extensions for that case.

This patch adjusts the expander to use riscv_extend_comparands rather than fail
for that case.  I've built spec2017 before/after this and we definitely get
more conditional moves and they look sensible from a performance standpoint.
None are likely hitting terribly hot code, so I wouldn't expect any performance
jumps.

Waiting on pre-commit testing to do its thing.

gcc/
* config/riscv/riscv.cc (riscv_expand_conditional_move): Use
riscv_extend_comparands to extend sub-word comparison arguments.

Co-authored-by: Jeff Law <jlaw@ventanamicro.com>
8 weeks agoxtensa: Implement l(ceil|floor)sfsi2 insn patterns and their scaled variants
Takayuki 'January June' Suwa [Sun, 8 Jun 2025 05:05:05 +0000 (14:05 +0900)] 
xtensa: Implement l(ceil|floor)sfsi2 insn patterns and their scaled variants

By using the previously unused CEIL|FLOOR.S floating-point coprocessor
instructions.  In addition, two instruction operand format codes are added
to output the scale value as assembler source.

     /* example */
     int test0(float a) {
       return __builtin_lceilf(a);
     }
     int test1(float a) {
       return __builtin_lceilf(a * 2);
     }
     int test2(float a) {
       return __builtin_lfloorf(a);
     }
     int test3(float a) {
       return __builtin_lfloorf(a * 32768);
     }

     ;; result
     test0:
      entry sp, 32
      wfr f0, a2
      ceil.s a2, f0, 0
      retw.n
     test1:
      entry sp, 32
      wfr f0, a2
      ceil.s a2, f0, 1
      retw.n
     test2:
      entry sp, 32
      wfr f0, a2
      floor.s a2, f0, 0
      retw.n
     test3:
      entry sp, 32
      wfr f0, a2
      floor.s a2, f0, 15
      retw.n

However, because the rounding-half behavior (e.g., the rule that determines
whether 1.5 should be rounded to 1 or 2) of the two is inconsistent;
the lroundsfsi2 pattern is explicitly specified that rounding to nearest
integer and away from zero, but the other hand, the ROUND.S instruction is
not specified that by the ISA and is implementation-dependent.

Therefore lroundsfsi2 cannot be implemented by ROUND.S.

gcc/ChangeLog:

* config/xtensa/xtensa.cc (printx, print_operand):
Add two instruction operand format codes 'U' and 'V',
whose represent scale factors of 0 to 15th positive/negative
power of two.
* config/xtensa/xtensa.md (c_enum "unspec"):
Add UNSPEC_CEIL and UNSPEC_FLOOR.
(int_iterator ANY_ROUND, int_attr m_round):
New integer iterator and its attribute.
(fix<s_fix>_truncsfsi2, *fix<s_fix>_truncsfsi2_2x,
*fix<s_fix>_truncsfsi2_scaled, float<s_float>sisf2,
*float<s_float>sisf2_scaled):
Use output templates with the operand formats added above,
instead of individual output statements.
(l<m_round>sfsi2, *l<m_round>sfsi2_2x, *l<m_round>sfsi2_scaled):
New insn patterns.

8 weeks agoDaily bump.
GCC Administrator [Sun, 8 Jun 2025 00:16:33 +0000 (00:16 +0000)] 
Daily bump.

8 weeks agolibfortran: Regenerate files
Francois-Xavier Coudert [Fri, 6 Jun 2025 12:21:49 +0000 (14:21 +0200)] 
libfortran: Regenerate files

In commit 5e918a4db9e4a5bdbeafec6881fa8b22a55d3789, regenerated files
were not included in the commit as they should have been. Therefore, a
whitespace fix was not propagated. Sync generated files now, as obtained
from a run with --enable-maintainer-mode.

2025-06-06  François-Xavier Coudert  <fxcoudert@gcc.gnu.org>

libgfortran/ChangeLog:

PR libfortran/116400
* generated/iall_i1.c: Regenerate.
* generated/iall_i16.c: Regenerate.
* generated/iall_i2.c: Regenerate.
* generated/iall_i4.c: Regenerate.
* generated/iall_i8.c: Regenerate.
* generated/iany_i1.c: Regenerate.
* generated/iany_i16.c: Regenerate.
* generated/iany_i2.c: Regenerate.
* generated/iany_i4.c: Regenerate.
* generated/iany_i8.c: Regenerate.
* generated/iparity_i1.c: Regenerate.
* generated/iparity_i16.c: Regenerate.
* generated/iparity_i2.c: Regenerate.
* generated/iparity_i4.c: Regenerate.
* generated/iparity_i8.c: Regenerate.
* generated/matmulavx128_c10.c: Regenerate.
* generated/matmulavx128_c16.c: Regenerate.
* generated/matmulavx128_c17.c: Regenerate.
* generated/matmulavx128_c4.c: Regenerate.
* generated/matmulavx128_c8.c: Regenerate.
* generated/matmulavx128_i1.c: Regenerate.
* generated/matmulavx128_i16.c: Regenerate.
* generated/matmulavx128_i2.c: Regenerate.
* generated/matmulavx128_i4.c: Regenerate.
* generated/matmulavx128_i8.c: Regenerate.
* generated/matmulavx128_r10.c: Regenerate.
* generated/matmulavx128_r16.c: Regenerate.
* generated/matmulavx128_r17.c: Regenerate.
* generated/matmulavx128_r4.c: Regenerate.
* generated/matmulavx128_r8.c: Regenerate.
* generated/maxloc1_16_i1.c: Regenerate.
* generated/maxloc1_16_i16.c: Regenerate.
* generated/maxloc1_16_i2.c: Regenerate.
* generated/maxloc1_16_i4.c: Regenerate.
* generated/maxloc1_16_i8.c: Regenerate.
* generated/maxloc1_16_r10.c: Regenerate.
* generated/maxloc1_16_r16.c: Regenerate.
* generated/maxloc1_16_r17.c: Regenerate.
* generated/maxloc1_16_r4.c: Regenerate.
* generated/maxloc1_16_r8.c: Regenerate.
* generated/maxloc1_4_i1.c: Regenerate.
* generated/maxloc1_4_i16.c: Regenerate.
* generated/maxloc1_4_i2.c: Regenerate.
* generated/maxloc1_4_i4.c: Regenerate.
* generated/maxloc1_4_i8.c: Regenerate.
* generated/maxloc1_4_r10.c: Regenerate.
* generated/maxloc1_4_r16.c: Regenerate.
* generated/maxloc1_4_r17.c: Regenerate.
* generated/maxloc1_4_r4.c: Regenerate.
* generated/maxloc1_4_r8.c: Regenerate.
* generated/maxloc1_8_i1.c: Regenerate.
* generated/maxloc1_8_i16.c: Regenerate.
* generated/maxloc1_8_i2.c: Regenerate.
* generated/maxloc1_8_i4.c: Regenerate.
* generated/maxloc1_8_i8.c: Regenerate.
* generated/maxloc1_8_r10.c: Regenerate.
* generated/maxloc1_8_r16.c: Regenerate.
* generated/maxloc1_8_r17.c: Regenerate.
* generated/maxloc1_8_r4.c: Regenerate.
* generated/maxloc1_8_r8.c: Regenerate.
* generated/maxval_i1.c: Regenerate.
* generated/maxval_i16.c: Regenerate.
* generated/maxval_i2.c: Regenerate.
* generated/maxval_i4.c: Regenerate.
* generated/maxval_i8.c: Regenerate.
* generated/maxval_r10.c: Regenerate.
* generated/maxval_r16.c: Regenerate.
* generated/maxval_r17.c: Regenerate.
* generated/maxval_r4.c: Regenerate.
* generated/maxval_r8.c: Regenerate.
* generated/minloc1_16_i1.c: Regenerate.
* generated/minloc1_16_i16.c: Regenerate.
* generated/minloc1_16_i2.c: Regenerate.
* generated/minloc1_16_i4.c: Regenerate.
* generated/minloc1_16_i8.c: Regenerate.
* generated/minloc1_16_r10.c: Regenerate.
* generated/minloc1_16_r16.c: Regenerate.
* generated/minloc1_16_r17.c: Regenerate.
* generated/minloc1_16_r4.c: Regenerate.
* generated/minloc1_16_r8.c: Regenerate.
* generated/minloc1_4_i1.c: Regenerate.
* generated/minloc1_4_i16.c: Regenerate.
* generated/minloc1_4_i2.c: Regenerate.
* generated/minloc1_4_i4.c: Regenerate.
* generated/minloc1_4_i8.c: Regenerate.
* generated/minloc1_4_r10.c: Regenerate.
* generated/minloc1_4_r16.c: Regenerate.
* generated/minloc1_4_r17.c: Regenerate.
* generated/minloc1_4_r4.c: Regenerate.
* generated/minloc1_4_r8.c: Regenerate.
* generated/minloc1_8_i1.c: Regenerate.
* generated/minloc1_8_i16.c: Regenerate.
* generated/minloc1_8_i2.c: Regenerate.
* generated/minloc1_8_i4.c: Regenerate.
* generated/minloc1_8_i8.c: Regenerate.
* generated/minloc1_8_r10.c: Regenerate.
* generated/minloc1_8_r16.c: Regenerate.
* generated/minloc1_8_r17.c: Regenerate.
* generated/minloc1_8_r4.c: Regenerate.
* generated/minloc1_8_r8.c: Regenerate.
* generated/minval_i1.c: Regenerate.
* generated/minval_i16.c: Regenerate.
* generated/minval_i2.c: Regenerate.
* generated/minval_i4.c: Regenerate.
* generated/minval_i8.c: Regenerate.
* generated/minval_r10.c: Regenerate.
* generated/minval_r16.c: Regenerate.
* generated/minval_r17.c: Regenerate.
* generated/minval_r4.c: Regenerate.
* generated/minval_r8.c: Regenerate.
* generated/norm2_r10.c: Regenerate.
* generated/norm2_r16.c: Regenerate.
* generated/norm2_r17.c: Regenerate.
* generated/norm2_r4.c: Regenerate.
* generated/norm2_r8.c: Regenerate.
* generated/parity_l1.c: Regenerate.
* generated/parity_l16.c: Regenerate.
* generated/parity_l2.c: Regenerate.
* generated/parity_l4.c: Regenerate.
* generated/parity_l8.c: Regenerate.

8 weeks ago[PR modula2/119650, PR modula2/117203]: WriteString and Delete are missing from base...
Gaius Mulley [Sat, 7 Jun 2025 15:25:19 +0000 (16:25 +0100)] 
[PR modula2/119650, PR modula2/117203]: WriteString and Delete are missing from base libraries

This patch introduces a Write procedure for an array of char,
the string and char datatype.  It uses the m2r10 style of
naming the module on the datatype.  This uncovered a bug
in the import handling inside Quadident.  It also includes
an Unlink procedure from a new module FileSysOp and a String
interface to this module.

gcc/m2/ChangeLog:

PR modula2/119650
PR modula2/117203
* gm2-compiler/P2Build.bnf (CheckModuleQualident): New
procedure.
(Qualident): Rewrite.
* gm2-compiler/P3Build.bnf (PushTFQualident): New procedure.
(CheckModuleQualident): Ditto.
(Qualident): Rewrite.
* gm2-compiler/PCBuild.bnf (PushTFQualident): New procedure.
(CheckModuleQualident): Ditto.
(Qualident): Rewrite.
* gm2-compiler/PHBuild.bnf (PushTFQualident): New procedure.
(CheckModuleQualident): Ditto.
(Qualident): Rewrite.
* gm2-libs/ARRAYOFCHAR.def: New file.
* gm2-libs/ARRAYOFCHAR.mod: New file.
* gm2-libs/CFileSysOp.def: New file.
* gm2-libs/CHAR.def: New file.
* gm2-libs/CHAR.mod: New file.
* gm2-libs/FileSysOp.def: New file.
* gm2-libs/FileSysOp.mod: New file.
* gm2-libs/String.def: New file.
* gm2-libs/String.mod: New file.
* gm2-libs/StringFileSysOp.def: New file.
* gm2-libs/StringFileSysOp.mod: New file.

libgm2/ChangeLog:

PR modula2/119650
PR modula2/117203
* libm2pim/Makefile.am (M2MODS): Add ARRAYOFCHAR,
CHAR.mod, StringFileSysOp.mod and String.mod.
(M2DEFS): Add ARRAYOFCHAR, CHAR.mod,
StringFileSysOp.mod and String.mod.
(libm2pim_la_SOURCES): Add CFileSysOp.c.
* libm2pim/Makefile.in: Regenerate.
* libm2pim/CFileSysOp.cc: New file.

gcc/testsuite/ChangeLog:

PR modula2/119650
* gm2/iso/fail/CHAR.mod: New test.
* gm2/iso/run/pass/CHAR.mod: New test.
* gm2/iso/run/pass/importself.mod: New test.
* gm2/pimlib/run/pass/testwrite.mod: New test.
* gm2/pimlib/run/pass/testwritechar.mod: New test.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>