]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
7 months agoor1k: add .note.GNU-stack section on linux
Stafford Horne [Mon, 6 Jan 2025 12:12:40 +0000 (12:12 +0000)] 
or1k: add .note.GNU-stack section on linux

In the OpenRISC build we get the following warning:

    ld: warning: __modsi3_s.o: missing .note.GNU-stack section implies executable stack
    ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker

Fix this by adding a .note.GNU-stack to indicate the stack does not need to be
executable for the lib1funcs.

Note, this is also needed for the upcoming glibc 2.41.

libgcc/
* config/or1k/lib1funcs.S: Add .note.GNU-stack section on linux.

7 months agoada: Fix small thinko in previous change to two-pass aggregate expansion
Eric Botcazou [Fri, 13 Dec 2024 19:50:44 +0000 (20:50 +0100)] 
ada: Fix small thinko in previous change to two-pass aggregate expansion

We need a type tailored to the base index type to compute the length.

gcc/ada/ChangeLog:

* exp_aggr.adb (Two_Pass_Aggregate_Expansion): Use the base type of
the index type to find the type used to compute the length.

7 months agoDaily bump.
GCC Administrator [Mon, 6 Jan 2025 00:23:05 +0000 (00:23 +0000)] 
Daily bump.

7 months agoAda: Fix build for dummy s-taprop
Estevan Castilho (Tevo) [Sat, 28 Dec 2024 20:37:37 +0000 (20:37 +0000)] 
Ada: Fix build for dummy s-taprop

gcc/ada
* libgnarl/s-taprop__dummy.adb: Remove use clause for
System.Parameters.
(Unlock): Remove Global_Lock formal parameter.
(Write_Lock): Likewise.

7 months agoDaily bump.
GCC Administrator [Sun, 5 Jan 2025 00:22:17 +0000 (00:22 +0000)] 
Daily bump.

7 months agoDaily bump.
GCC Administrator [Sat, 4 Jan 2025 00:24:17 +0000 (00:24 +0000)] 
Daily bump.

7 months agoc++/modules: Fallback to ftruncate if posix_fallocate fails [PR115008]
Nathaniel Shead [Sat, 21 Dec 2024 12:42:28 +0000 (23:42 +1100)] 
c++/modules: Fallback to ftruncate if posix_fallocate fails [PR115008]

Depending on the libc and filesystem, in cases where posix_fallocate
cannot do an efficient preallocation it may return EINVAL.  In such a
case we should fall back to ftruncate instead.

Apparently, depending on the system the use of posix_fallocate can have
a noticeable speedup over ftruncate in general (depending on the system)
so it probably isn't worth it to use ftruncate in all cases.

PR c++/100358
PR c++/115008

gcc/cp/ChangeLog:

* module.cc (elf_out::create_mapping): Fallback to ftruncate if
posix_fallocate fails.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
(cherry picked from commit 84aa7065deec49bab9fb0b085cd0a0dcc42cc479)

7 months agoDaily bump.
GCC Administrator [Fri, 3 Jan 2025 00:24:22 +0000 (00:24 +0000)] 
Daily bump.

7 months agoDaily bump.
GCC Administrator [Thu, 2 Jan 2025 00:27:35 +0000 (00:27 +0000)] 
Daily bump.

7 months agoDaily bump.
GCC Administrator [Wed, 1 Jan 2025 00:26:20 +0000 (00:26 +0000)] 
Daily bump.

7 months agoDaily bump.
GCC Administrator [Tue, 31 Dec 2024 00:25:22 +0000 (00:25 +0000)] 
Daily bump.

7 months agoDaily bump.
GCC Administrator [Mon, 30 Dec 2024 00:24:02 +0000 (00:24 +0000)] 
Daily bump.

7 months agoDaily bump.
GCC Administrator [Sun, 29 Dec 2024 00:24:55 +0000 (00:24 +0000)] 
Daily bump.

7 months agoDaily bump.
GCC Administrator [Sat, 28 Dec 2024 00:24:07 +0000 (00:24 +0000)] 
Daily bump.

7 months agoDaily bump.
GCC Administrator [Fri, 27 Dec 2024 00:23:02 +0000 (00:23 +0000)] 
Daily bump.

7 months agoDaily bump.
GCC Administrator [Thu, 26 Dec 2024 00:25:05 +0000 (00:25 +0000)] 
Daily bump.

7 months agoDaily bump.
GCC Administrator [Wed, 25 Dec 2024 00:24:43 +0000 (00:24 +0000)] 
Daily bump.

7 months agoDaily bump.
GCC Administrator [Tue, 24 Dec 2024 00:25:25 +0000 (00:25 +0000)] 
Daily bump.

7 months agoc++: integer overflow during constraint subsumption [PR118069]
Patrick Palka [Thu, 19 Dec 2024 17:00:29 +0000 (12:00 -0500)] 
c++: integer overflow during constraint subsumption [PR118069]

For the testcase in the PR we hang during constraint subsumption
ultimately because one of the constraints is complex enough that its
conjunctive normal form is calculated to have more than 2^31 clauses,
which causes the size calculation (through an int) to overflow and so
the optimization in subsumes_constraints_nonnull

  if (dnf_size (lhs) <= cnf_size (rhs))
    // iterate over DNF of LHS
  else
    // iterate over CNF of RHS

incorrectly decides to loop over the CNF (>> billions of clauses)
instead of the DNF (thousands of clauses).

I haven't verified that the result of cnf_size is correct for the
problematic constraint but integer overflow is definitely plausible
given that CNF/DNF can be exponentially larger than the original
constraint in the worst case.

This patch fixes this by using 64-bit saturating arithmetic during
these size calculations (via new add/mul_sat_hwi functions) so that
overflow is less likely and if it does occur we handle it gracefully.
It should be highly unlikely that both the DNF and CNF sizes overflow,
and if they do then it doesn't matter which form we select, subsumption
will take forever either way.  The testcase now compiles in ~3 seconds
on my machine after this change.

PR c++/118069

gcc/ChangeLog:

* hwint.h (add_sat_hwi): New function.
(mul_sat_hwi): Likewise.

gcc/cp/ChangeLog:

* logic.cc (dnf_size_r): Use HOST_WIDE_INT instead of int, and
handle overflow gracefully via add_sat_hwi and mul_sat_hwi.
(cnf_size_r): Likewise.
(dnf_size): Use HOST_WIDE_INT instead of int.
(cnf_size): Likewise.

Reviewed-by: Jason Merrill <jason@redhat.com>
(cherry picked from commit 875f14e15d49dce7de501a6357a3d5811b5c36d4)

7 months agoRevert "arm: [MVE intrinsics] Fix support for predicate constants [PR target/114801]"
Christophe Lyon [Mon, 23 Dec 2024 08:11:34 +0000 (08:11 +0000)] 
Revert "arm: [MVE intrinsics] Fix support for predicate constants [PR target/114801]"

This reverts commit 0631c5770e8162dbe67c73dee0327313c19822c2.

7 months agoDaily bump.
GCC Administrator [Mon, 23 Dec 2024 00:23:56 +0000 (00:23 +0000)] 
Daily bump.

7 months agotestsuite: arm: Check for short circuit instructions [PR103298]
Torbjörn SVENSSON [Sun, 10 Nov 2024 09:46:39 +0000 (10:46 +0100)] 
testsuite: arm: Check for short circuit instructions [PR103298]

Instead of checking that a certain transformation is not used by
counting the number of return instructions and the number of BEQ
instructions, check that none of CMP, MOV, ORR and AND instructions are
suffixed with EQ or NE.
Also removed size check as it's very unstable (depends on optimization
in use).

gcc/testsuite/ChangeLog:

PR testsuite/103298
* gcc.target/arm/pr43920-2.c: Change to assembler pattern
"(cmp|mov|orr|and)(eq|ne)" for the check. Remove size check.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
(cherry picked from commit 9e1063ca1c854b13950597fd4a14aff4f15ed822)

7 months agoFortran: Fix testsuite regressions after r15-5083 [PR117797]
Paul Thomas [Thu, 12 Dec 2024 17:50:56 +0000 (17:50 +0000)] 
Fortran: Fix testsuite regressions after r15-5083 [PR117797]

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

gcc/fortran
PR fortran/117797
* trans-array.cc (class_array_element_size): New function.
(gfc_get_array_span): Refactor, using class_array_element_size
to return the span for descriptors that are the _data component
of a class expression and then class dummy references. Revert
the conditions to those before r15-5083 tidying up using 'sym'.

gcc/testsuite/
PR fortran/117797
* gfortran.dg/pr117797.f90: New test.

(cherry picked from commit d4330ff9bc9a2995e79d88b09a2ee76673167661)

7 months agoDaily bump.
GCC Administrator [Sun, 22 Dec 2024 00:25:11 +0000 (00:25 +0000)] 
Daily bump.

7 months agoDaily bump.
GCC Administrator [Sat, 21 Dec 2024 00:24:11 +0000 (00:24 +0000)] 
Daily bump.

7 months agoDaily bump.
GCC Administrator [Fri, 20 Dec 2024 00:25:04 +0000 (00:25 +0000)] 
Daily bump.

7 months agoarm: [MVE intrinsics] Fix support for predicate constants [PR target/114801]
Christophe Lyon [Sun, 24 Nov 2024 18:08:48 +0000 (18:08 +0000)] 
arm: [MVE intrinsics] Fix support for predicate constants [PR target/114801]

In this PR, we have to handle a case where MVE predicates are supplied
as a const_int, where individual predicates have illegal boolean
values (such as 0xc for a 4-bit boolean predicate).  To avoid the ICE,
fix the constant (any non-zero value is converted to all 1s) and emit
a warning.

On MVE, V8BI and V4BI multi-bit masks are interpreted byte-by-byte at
instruction level, but end-users should describe lanes rather than
bytes (so all bytes of a true-predicated lane should be '1'), see the
section on MVE intrinsics in the Arm ACLE specification.

Since force_lowpart_subreg cannot handle const_int (because they have VOID mode),
use gen_lowpart on them, force_lowpart_subreg otherwise.

2024-11-20  Christophe Lyon  <christophe.lyon@linaro.org>
    Jakub Jelinek  <jakub@redhat.com>

PR target/114801
gcc/
* config/arm/arm-mve-builtins.cc
(function_expander::add_input_operand): Handle CONST_INT
predicates.

gcc/testsuite/
* gcc.target/arm/mve/pr108443.c: Update predicate constant.
* gcc.target/arm/mve/pr108443-run.c: Likewise.
* gcc.target/arm/mve/pr114801.c: New test.

(cherry picked from commit 2089009210a1774c37e527ead8bbcaaa1a7a9d2d)

7 months agoFix comment typos in tree-assume.cc
Andrew Carlotti [Wed, 18 Dec 2024 16:16:51 +0000 (16:16 +0000)] 
Fix comment typos in tree-assume.cc

gcc/ChangeLog:

* tree-assume.cc: Fix comment typos.

7 months agotestsuite: arm: Use effective-target for memset-inline* tests
Torbjörn SVENSSON [Thu, 24 Oct 2024 08:40:27 +0000 (10:40 +0200)] 
testsuite: arm: Use effective-target for memset-inline* tests

Split tests into 2 parts:
- The first part checkes the assmbler generated.
- The second part does the run test and this part now requires
  effective-target arm_neon_hw.

gcc/testsuite/ChangeLog:

* gcc.target/arm/memset-inline-4.c: Only check assembler output.
* gcc.target/arm/memset-inline-5.c: Likewise.
* gcc.target/arm/memset-inline-6.c: Likewise.
* gcc.target/arm/memset-inline-8.c: Likewise.
* gcc.target/arm/memset-inline-9.c: Likewise.
* gcc.target/arm/memset-inline-4-exe.c: New test.
* gcc.target/arm/memset-inline-5-exe.c: Likewise.
* gcc.target/arm/memset-inline-6-exe.c: Likewise.
* gcc.target/arm/memset-inline-8-exe.c: Likewise.
* gcc.target/arm/memset-inline-9-exe.c: Likewise.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
(cherry picked from commit 8462a5fdbfe12194b44072b5e64809b02dd2432d)

7 months agoDaily bump.
GCC Administrator [Thu, 19 Dec 2024 00:25:25 +0000 (00:25 +0000)] 
Daily bump.

7 months agoarm: Fix LDRD register overlap [PR117675]
Wilco Dijkstra [Tue, 10 Dec 2024 14:22:48 +0000 (14:22 +0000)] 
arm: Fix LDRD register overlap [PR117675]

The register indexed variants of LDRD have complex register overlap constraints
which makes them hard to use without using output_move_double (which can't be
used for atomics as it doesn't guarantee to emit atomic LDRD/STRD when required).
Add a new predicate and constraint for plain LDRD/STRD with base or base+imm.
This blocks register indexing and fixes PR117675.

gcc:
PR target/117675
* config/arm/arm.cc (arm_ldrd_legitimate_address): New function.
* config/arm/arm-protos.h (arm_ldrd_legitimate_address): New prototype.
* config/arm/constraints.md: Add new Uo constraint.
* config/arm/predicates.md (arm_ldrd_memory_operand): Add new predicate.
* config/arm/sync.md (arm_atomic_loaddi2_ldrd): Use
arm_ldrd_memory_operand and Uo.

gcc/testsuite:
PR target/117675
* gcc.target/arm/pr117675.c: Add new test.

(cherry picked from commit 21fbfae2e55e1a153820acc6fbd922e66f67e65b)

7 months agoDaily bump.
GCC Administrator [Wed, 18 Dec 2024 00:25:44 +0000 (00:25 +0000)] 
Daily bump.

7 months agotestsuite: arm: Mark pr81812.C as xfail for thumb1
Torbjörn SVENSSON [Sun, 10 Nov 2024 19:15:13 +0000 (20:15 +0100)] 
testsuite: arm: Mark pr81812.C as xfail for thumb1

Test fails for Cortex-M0 with:

.../pr81812.C:6:8: error: generic thunk code fails for method 'virtual void ChildNode::_ZTv0_n12_NK9ChildNode5errorEz(...) const' which uses '...'

According to PR108277, it's expected that thumb1 targets does not
support empty virtual functions with ellipsis.

gcc/testsuite/ChangeLog:

* g++.dg/torture/pr81812.C: Add xfail for thumb1.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
(cherry picked from commit f111d8e20b671ee97d4ed835102839e44a2a2edc)

7 months agoFortran: Pointer fcn results must not be finalized [PR117897]
Paul Thomas [Sun, 15 Dec 2024 10:42:34 +0000 (10:42 +0000)] 
Fortran: Pointer fcn results must not be finalized [PR117897]

2024-12-15  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
PR fortran/117897
* trans-expr.cc (gfc_trans_assignment_1): RHS pointer function
results must not be finalized.

gcc/testsuite/
PR fortran/117897
* gfortran.dg/finalize_59.f90: New test.

(cherry picked from commit a87bf1d20a37bb69c9fa6d2211ffd963aa69240d)

7 months agoDaily bump.
GCC Administrator [Tue, 17 Dec 2024 00:25:13 +0000 (00:25 +0000)] 
Daily bump.

7 months agoUpdate cpplib sr.po
Joseph Myers [Mon, 16 Dec 2024 23:53:42 +0000 (23:53 +0000)] 
Update cpplib sr.po

* sr.po: Update.

7 months agolibstdc++: Fix typo in Doxygen comment in <format>
Jonathan Wakely [Sat, 7 Dec 2024 01:34:33 +0000 (01:34 +0000)] 
libstdc++: Fix typo in Doxygen comment in <format>

libstdc++-v3/ChangeLog:

* include/std/format: Fix typo in Doxygen comment.

(cherry picked from commit b7dd0d976022c5ba20d9d676e2f684614231eb72)

7 months agodoc: Fix typos for --enable-host-pie docs in install.texi
Heiko Eißfeldt [Sat, 14 Dec 2024 12:31:58 +0000 (12:31 +0000)] 
doc: Fix typos for --enable-host-pie docs in install.texi

gcc/ChangeLog:

* doc/install.texi (Configuration): Fix typos in documentation
for --enable-host-pie.

(cherry picked from commit a7df4961d171ef071bd0972335d6f116d420eb13)

7 months agoada: Fix internal error with Atomic Volatile_Full_Access object
Eric Botcazou [Thu, 22 Aug 2024 19:18:15 +0000 (21:18 +0200)] 
ada: Fix internal error with Atomic Volatile_Full_Access object

The initial implementation of the GNAT aspect/pragma Volatile_Full_Access
made it incompatible with Atomic, because it was not decided whether the
read-modify-write sequences generated by Volatile_Full_Access would need
to be implemented atomically when Atomic was also specified, which would
have required a compare-and-swap primitive from the target architecture.

But Ada 2022 introduced Full_Access_Only and retrofitted it into Atomic
in the process, answering the above question by the negative, so the
incompatibility between Volatile_Full_Access and Atomic was lifted in
Ada 2012 as well, unfortunately without adjusting the implementation.

gcc/ada/

* gcc-interface/trans.cc (get_atomic_access): Deal specifically with
nodes that are both Atomic and Volatile_Full_Access in Ada 2012.

7 months agoDaily bump.
GCC Administrator [Mon, 16 Dec 2024 00:23:19 +0000 (00:23 +0000)] 
Daily bump.

7 months agoFortran: Fix non_overridable typebound proc problems [PR84674/117730].
Paul Thomas [Sun, 15 Dec 2024 14:48:59 +0000 (14:48 +0000)] 
Fortran: Fix non_overridable typebound proc problems [PR84674/117730].

2024-12-15  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran/ChangeLog

PR fortran/117730
PR fortran/84674
* class.cc (add_proc_comp): If the present typebound procedure
component is abstract, unconditionally check the replacement.
Only reject a non_overridable if it has no overridden procedure
and the component is already present in the vtype.

gcc/testsuite/ChangeLog

PR fortran/117730
* gfortran.dg/pr117730_a.f90: New test.
* gfortran.dg/pr117730_b.f90: New test.

PR fortran/84674
* gfortran.dg/pr84674.f90: New test.

7 months agoDaily bump.
GCC Administrator [Sun, 15 Dec 2024 00:23:20 +0000 (00:23 +0000)] 
Daily bump.

7 months ago[PATCH] PR modula2/117120: case ch with a nul char constant causes ICE
Gaius Mulley [Sat, 14 Dec 2024 11:46:57 +0000 (11:46 +0000)] 
[PATCH] PR modula2/117120: case ch with a nul char constant causes ICE

This patch fixes the ICE caused when a case clause contains
a character constant ''.  The fix was to walk the caselist and
convert any 0 length string into a char constant of value 0.

gcc/m2/ChangeLog:

PR modula2/117120
* gm2-compiler/M2CaseList.mod (CaseBoundsResolved): Rewrite.
(ConvertNulStr2NulChar): New procedure function.
(NulStr2NulChar): Ditto.
(GetCaseExpression): Ditto.
(OverlappingCaseBound): Rewrite.
* gm2-compiler/M2GCCDeclare.mod (CheckResolveSubrange): Allow
'' to be used as the subrange low limit.
* gm2-compiler/M2GenGCC.mod (FoldConvert): Rewrite.
(PopKindTree): Ditto.
(BuildHighFromString): Reformat.
* gm2-compiler/SymbolTable.mod (PushConstString): Add test for
length 0 and PushChar (nul).

gcc/testsuite/ChangeLog:

PR modula2/117120
* gm2/pim/pass/forloopnulchar.mod: New test.
* gm2/pim/pass/nulcharcase.mod: New test.
* gm2/pim/pass/nulcharvar.mod: New test.

(cherry picked from commit e0ab8816ea53e2a343f7e945f4718172bff5ce95)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
7 months agoDaily bump.
GCC Administrator [Sat, 14 Dec 2024 00:25:58 +0000 (00:25 +0000)] 
Daily bump.

7 months agodriver: fix crash with --diagnostics-plain-output [PR117942]
Marek Polacek [Mon, 9 Dec 2024 13:19:35 +0000 (08:19 -0500)] 
driver: fix crash with --diagnostics-plain-output [PR117942]

We are crashing here because decode_cmdline_options_to_array has:

  if (!strcmp (opt, "-fdiagnostics-plain-output"))
    ...

but that doesn't handle the '--FLAG' variant.

PR driver/117942

gcc/ChangeLog:

* opts-common.cc (decode_cmdline_options_to_array): Also detect
--diagnostics-plain-output.

Reviewed-by: Joseph Myers <josmyers@redhat.com>
(cherry picked from commit be2062be9a629ae18a0c87c6b9cbe1885978417e)

7 months agoc++: ICE with -Wduplicated-branches in template [PR117880]
Marek Polacek [Mon, 9 Dec 2024 20:36:25 +0000 (15:36 -0500)] 
c++: ICE with -Wduplicated-branches in template [PR117880]

In a template, for things like void() we'll create a CAST_EXPR with
a null operand.  That causes a crash with -Wduplicated-branches on:

  false ? void() : void();

because we do

  if (warn_duplicated_branches
      && (complain & tf_warning)
      && (arg2 == arg3 || operand_equal_p (arg2, arg3,
                                           OEP_ADDRESS_OF_SAME_FIELD)))

even in a template.  So one way to fix the ICE would be to check
!processing_template_decl.  But we can also do the following and
continue warning even in templates.

This ICE appeared with the removal of NON_DEPENDENT_EXPR; before,
operand_equal_p would bail on this code so there was no problem.

PR c++/117880

gcc/ChangeLog:

* fold-const.cc (operand_compare::operand_equal_p) <case tcc_unary>:
Use OP_SAME_WITH_NULL instead of OP_SAME.

gcc/testsuite/ChangeLog:

* g++.dg/warn/Wduplicated-branches8.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
(cherry picked from commit d26c166001d6a5bdfd94be6e6d17135669ed340b)

7 months ago[PATCH] PR modula2/115328: use enable forward bool and set default true
Gaius Mulley [Fri, 13 Dec 2024 14:10:19 +0000 (14:10 +0000)] 
[PATCH] PR modula2/115328: use enable forward bool and set default true

This patch introduces GetEnableForward and SetEnableForward
against which the forward procedure declaration feature is checked.
Currently this is set as default true.

gcc/m2/ChangeLog:

PR modula2/115328
* gm2-compiler/M2Options.def (GetEnableForward): New procedure
function.
(SetEnableForward): New procedure.
* gm2-compiler/M2Options.mod (GetEnableForward): New procedure
function.
(SetEnableForward): New procedure.
(EnableForward): New boolean.
* gm2-compiler/P1SymBuild.mod (EndBuildForward): Check
GetEnableForward and generate an error message if false.

gcc/testsuite/ChangeLog:

PR modula2/115328
* gm2/pim/fail/forward.mod: Move to...
* gm2/pim/pass/forward.mod: ...here.

(cherry picked from commit 548afd73cdbf310403a1e3f34226372c16c29706)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
7 months agoDaily bump.
GCC Administrator [Fri, 13 Dec 2024 00:24:16 +0000 (00:24 +0000)] 
Daily bump.

7 months agoFix precondition failure with Ada.Numerics.Generic_Real_Arrays.Eigenvalues
Eric Botcazou [Thu, 12 Dec 2024 15:25:09 +0000 (16:25 +0100)] 
Fix precondition failure with Ada.Numerics.Generic_Real_Arrays.Eigenvalues

This fixes a precondition failure triggered when the Eigenvalues routine
of Ada.Numerics.Generic_Real_Arrays is instantiated with -gnata, beause
it calls Sort_Eigensystem on an empty vector.

gcc/ada
PR ada/117996
* libgnat/a-ngrear.adb (Jacobi): Remove default value for
Compute_Vectors formal parameter.
(Sort_Eigensystem): Add Compute_Vectors formal parameter.  Do not
modify the Vectors if Compute_Vectors is False.
(Eigensystem): Pass True as Compute_Vectors to Sort_Eigensystem.
(Eigenvalues): Pass False as Compute_Vectors to Sort_Eigensystem.

gcc/testsuite
* gnat.dg/matrix1.adb: New test.

7 months agotestsuite: arm: Use -mtune=cortex-m4 for thumb-ifcvt.c test
Torbjörn SVENSSON [Thu, 21 Nov 2024 18:56:19 +0000 (19:56 +0100)] 
testsuite: arm: Use -mtune=cortex-m4 for thumb-ifcvt.c test

On Cortex-M4, the code generated is:
     cmp     r0, r1
     itte    ne
     lslne   r0, r0, r1
     asrne   r0, r0, #1
     moveq   r0, r1
     add     r0, r0, r1
     bx      lr

On Cortex-M7, the code generated is:
     cmp     r0, r1
     beq     .L3
     lsls    r0, r0, r1
     asrs    r0, r0, #1
     add     r0, r0, r1
     bx      lr
.L3:
     mov     r0, r1
     add     r0, r0, r1
     bx      lr

As Cortex-M7 only allow maximum one conditional instruction, force
Cortex-M4 to have a stable test case.

gcc/testsuite/ChangeLog:

* gcc.target/arm/thumb-ifcvt.c: Use -mtune=cortex-m4.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
(cherry picked from commit e7615f6c99f93056b344ad07ee909114ee54f471)

7 months agotestsuite: arm: Fix build error for thumb2-slow-flash-data-3.c test
Torbjörn SVENSSON [Thu, 21 Nov 2024 15:08:30 +0000 (16:08 +0100)] 
testsuite: arm: Fix build error for thumb2-slow-flash-data-3.c test

gcc/testsuite/ChangeLog:

* gcc.target/arm/thumb2-slow-flash-data-3.c: Added argument to
fn1 to avoid compile error.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
(cherry picked from commit 09499ffbb3028f2db2dd97c2b764f0efe92bf3ef)

7 months agoDaily bump.
GCC Administrator [Thu, 12 Dec 2024 00:23:25 +0000 (00:23 +0000)] 
Daily bump.

7 months agoFortran: Fix READ with padding in BLANK ZERO mode.
Jerry DeLisle [Tue, 10 Dec 2024 04:11:23 +0000 (20:11 -0800)] 
Fortran: Fix READ with padding in BLANK ZERO mode.

PR fortran/117819

libgfortran/ChangeLog:

* io/read.c (read_decimal): If the read value is short of the
specified width and pad mode is PAD yes, check for BLANK ZERO
and adjust the value accordingly.
(read_radix): Likewise.

gcc/testsuite/ChangeLog:

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

(cherry picked from commit cf406a6c79ce404c45f99bcf2df3293269dbb462)

7 months agoDaily bump.
GCC Administrator [Wed, 11 Dec 2024 00:23:27 +0000 (00:23 +0000)] 
Daily bump.

7 months agoDaily bump.
GCC Administrator [Tue, 10 Dec 2024 00:25:55 +0000 (00:25 +0000)] 
Daily bump.

7 months agos390: Fix UNSPEC_CC_TO_INT canonicalization
Juergen Christ [Mon, 9 Dec 2024 14:26:54 +0000 (15:26 +0100)] 
s390: Fix UNSPEC_CC_TO_INT canonicalization

Canonicalization of comparisons for UNSPEC_CC_TO_INT missed one case
causing unnecessarily complex code.  This especially seems to hit the
Linux kernel.

gcc/ChangeLog:

* config/s390/s390.cc (s390_canonicalize_comparison): Add
missing UNSPEC_CC_TO_INT case.

gcc/testsuite/ChangeLog:

* gcc.target/s390/ccusage.c: New test.

Signed-off-by: Juergen Christ <jchrist@linux.ibm.com>
(cherry picked from commit bdc572f9a42b6a68dec1a5593d5311f45bd29cc9)

7 months agotree-eh: Don't crash on GIMPLE_TRY_FINALLY with empty cleanup sequence [PR117845]
Simon Martin [Mon, 9 Dec 2024 08:21:25 +0000 (09:21 +0100)] 
tree-eh: Don't crash on GIMPLE_TRY_FINALLY with empty cleanup sequence [PR117845]

The following valid code triggers an ICE with -fsanitize=address

=== cut here ===
void l() {
    auto const ints = {0,1,2,3,4,5};
    for (auto i : { 3 } ) {
        __builtin_printf("%d ", i);
    }
}
=== cut here ===

The problem is that honor_protect_cleanup_actions does not expect the
cleanup sequence of a GIMPLE_TRY_FINALLY to be empty. It is however the
case here since r14-8681-gceb242f5302027, because lower_stmt removes the
only statement in the sequence: a ASAN_MARK statement for the array that
backs the initializer_list).

This patch simply checks that the finally block is not 0 before
accessing it in honor_protect_cleanup_actions.

PR c++/117845

gcc/ChangeLog:

* tree-eh.cc (honor_protect_cleanup_actions): Support empty
finally sequences.

gcc/testsuite/ChangeLog:

* g++.dg/asan/pr117845-2.C: New test.
* g++.dg/asan/pr117845.C: New test.

(cherry picked from commit 3076539544d3e36684cc8eed3374aeff5b44c9b1)

7 months agoDaily bump.
GCC Administrator [Mon, 9 Dec 2024 00:23:27 +0000 (00:23 +0000)] 
Daily bump.

7 months agoi386: Fix unwanted fwprop to 3dNOW! insn [PR117926]
Uros Bizjak [Fri, 6 Dec 2024 15:59:16 +0000 (16:59 +0100)] 
i386: Fix unwanted fwprop to 3dNOW! insn [PR117926]

The compiler is able to forward propagate a partial vector V4SF instruction
using XMM registers to a 3dNOW! V2SF instruction using MM registers.  Prevent
unwanted transformation by tagging 3dNOW! V2SF instructions using generic
RTXes with "(unspec [(const_int 0)] UNSPEC_3DNOW)" tag.

PR target/117926

gcc/ChangeLog:

* config/i386/mmx.md (UNSPEC_3DNOW): New unspec.
(mmx_addv2sf3): Tag insn with UNSPEC_3DNOW tag.
(*mmx_addv2sf3): Ditto.
(mmx_sub2vsf3): Ditto.
(mmx_subrv2sf3): Ditto.
(*mmx_subv2sf3): Ditto.
(mmx_mulv2sf3): Ditto.
(mmx_<smaxmin:code>v2sf3): Ditto.
(*mmx_<smaxmin:code>v2sf3): Ditto.
(mmx_ieee_<ieee_maxmin>v2sf3): Ditto.
(mmx_eqv2sf3): Ditto.
(*mmx_eqv2sf3): Ditto.
(mmx_gtv2sf3): Ditto.
(mmx_gev2sf3): Ditto.
(mmx_fix_truncv2sfv2si2): Ditto.
(mmx_floatv2siv2sf2): Ditto.

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr117926.c: New test.

(cherry picked from commit 1acc5cffbb04949a790d6e1a34a46ec71418a57b)

8 months agoDaily bump.
GCC Administrator [Sun, 8 Dec 2024 00:23:12 +0000 (00:23 +0000)] 
Daily bump.

8 months ago[PATCH] PR modula2/117948: Forward procedure declaration should only be available...
Gaius Mulley [Sat, 7 Dec 2024 15:56:21 +0000 (15:56 +0000)] 
[PATCH] PR modula2/117948: Forward procedure declaration should only be available in ISO

This patch restricts the forward procedure declaration to the ISO dialect.

gcc/m2/ChangeLog:

PR modula2/117948
* gm2-compiler/P1Build.bnf (ForwardDeclaration): Pass token
position of the FORWARD keyword to EndBuildForward.
* gm2-compiler/P1SymBuild.def (EndBuildForward): New parameter
forwardPos.
* gm2-compiler/P1SymBuild.mod (EndBuildForward): Issue an error at
forwardPos if the Iso boolean is false.

gcc/testsuite/ChangeLog:

PR modula2/117948
* gm2/pim/fail/forward.mod: New test.

(cherry picked from commit 41800372146f5ad15a8796b37f54965f78cc14fb)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
8 months agoDaily bump.
GCC Administrator [Sat, 7 Dec 2024 00:23:41 +0000 (00:23 +0000)] 
Daily bump.

8 months agoFortran: Fix B64.0 formatted write output.
Jerry DeLisle [Wed, 4 Dec 2024 04:55:41 +0000 (20:55 -0800)] 
Fortran: Fix B64.0 formatted write output.

PR fortran/117820

libgfortran/ChangeLog:

* io/write.c (write_b): Add test for zero needed by write_boz.

gcc/testsuite/ChangeLog:

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

(cherry picked from commit 7a92ba766815c9a6b73593967a26fdfbebfc7e69)

8 months agoFortran: Eliminate error prone translations.
Jerry DeLisle [Tue, 6 Aug 2024 23:10:23 +0000 (16:10 -0700)] 
Fortran: Eliminate error prone translations.

PR fortran/109105

gcc/fortran/ChangeLog:

* resolve.cc (CHECK_INTERFACES): New helper macro.
(resolve_operator): Replace use of snprintf with
gfc_error.

(cherry picked from commit 000045fdf838a21e151c2c676c4fcd056032e59f)

8 months ago[PATCH] PR modula2/117904: cc1gm2 ICE when compiling a const built from VAL and SIZE
Gaius Mulley [Fri, 6 Dec 2024 13:06:58 +0000 (13:06 +0000)] 
[PATCH] PR modula2/117904: cc1gm2 ICE when compiling a const built from VAL and SIZE

This patch fixes an ICE which occurs when a positive ZType constant
increment is used during a FOR loop.

gcc/m2/ChangeLog:

PR modula2/117904
* gm2-compiler/M2GenGCC.mod (PerformLastForIterator): Add call to
BuildConvert when increment is > 0.

gcc/testsuite/ChangeLog:

PR modula2/117904
* gm2/iso/pass/forloopbyconst.mod: New test.

(cherry picked from commit 363382ac7c2b8f6a09415e905b349bb7eaeca38a)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
8 months agofortran: Add default to switch in gfc_trans_transfer [PR117843]
Andrew Pinski [Fri, 29 Nov 2024 09:00:11 +0000 (01:00 -0800)] 
fortran: Add default to switch in gfc_trans_transfer [PR117843]

This fixes a bootstrap failure due to a warning on enum values not being
handled. In this case, it is just checking two values and the rest should
are not handled so adding a default case fixes the issue.

Pushed as obvious.

PR fortran/117843
gcc/fortran/ChangeLog:

* trans-io.cc (gfc_trans_transfer): Add default case.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
(cherry picked from commit 48b72743b0e29871171593fe34856da62d954750)

8 months agoFortran: fix crash with bounds check writing array section [PR117791]
Harald Anlauf [Wed, 27 Nov 2024 20:11:16 +0000 (21:11 +0100)] 
Fortran: fix crash with bounds check writing array section [PR117791]

PR fortran/117791

gcc/fortran/ChangeLog:

* trans-io.cc (gfc_trans_transfer): When an array index depends on
a function evaluation or an expression, do not use optimized array
I/O of an array section and fall back to normal scalarization.

gcc/testsuite/ChangeLog:

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

(cherry picked from commit 2261a15c0715cbf5c129b66ee44fc1d3a9e36972)

8 months agoDaily bump.
GCC Administrator [Fri, 6 Dec 2024 00:24:09 +0000 (00:24 +0000)] 
Daily bump.

8 months agoc++: Don't reject pointer to virtual method during constant evaluation [PR117615]
Simon Martin [Tue, 3 Dec 2024 13:30:43 +0000 (14:30 +0100)] 
c++: Don't reject pointer to virtual method during constant evaluation [PR117615]

We currently reject the following valid code:

=== cut here ===
struct Base {
    virtual void doit (int v) const {}
};
struct Derived : Base {
    void doit (int v) const {}
};
using fn_t = void (Base::*)(int) const;
struct Helper {
    fn_t mFn;
    constexpr Helper (auto && fn) : mFn(static_cast<fn_t>(fn)) {}
};
void foo () {
    constexpr Helper h (&Derived::doit);
}
=== cut here ===

The problem is that since r6-4014-gdcdbc004d531b4, &Derived::doit is
represented with an expression with type pointer to method and using an
INTEGER_CST (here 1), and that cxx_eval_constant_expression rejects any
such expression with a non-null INTEGER_CST.

This patch uses the same strategy as r12-4491-gf45610a45236e9 (fix for
PR c++/102786), and simply lets such expressions go through.

PR c++/117615

gcc/cp/ChangeLog:

* constexpr.cc (cxx_eval_constant_expression): Don't reject
INTEGER_CSTs with type POINTER_TYPE to METHOD_TYPE.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/constexpr-virtual22.C: New test.

(cherry picked from commit 72a2380a306a1c3883cb7e4f99253522bc265af0)

8 months agoAVR: target/64242 - Copy FP to a local reg in nonlocal_goto.
Georg-Johann Lay [Wed, 4 Dec 2024 19:56:50 +0000 (20:56 +0100)] 
AVR: target/64242 - Copy FP to a local reg in nonlocal_goto.

In nonlocal_goto sets, change hard_frame_pointer_rtx only after
emit_stack_restore() restored SP.  This is needed because SP
my be stored in some frame location.

gcc/
PR target/64242
* config/avr/avr.md (nonlocal_goto): Don't restore
hard_frame_pointer_rtx directly, but copy it to local
register, and only set hard_frame_pointer_rtx from it
after emit_stack_restore().

(cherry picked from commit f7b5527d1b48b33d8ab633c1e9dcb9883667492a)

8 months agoDaily bump.
GCC Administrator [Thu, 5 Dec 2024 00:25:32 +0000 (00:25 +0000)] 
Daily bump.

8 months ago[PATCH] PR modula2/117660: Errors referring to variables of type array could display...
Gaius Mulley [Wed, 4 Dec 2024 09:03:36 +0000 (09:03 +0000)] 
[PATCH] PR modula2/117660: Errors referring to variables of type array could display full declaration

This patch ensures that the tokens defining the full declaration of an
ARRAY type is stored in the symbol table and used during production of
error messages.

gcc/m2/ChangeLog:

PR modula2/117660
* gm2-compiler/P2Build.bnf (ArrayType): Update tok with the
composite token produced during array type declaration.
* gm2-compiler/P2SymBuild.mod (EndBuildArray): Create the
combinedtok and store it into the symbol table.
Also ensure combinedtok is pushed to the quad stack.
(BuildFieldArray): Preserve typetok.
* gm2-compiler/SymbolTable.def (PutArray): Rename parameters.
* gm2-compiler/SymbolTable.mod (PutArray): Rename parameters.

gcc/testsuite/ChangeLog:

PR modula2/117660
* gm2/iso/fail/arraymismatch.mod: New test.

(cherry picked from commit ab7abf1db09519a92f4a02af30ed6b834264c45e)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
8 months ago[PATCH] PR modula2/117371: Add check for zero step in for loop
Gaius Mulley [Wed, 4 Dec 2024 08:01:13 +0000 (08:01 +0000)] 
[PATCH] PR modula2/117371: Add check for zero step in for loop

This patch is a follow on from PR modula2/117371 which could include
a check to enforce the ISO restriction on a zero for loop step.

gcc/m2/ChangeLog:

PR modula2/117371
* gm2-compiler/M2GenGCC.mod (PerformLastForIterator):
Add check for zero step value and issue an error message.

gcc/testsuite/ChangeLog:

PR modula2/117371
* gm2/iso/fail/forloopbyzero.mod: New test.

(cherry picked from commit e37641458e9e1be1a81ff7fab4f4ab8398147d80)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
8 months agoDaily bump.
GCC Administrator [Wed, 4 Dec 2024 00:27:27 +0000 (00:27 +0000)] 
Daily bump.

8 months ago[PATCH] PR modula2/117371: type incompatibility between INTEGER and CARDINAL
Gaius Mulley [Wed, 4 Dec 2024 00:11:22 +0000 (00:11 +0000)] 
[PATCH] PR modula2/117371: type incompatibility between INTEGER and CARDINAL

This patch enforces a const expression increment in a FOR loop.
It also fixes missing error locations.  The FOR loop last iterator
value is now calculated during M2GenGCC after all types and constants have
been resolved.  This results in fewer quadruples (as there is no need to
build two paths for step > 0 and step < 0).

gcc/m2/ChangeLog:

PR modula2/117371
* gm2-compiler/M2Base.mod (MixMetaTypes): Add parameter TRUE to
MetaErrorDecl.
(IsUserType): Test against ZType.
(MixTypesDecl): Test for ZType.
* gm2-compiler/M2GenGCC.mod (ErrorMessageDecl): Add parameter TRUE to
MetaErrorDecl.
(CodeLastForIterator): New procedure.
(FoldLastForIterator): Ditto.
(PerformLastForIterator): Ditto.
(CodeStatement): Add case clause for LastForIteratorOp.
(ErrorMessageDecl): Add iserror parameter.
Call MetaErrorDecl with iserror parameter.
(checkIncorrectMeta): Call MetaErrorDecl with TRUE parameter.
(CheckBinaryExpressionTypes): Ditto.
(CheckElementSetTypes): Ditto.
* gm2-compiler/M2LexBuf.def (MakeVirtualTok): Update comment
detailing the fall back when UnknownTokenNo is encountered.
(MakeVirtual2Tok): Ditto.
* gm2-compiler/M2LexBuf.mod (MakeVirtualTok): Check against
UnknownTokenNo.
(MakeVirtual2Tok): Ditto.
* gm2-compiler/M2MetaError.def (MetaErrorDecl): Add error parameter.
* gm2-compiler/M2MetaError.mod (MetaErrorDecl): Add error
parameter.
Issue warning if error is FALSE.
* gm2-compiler/M2Quads.def (QuadOperator): Add LastForIteratorOp.
* gm2-compiler/M2Quads.mod (AddQuadInformation): New case clause
LastForIteratorOp.
(CheckAddTuple2Read): New procedure.
(BuildForLoopToRangeCheck): Remove.
(ForLoopLastIteratorVariable): Ditto.
(ForLoopLastIteratorConstant): Ditto.
(ForLoopLastIterator): Reimplement.
(BuildForToByDo): Remove ByType from call to ForLoopLastIterator.
(WriteQuad): New case clause LastForIteratorOp.
(WriteOperator): Ditto.
* gm2-compiler/M2Students.def
(CheckForVariableThatLooksLikeKeyword): Replace with ...
(CheckVariableAgainstKeyword): ... this.
* gm2-compiler/M2Students.mod
(CheckForVariableThatLooksLikeKeyword): Replace with ...
(CheckVariableAgainstKeyword): ... this.
* gm2-compiler/M2SymInit.mod (CheckLastForIterator): New
procedure.
(CheckReadBeforeInitQuad): New case clause to call
CheckLastForIterator.
* gm2-compiler/P2SymBuild.mod: Replace
CheckForVariableThatLooksLikeKeyword with CheckVariableAgainstKeyword.

gcc/testsuite/ChangeLog:

PR modula2/117371
* gm2/iso/fail/forloopbyvar.mod: New test.
* gm2/iso/fail/forloopbyvar4.mod: New test.
* gm2/iso/fail/forloopbyvar5.mod: New test.
* gm2/iso/pass/forloopbyvar3.mod: New test.

(cherry picked from commit f242f79b8afeec58477e99c44530bd503878c6d5)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
8 months ago[PATCH] modula2: Add dependencies for generated sources
Gaius Mulley [Tue, 3 Dec 2024 21:17:20 +0000 (21:17 +0000)] 
[PATCH] modula2: Add dependencies for generated sources

This patch adds rules and dependencies for the automatically
generated grammar sources.  Bootstrapped using make -j 160.

gcc/m2/ChangeLog:

* Make-lang.in (m2/gm2-compiler-boot/P0SyntaxCheck.c):
New rule.
(m2/gm2-compiler-boot/P0SyntaxCheck.o): Ditto.
(m2/gm2-compiler-boot/P1Build.c): Ditto.
(m2/gm2-compiler-boot/P1Build.o): Ditto.
(m2/gm2-compiler-boot/P2Build.c): Ditto.
(m2/gm2-compiler-boot/P2Build.o): Ditto.
(m2/gm2-compiler-boot/P3Build.c): Ditto.
(m2/gm2-compiler-boot/P3Build.o): Ditto.
(m2/gm2-compiler-boot/PCBuild.c): Ditto.
(m2/gm2-compiler-boot/PCBuild.o): Ditto.
(m2/gm2-compiler-boot/PHBuild.c): Ditto.
(m2/gm2-compiler-boot/PHBuild.o): Ditto.

(cherry picked from commit 3e6a7824033ffb88b8f99ad93b389f7d0eef22a4)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
8 months ago[PATCH] modula2: Reimplement parameter declaration and checking.
Gaius Mulley [Tue, 3 Dec 2024 21:16:25 +0000 (21:16 +0000)] 
[PATCH] modula2: Reimplement parameter declaration and checking.

This patch improves the parameter declaration by saving all parameter
kinds: proper procedure, definition module procedure and forward
procedures.  This allows error messages to reference any parameter
in the three kinds of procedures.  Variables and their declaration
are also stored.  The expression, assignment and parameter checking
has been improved to highlight any variable or parameter and
its declaration causing a conflict.

gcc/m2/ChangeLog:

* gm2-compiler/M2Base.def (MixTypes): Rename parameters.
(MixTypesDecl): New procedure function.
* gm2-compiler/M2Base.mod (BuildOrdFunctions): Add
DefProcedure parameter to PutFunction.
(BuildTruncFunctions): Ditto.
(BuildFloatFunctions): Ditto.
(BuildIntFunctions): Ditto.
(InitBaseFunctions): Ditto.
(MixTypesDecl): New procedure function.
(MixTypes): Reimplement.
* gm2-compiler/M2Check.mod (checkProcType): Replace
NoOfParam with NoOfParamAny.
Replace IsVarParam with IsVarParamAny.
(checkProcedureProcType): Ditto.
* gm2-compiler/M2Error.def: Remove unnecessary export qualified list.
* gm2-compiler/M2GCCDeclare.mod: Replace NoOfParam with NoOfParamAny.
Replace IsVarParam with IsVarParamAny.
(DeclareProcedureToGccWholeProgram): Rename son to
Variable.
(DeclareProcedureToGccSeparateProgram): Ditto.
(PrintKind): New procedure.
(PrintProcedureParameters): Ditto.
(PrintProcedureReturnType): Ditto.
(PrintProcedure): Reimplement.
(PrintProcTypeParameters): New procedure.
(PrintProcType): Ditto.
(DeclareProcType): Rename Son to Parameter.
* gm2-compiler/M2GenGCC.mod: Replace NoOfParam with NoOfParamAny.
Replace IsVarParam with IsVarParamAny.
(ErrorMessageDecl): New procedure.
(checkIncorrectMeta): Replace call to MetaErrorT2 with
ErrorMessageDecl.
(ComparisonMixTypes): Add varleft and varright parameters.
Adjust all callers of ComparisonMixTypes.
* gm2-compiler/M2MetaError.def (MetaErrorDecl): New procedure.
* gm2-compiler/M2MetaError.mod (MetaErrorDecl): New procedure.
* gm2-compiler/M2Options.def (SetXCode): Add -fd flag description
to comment.
* gm2-compiler/M2Options.mod (SetXCode): Add -fd flag description
to comment.
* gm2-compiler/M2Quads.mod (CheckBreak): New procedure.
Replace NoOfParam with NoOfParamAny.
Replace IsVarParam with IsVarParamAny.
(FailParameter): Reimplement using GetVarDeclFullTok.
Generate message for formal parameter, actual parameter and
declaration of actual parameter.
(WarnParameter): Ditto.
(CheckBuildFunction): Reimplement error message using MetaErrorT1.
* gm2-compiler/M2Range.mod: Replace NoOfParam with NoOfParamAny.
Replace IsVarParam with IsVarParamAny.
* gm2-compiler/M2Scaffold.mod (DeclareScaffoldFunctions): Call
PutProcedureDefined after every procedure declaration.
(DeclareArgEnvParams): Add ProperProcedure parameter to PutParam.
* gm2-compiler/M2Size.mod (MakeSize): Add DefProcedure parameter
to PutFunction.
* gm2-compiler/M2Swig.mod: Replace NoOfParam with NoOfParamAny.
Replace IsVarParam with IsVarParamAny.
* gm2-compiler/M2SymInit.mod: Ditto.
* gm2-compiler/M2System.mod (InitSystem): Add DefProcedure
parameter to PutFunction.
* gm2-compiler/P1SymBuild.mod (StartBuildProcedure): Reimplement.
(EndBuildProcedure): Ditto.
(EndBuildForward): Ditto.
* gm2-compiler/P2Build.bnf (BuildProcedureDefinedByForward):
Remove.
(BuildProcedureDefinedByProper): Ditto.
(ForwardDeclaration): Remove BuildProcedureDefinedByForward.
(BuildNoReturnAttribute): Remove parameter.
* gm2-compiler/P2SymBuild.def (BuildNoReturnAttribute): Remove
parameter.
(BuildProcedureDefinedByForward): Remove.
(BuildProcedureDefinedByProper): Ditto.
* gm2-compiler/P2SymBuild.mod (Import): Remove
AreParametersDefinedInDefinition,
AreParametersDefinedInImplementation,
AreProcedureParametersDefined,
ParametersDefinedInDefinition,
ParametersDefinedInImplementation,
GetProcedureDeclaredDefinition,
GetProcedureDeclaredForward,
GetProcedureDeclaredProper,
GetParametersDefinedByForward,
GetParametersDefinedByProper and
PutProcedureNoReturn.
Add PutProcedureParametersDefined,
GetProcedureParametersDefined,
GetProcedureKindDesc,
GetProcedureDeclaredTok,
GetProcedureKind,
GetReturnTypeTok,
SetReturnOptional,
IsReturnOptional,
PutProcedureNoReturn and
PutProcedureDefined.
(Debug): New procedure.
(P2StartBuildDefModule): Space formatting.
(BuildVariable): Reimplement to record full declaration.
(StartBuildProcedure): Reimplement using token to determine
the kind of procedure.
(BuildProcedureHeading): Ditto.
(BuildFPSection): Ditto.
(BuildVarArgs): Ditto.
(BuildOptArg): Ditto.
(BuildProcedureDefinedByForward): Remove.
(BuildProcedureDefinedByProper): Ditto.
(BuildFormalParameterSection): Reimplement so that the
quad stack is unchanged.
(CheckFormalParameterSection): Ditto.
(RemoveFPParameters): New procedure.
(ParameterError): Reimplement.
(StartBuildFormalParameters): Add annotation.
(ParameterMismatch): Reimplement.
(EndBuildFormalParameters): Reimplement to check against
all procedure kinds.
(GetSourceDesc): Remove.
(GetCurSrcDesc): Ditto.
(GetDeclared): Ditto.
(ReturnTypeMismatch): Reimplement.
(BuildFunction): Ditto.
(BuildOptFunction): Ditto.
(CheckOptFunction): New procedure.
(BuildNoReturnAttribute): Remove parameter and obtain
procedure symbol from quad stack.
(CheckProcedureReturn): New procedure.
* gm2-compiler/P3SymBuild.mod (BuildOptArgInitializer):
Preserve ProcSym tok on the quad stack.
Add Assert.
* gm2-compiler/PCSymBuild.mod (fixupProcedureType): Replace
NoOfParam with NoOfParamAny.
* gm2-compiler/SymbolTable.def (GetNthParam): Add ProcedureKind
parameter.
(PutFunction): Ditto.
(PutOptFunction): Ditto.
(IsReturnOptional): Ditto.
(PutParam): Ditto.
(PutVarParam): Ditto.
(PutParamName): Ditto.
(PutProcedureNoReturn): Ditto.
(IsProcedureNoReturn): Ditto.
(IsVarParam): Ditto.
(IsUnboundedParam): Ditto.
(NoOfParam): Ditto.
(ForeachLocalSymDo): Ditto.
(GetProcedureKind): Ditto.
(GetProcedureDeclaredTok): Ditto.
(PutProcedureDeclaredTok): Ditto.
(GetReturnTypeTok): Ditto.
(PutReturnTypeTok): Ditto.
(PutParametersDefinedByForward): New procedure.
(PutProcedureParametersDefined): Ditto.
(PutProcedureDefined): Ditto.
(GetParametersDefinedByProper): Ditto.
(GetProcedureDeclaredForward): Ditto.
(GetProcedureDeclaredProper): Ditto.
(PutProcedureDeclaredProper): Ditto.
(GetProcedureDeclaredDefinition): Ditto.
(PutProcedureDeclaredDefinition): Ditto.
(GetProcedureDefined): Ditto.
(PutUseOptArg): Ditto.
(UsesOptArg): Ditto.
(PutOptArgInit): Ditto.
(SetReturnOptional): Ditto.
(UsesOptArgAny): Ditto.
(GetProcedureKindDesc): Ditto.
(IsReturnOptionalAny): New procedure function.
(GetNthParamAny): Ditto.
(NoOfParamAny): Ditto.
(IsProcedureAnyNoReturn): Ditto.
(AreParametersDefinedInImplementation): Remove.
(ParametersDefinedInImplementation): Ditto.
(AreParametersDefinedInDefinition): Ditto.
(AreProcedureParametersDefined): Ditto.
(ParametersDefinedInDefinition): Ditto.
(ProcedureParametersDefined): Ditto.
(PutParametersDefinedByProper): Ditto.
(PutProcedureDeclaredForward): Ditto.
(GetParametersDefinedByForward): Ditto.
(GetProcedureParametersDefined): Ditto.
(PushOffset): Ditto.
(PopSize): Ditto.
(PushParamSize): Ditto.
(PushSumOfLocalVarSize): Ditto.
(PushSumOfParamSize): Ditto.
(PopOffset): Ditto.
(PopSumOfParamSize): Ditto.
* gm2-compiler/SymbolTable.mod (MakeProcedure): Reimplement.
(PutProcedureNoReturn): Add ProcedureKind parameter.
(GetNthParam): Ditto.
(PutFunction): Ditto.
(PutOptFunction): Ditto.
(IsReturnOptional): Ditto.
(MakeVariableForParam): Ditto.
(PutParam): Ditto.
(PutVarParam): Ditto.
(PutParamName): Ditto.
(AddParameter): Ditto.
(IsVarParam): Ditto.
(IsVarParamAny): Ditto.
(NoOfParam): Ditto.
(HasVarParameters): Ditto.
(IsUnboundedParam): Ditto.
(PutUseVarArgs): Ditto.
(UsesVarArgs): Ditto.
(PutUseOptArg): Ditto.
(UsesOptArg): Ditto.
(UsesOptArgAny): Ditto.
(PutOptArgInit): Ditto.
(IsProcedure): Ditto.
(IsPointer): Ditto.
(IsRecord): Ditto.
(IsArray): Ditto.
(IsEnumeration): Ditto.
(IsUnbounded): Ditto.
(IsSet): Ditto.
(IsSetPacked): Ditto.
(CheckUnbounded): Ditto.
(IsOAFamily): Ditto.
(IsModuleWithinProcedure): Ditto.
(GetDeclaredDef): Ditto.
(GetDeclaredMod): Ditto.
(GetDeclaredFor): Ditto.
(GetProcedureDeclaredForward): Ditto.
(GetProcedureKind): Ditto.
(PutProcedureDeclaredForward): Ditto.
(GetProcedureDeclaredTok): Ditto.
(GetProcedureDeclaredProper): Ditto.
(PutProcedureDeclaredTok): Ditto.
(PutProcedureDeclaredProper): Ditto.
(GetReturnTypeTok): Ditto.
(GetProcedureDeclaredDefinition): Ditto.
(PutReturnTypeTok): Ditto.
(PutProcedureDeclaredDefinition): Ditto.
(GetProcedureKindDesc): Ditto.
(IsProcedureVariable): Ditto.
(IsAModula2Type): Ditto.
(GetParam): Ditto.
(ProcedureParametersDefined): Ditto.
(AreParametersDefinedInImplementation): Remove.
(AreParametersDefinedInDefinition): Ditto.
(AreProcedureParametersDefined): Ditto.
(IsSizeSolved): Ditto.
(IsOffsetSolved): Ditto.
(IsValueSolved): Ditto.
(IsSumOfParamSizeSolved): Ditto.
(PushSize): Ditto.
(PushOffset): Ditto.
(PopSize): Ditto.
(PushValue): Ditto.
(PushParamSize): Ditto.
(PushSumOfLocalVarSize): Ditto.
(PushSumOfParamSize): Ditto.
(PushVarSize): Ditto.
(PopValue): Ditto.
(PopSize): Ditto.
(PopOffset): Ditto.
(PopSumOfParamSize): Ditto.
(PutParametersDefinedByForward): New procedure.
(PutProcedureParametersDefined): Ditto.
(PutProcedureDefined): Ditto.
(GetParametersDefinedByProper): Ditto.
(GetProcedureDeclaredForward): Ditto.
(GetProcedureDeclaredProper): Ditto.
(PutProcedureDeclaredProper): Ditto.
(GetProcedureDeclaredDefinition): Ditto.
(PutProcedureDeclaredDefinition): Ditto.
(GetProcedureDefined): Ditto.
(PutUseOptArg): Ditto.
(UsesOptArg): Ditto.
(PutOptArgInit): Ditto.
(SetReturnOptional): Ditto.
(UsesOptArgAny): Ditto.
(GetProcedureKindDesc): Ditto.
(PutParametersDefinedByProper): Ditto.
(GetParametersDefinedByProper): Ditto.
(IsReturnOptionalAny): New procedure function.
(IsProcedureAnyDefaultBoolean): Ditto.
(IsProcedureAnyBoolean): Ditto.
(IsProcedureAnyNoReturn): Ditto.
(GetNthParamAny): Ditto.
(NoOfParamAny): Ditto.
(IsProcedureAnyNoReturn): Ditto.
(GetProcedureKind): Ditto.
(IsVarParamAny): Ditto.
(IsUnboundedParamAny): Ditto.
(ForeachParamSymDo): New comment.
* gm2-libs-coroutines/SYSTEM.mod: Reformat.

gcc/testsuite/ChangeLog:

* gm2/iso/fail/badexpression3.mod: New test.
* gm2/iso/fail/badparam4.def: New test.
* gm2/iso/fail/badparam4.mod: New test.

(cherry picked from commit 95960cd473297cd0d2c9e75a1a424b870cee32f5)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
8 months agoUpdate gcc zh_CN.po
Joseph Myers [Tue, 3 Dec 2024 18:28:09 +0000 (18:28 +0000)] 
Update gcc zh_CN.po

* zh_CN.po: Update.

8 months agomiddle-end:For multiplication try swapping operands when matching complex multiply...
Tamar Christina [Thu, 21 Nov 2024 15:10:24 +0000 (15:10 +0000)] 
middle-end:For multiplication try swapping operands when matching complex multiply [PR116463]

This commit fixes the failures of complex.exp=fast-math-complex-mls-*.c on the
GCC 14 branch and some of the ones on the master.

The current matching just looks for one order for multiplication and was relying
on canonicalization to always give the right order because of the TWO_OPERANDS.

However when it comes to the multiplication trying only one order is a bit
fragile as they can be flipped.

The failing tests on the branch are:

void fms180snd(_Complex TYPE a[restrict N], _Complex TYPE b[restrict N],
               _Complex TYPE c[restrict N]) {
  for (int i = 0; i < N; i++)
    c[i] -= a[i] * (b[i] * I * I);
}

void fms180fst(_Complex TYPE a[restrict N], _Complex TYPE b[restrict N],
               _Complex TYPE c[restrict N]) {
  for (int i = 0; i < N; i++)
    c[i] -= (a[i] * I * I) * b[i];
}

The issue is just a small difference in commutative operations.
we look for {R,R} * {R,I} but found {R,I} * {R,R}.

Since the DF analysis is cached, we should be able to swap operands and retry
for multiply cheaply.

There is a constraint being checked by vect_validate_multiplication for the data
flow of the operands feeding the multiplications.  So e.g.

between the nodes:

note:   node 0x4d1d210 (max_nunits=2, refcnt=3) vector(2) double
note:   op template: _27 = _10 * _25;
note:      stmt 0 _27 = _10 * _25;
note:      stmt 1 _29 = _11 * _25;
note:   node 0x4d1d060 (max_nunits=2, refcnt=2) vector(2) double
note:   op template: _26 = _11 * _24;
note:      stmt 0 _26 = _11 * _24;
note:      stmt 1 _28 = _10 * _24;

we require the lanes to come from the same source which
vect_validate_multiplication checks.  As such it doesn't make sense to flip them
individually because that would invalidate the earlier linear_loads_p checks
which have validated that the arguments all come from the same datarefs.

This patch thus flips the operands in unison to still maintain this invariant,
but also honor the commutative nature of multiplication.

gcc/ChangeLog:

PR tree-optimization/116463
* tree-vect-slp-patterns.cc (complex_mul_pattern::matches,
complex_fms_pattern::matches): Try swapping operands on multiply.

(cherry picked from commit a9473f9c6f2d755d2eb79dbd30877e64b4bc6fc8)

8 months ago[PATCH] modula2: M2MetaError.{def,mod} and P2SymBuild.mod further cleanup
Gaius Mulley [Tue, 3 Dec 2024 15:58:27 +0000 (15:58 +0000)] 
[PATCH] modula2: M2MetaError.{def,mod} and P2SymBuild.mod further cleanup

Further cleanups and improve the wording of an error message.

gcc/m2/ChangeLog:

* gm2-compiler/M2MetaError.mod (op): Corrected ordering.
* gm2-compiler/P2SymBuild.def: Remove comment.
* gm2-compiler/P2SymBuild.mod (GetComparison): Replace
the word less with fewer.

(cherry picked from commit 961c02313f7e7a918e06851964ba54ea2e342cfa)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
8 months ago[PATCH] modula2: Tidyup gm2-compiler/M2MetaError.mod
Gaius Mulley [Tue, 3 Dec 2024 14:39:03 +0000 (14:39 +0000)] 
[PATCH] modula2: Tidyup gm2-compiler/M2MetaError.mod

This patch is a tidyup for gm2-compiler/M2MetaError.mod.

gcc/m2/ChangeLog:

* gm2-compiler/M2MetaError.mod (op): Alphabetically order
each case label and comment.

(cherry picked from commit 7fa9fd47f161d6b8177439ae2b46a2048a5eaa24)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
8 months ago[PATCH] PR modula2/115328 The FORWARD keyword is not implemented
Gaius Mulley [Tue, 3 Dec 2024 13:37:01 +0000 (13:37 +0000)] 
[PATCH] PR modula2/115328 The FORWARD keyword is not implemented

This patch implements the FORWARD keyword found in the ISO standard.
The patch checks incoming parameters against the prior declaration
found in definition/forward sections and will issue an error based
on virtual tokens highlighing the full parameter declaration.

gcc/m2/ChangeLog:

PR modula2/115328
* gm2-compiler/M2MetaError.def: Extend comment documentating
new format specifiers.
* gm2-compiler/M2MetaError.mod (GetTokProcedure): New declaration.
(doErrorScopeModule): New procedure.
(doErrorScopeForward): Ditto.
(doErrorScopeMod): Reimplement.
(doErrorScopeFor): New procedure.
(declarationMod): Ditto.
(doErrorScopeDefinition): Ditto.
(doErrorScopeDef): Reimplement.
(declaredDef): New procedure.
(declaredFor): Ditto.
(doErrorScopeProc): Ditto.
(declaredVar): Ditto.
(declaredType): Ditto.
(declaredFull): Ditto.
* gm2-compiler/M2Options.mod (SetAutoInit): Add missing
return type.
(GetDumpGimple): Remove duplicate implementation.
* gm2-compiler/M2Quads.def (DupFrame): New procedure.
* gm2-compiler/M2Quads.mod (DupFrame): New procedure.
* gm2-compiler/M2Reserved.def (ForwardTok): New variable.
* gm2-compiler/M2Reserved.mod (ForwardTok): Initialize variable.
* gm2-compiler/M2Scaffold.mod (DeclareArgEnvParams): Add
tokno parameter for call to PutParam.
* gm2-compiler/P0SymBuild.def (EndForward): New procedure.
* gm2-compiler/P0SymBuild.mod (EndForward): New procedure.
* gm2-compiler/P0SyntaxCheck.bnf (BlockAssert): New procedure.
(ProcedureDeclaration): Reimplement rule.
(PostProcedureHeading): New rule.
(ForwardDeclaration): Ditto.
(ProperProcedure): Ditto.
* gm2-compiler/P1Build.bnf (ProcedureDeclaration): Reimplement rule.
(PostProcedureHeading): New rule.
(ForwardDeclaration): Ditto.
(ProperProcedure): Ditto.
* gm2-compiler/P1SymBuild.def (Export): Removed unnecessary
export.
(EndBuildForward): New procedure.
* gm2-compiler/P1SymBuild.mod (StartBuildProcedure): Reimplement.
(EndBuildProcedure): Ditto.
(EndBuildForward): Ditto.
* gm2-compiler/P2Build.bnf (ProcedureDeclaration): Reimplement rule.
(PostProcedureHeading): New rule.
(ForwardDeclaration): Ditto.
(ProperProcedure): Ditto.
* gm2-compiler/P2SymBuild.def (BuildProcedureDefinedByForward):
New procedure.
(BuildProcedureDefinedByProper): Ditto.
(CheckProcedure): Ditto.
(EndBuildForward): Ditto.
* gm2-compiler/P2SymBuild.mod (EndBuildProcedure): Reimplement.
(EndBuildForward): New procedure.
(BuildFPSection): Reimplement to allow forward declaration or
checking of parameters.
(BuildProcedureDefinedByProper): New procedure.
(BuildProcedureDefinedByForward): Ditto
(FailParameter): Remove.
(ParameterError): New procedure.
(ParameterMismatch): Ditto.
(EndBuildFormalParameters): Add parameter number check.
(GetComparison): New procedure function.
(GetSourceDesc): Ditto.
(GetCurSrcDesc): Ditto.
(GetDeclared): New procedure.
(ReturnTypeMismatch): Ditto.
(BuildFunction): Reimplement.
(CheckProcedure): New procedure.
(CheckFormalParameterSection): Reimplement using ParameterError.
* gm2-compiler/P3Build.bnf (ProcedureDeclaration): Reimplement rule.
(PostProcedureHeading): New rule.
(ForwardDeclaration): Ditto.
(ProperProcedure): Ditto.
* gm2-compiler/P3SymBuild.def (Export): Remove unnecessary export.
(EndBuildForward): New procedure.
* gm2-compiler/P3SymBuild.mod (EndBuildForward): New procedure.
* gm2-compiler/PCBuild.bnf (ProcedureDeclaration): Reimplement rule.
(PostProcedureHeading): New rule.
(ForwardDeclaration): Ditto.
(ProperProcedure): Ditto.
* gm2-compiler/PCSymBuild.def (EndBuildForward): New procedure.
* gm2-compiler/PCSymBuild.mod (EndBuildForward): Ditto.
* gm2-compiler/PHBuild.bnf (ProcedureDeclaration): Reimplement rule.
(PostProcedureHeading): New rule.
(ForwardDeclaration): Ditto.
(ProperProcedure): Ditto.
* gm2-compiler/SymbolTable.def (PutVarTok): New procedure.
(PutParam): Add typetok parameter.
(PutVarParam): Ditto.
(PutParamName): Ditto.
(GetDeclaredFor): New procedure function.
(AreParametersDefinedInDefinition): Ditto.
(PutParametersDefinedByForward): New procedure.
(GetParametersDefinedByForward): New procedure function.
(PutParametersDefinedByProper): New procedure.
(GetParametersDefinedByProper): New procedure function.
(GetProcedureDeclaredForward): Ditto.
(PutProcedureDeclaredForward): New procedure.
(GetProcedureDeclaredProper): New procedure function.
(PutProcedureDeclaredProper): New procedure.
(GetProcedureDeclaredDefinition): New procedure function.
(PutProcedureDeclaredDefinition): New procedure.
(GetVarDeclTypeTok): Ditto.
(PutVarDeclTypeTok): New procedure.
(GetVarDeclTok): Ditto.
(PutVarDeclTok): New procedure.
(GetVarDeclFullTok): Ditto.
* gm2-compiler/SymbolTable.mod (ProcedureDecl): New record type.
(VarDecl): Ditto.
(SymProcedure): Add new field Declared.
(SymVar): Add new field Declared.
(PutVarTok): New procedure.
(PutParam): Add typetok parameter.
(PutVarParam): Ditto.
(PutParamName): Ditto.
(GetDeclaredFor): New procedure function.
(AreParametersDefinedInDefinition): Ditto.
(PutParametersDefinedByForward): New procedure.
(GetParametersDefinedByForward): New procedure function.
(PutParametersDefinedByProper): New procedure.
(GetParametersDefinedByProper): New procedure function.
(GetProcedureDeclaredForward): Ditto.
(PutProcedureDeclaredForward): New procedure.
(GetProcedureDeclaredProper): New procedure function.
(PutProcedureDeclaredProper): New procedure.
(GetProcedureDeclaredDefinition): New procedure function.
(PutProcedureDeclaredDefinition): New procedure.
(GetVarDeclTypeTok): Ditto.
(PutVarDeclTypeTok): New procedure.
(GetVarDeclTok): Ditto.
(PutVarDeclTok): New procedure.
(GetVarDeclFullTok): Ditto.
(MakeProcedure): Initialize Declared field.
(MakeVar): Initialize Declared field.
* gm2-libs-log/FileSystem.def (FileNameChar): Add
missing return type.
* m2.flex: Add FORWARD keyword.

gcc/testsuite/ChangeLog:

PR modula2/115328
* gm2/iso/fail/badparam.def: New test.
* gm2/iso/fail/badparam.mod: New test.
* gm2/iso/fail/badparam2.def: New test.
* gm2/iso/fail/badparam2.mod: New test.
* gm2/iso/fail/badparam3.def: New test.
* gm2/iso/fail/badparam3.mod: New test.
* gm2/iso/fail/badparamarray.def: New test.
* gm2/iso/fail/badparamarray.mod: New test.
* gm2/iso/fail/simpledef1.def: New test.
* gm2/iso/fail/simpledef1.mod: New test.
* gm2/iso/fail/simpleforward.mod: New test.
* gm2/iso/fail/simpleforward2.mod: New test.
* gm2/iso/fail/simpleforward3.mod: New test.
* gm2/iso/fail/simpleforward4.mod: New test.
* gm2/iso/fail/simpleforward5.mod: New test.
* gm2/iso/fail/simpleforward7.mod: New test.
* gm2/iso/pass/simpleforward.mod: New test.
* gm2/iso/pass/simpleforward6.mod: New test.

(cherry picked from commit e751639e3d20efe97186faa7dca33e7761ba1e79)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
8 months agoDaily bump.
GCC Administrator [Tue, 3 Dec 2024 00:26:40 +0000 (00:26 +0000)] 
Daily bump.

8 months agolibstdc++: Use constexpr instead of _GLIBCXX20_CONSTEXPR in <vector>
Jonathan Wakely [Wed, 18 Sep 2024 15:17:28 +0000 (16:17 +0100)] 
libstdc++: Use constexpr instead of _GLIBCXX20_CONSTEXPR in <vector>

For the operator<=> overload we can use the 'constexpr' keyword
directly, because we know the language dialect is at least C++20.

libstdc++-v3/ChangeLog:

* include/bits/stl_vector.h (operator<=>): Use constexpr
instead of _GLIBCXX20_CONSTEXPR macro.

(cherry picked from commit b6463161c3cd0b1f764697290d9569c7153b8a5b)

8 months agolibstdc++: avoid -Wsign-compare
Jason Merrill [Tue, 27 Aug 2024 17:17:20 +0000 (13:17 -0400)] 
libstdc++: avoid -Wsign-compare

-Wsign-compare complained about these comparisons between (unsigned) size_t
and (signed) streamsize, or between (unsigned) native_handle_type
and (signed) -1.  Fixed by adding casts to unify the types.

libstdc++-v3/ChangeLog:

* include/std/istream: Add cast to avoid -Wsign-compare.
* include/std/stacktrace: Likewise.

(cherry picked from commit 4246cf4f18053eeb47cb2a241fffa9a41573916e)

8 months agolibstdc++: fix testcase regexp
Jason Merrill [Tue, 27 Aug 2024 17:16:47 +0000 (13:16 -0400)] 
libstdc++: fix testcase regexp

The unescaped * broke the match.

libstdc++-v3/ChangeLog:

* testsuite/20_util/default_delete/void_neg.cc: Fix regexp quoting.

(cherry picked from commit 7bd2a2f9e3ef9f7de4c2f478241f7083cc54d7d3)

8 months agolibstdc++: avoid -Wzero-as-null-pointer-constant
Jason Merrill [Tue, 27 Aug 2024 17:15:52 +0000 (13:15 -0400)] 
libstdc++: avoid -Wzero-as-null-pointer-constant

libstdc++-v3/ChangeLog:

* include/std/coroutine (coroutine_handle): Use nullptr instead of
0 as initializer for _M_fr_ptr.

(cherry picked from commit 28f94bf91a536395347a2da5558f0ddf014e814f)

8 months agolibstdc++: remove extra semicolons
Jason Merrill [Tue, 27 Aug 2024 17:13:40 +0000 (13:13 -0400)] 
libstdc++: remove extra semicolons

The semicolons after each macro invocation here end up following the closing
brace of a function, leading to -Wextra-semi pedwarns.

libstdc++-v3/ChangeLog:

* include/decimal/decimal.h (_DEFINE_DECIMAL_BINARY_OP_WITH_INT):
Remove redundant semicolons.

(cherry picked from commit 7b500fa34ad88d5fdd4bf74eb2737b214749075b)

8 months agolibstdc++: Fix -Wunused-parameter warnings in Networking TS headers
Jonathan Wakely [Wed, 28 Aug 2024 11:21:56 +0000 (12:21 +0100)] 
libstdc++: Fix -Wunused-parameter warnings in Networking TS headers

libstdc++-v3/ChangeLog:

* include/experimental/io_context: Remove name of unused
parameter.
* include/experimental/socket: Add [[maybe_unused]] attribute.

(cherry picked from commit 51b0fef4e6ee01ed2509bd54a448d2564a89c518)

8 months agolibstdc++: Silence -Woverloaded-virtual warning in cxx11-ios_failure.cc
Jonathan Wakely [Wed, 18 Sep 2024 14:38:02 +0000 (15:38 +0100)] 
libstdc++: Silence -Woverloaded-virtual warning in cxx11-ios_failure.cc

libstdc++-v3/ChangeLog:

* src/c++11/cxx11-ios_failure.cc (__iosfail_type_info): Unhide
the three-arg overload of __do_upcast.

(cherry picked from commit d842eb5ee6cb4d8a2795730ac88c4c2960f94bf4)

8 months agolibstdc++: Silence -Wattributes warning in exception_ptr
Jonathan Wakely [Wed, 18 Sep 2024 14:41:05 +0000 (15:41 +0100)] 
libstdc++: Silence -Wattributes warning in exception_ptr

libstdc++-v3/ChangeLog:

* libsupc++/exception_ptr.h (__exception_ptr::_M_safe_bool_dummy):
Remove __attribute__((const)) from function returning void.

(cherry picked from commit 164c1b1f812da5d1e00fc10a415e80f7c508efcb)

8 months agolibstdc++: Remove unused typedef in <ranges>
Jonathan Wakely [Wed, 28 Aug 2024 10:49:08 +0000 (11:49 +0100)] 
libstdc++: Remove unused typedef in <ranges>

This local typedef should have been removed in r14-6199-g45630fbcf7875b.

libstdc++-v3/ChangeLog:

* include/std/ranges (to): Remove unused typedef.

(cherry picked from commit a59f1cc31cf6c7ed30a78cef134ea3ed5e139414)

8 months agolibstdc++: Improve comment for _Hashtable::_M_insert_unique_node
Jonathan Wakely [Thu, 7 Nov 2024 16:51:58 +0000 (16:51 +0000)] 
libstdc++: Improve comment for _Hashtable::_M_insert_unique_node

Clarify the effects if rehashing is needed. Document the __n_elt
parameter.

libstdc++-v3/ChangeLog:

* include/bits/hashtable.h (_M_insert_unique_node): Improve
comment.

(cherry picked from commit e97179bacd067ccd3ee765632e0c034df152ccb6)

8 months agolibstdc++: Fix get<0> constraint for lvalue ranges::subrange (LWG 3589)
Jonathan Wakely [Thu, 14 Nov 2024 17:31:43 +0000 (17:31 +0000)] 
libstdc++: Fix get<0> constraint for lvalue ranges::subrange (LWG 3589)

Approved at October 2021 plenary.

libstdc++-v3/ChangeLog:

* include/bits/ranges_util.h (subrange::begin): Fix constraint,
as per LWG 3589.
* testsuite/std/ranges/subrange/lwg3589.cc: New test.

(cherry picked from commit 4a3a0be34f723df192361e43bb48b9292dfe3a54)

8 months agolibstdc++: Check feature test macros in unordered containers
Jonathan Wakely [Fri, 1 Nov 2024 10:50:02 +0000 (10:50 +0000)] 
libstdc++: Check feature test macros in unordered containers

Replace some `__cplusplus > 201402L` preprocessor checks with more
expressive checks for the appropriate feature test macros.

libstdc++-v3/ChangeLog:

* include/bits/unordered_map.h: Check __glibcxx_node_extract and
__glibcxx_unordered_map_try_emplace instead of __cplusplus.
* include/bits/unordered_set.h: Check __glibcxx_node_extract
instead of __cplusplus.

(cherry picked from commit 1a5bdeb1128ecfa4ce233218d02ccbb88ce0d8a8)

8 months agolibstdc++: Use appropriate feature test macro for std::byte
Jonathan Wakely [Fri, 11 Oct 2024 12:29:06 +0000 (13:29 +0100)] 
libstdc++: Use appropriate feature test macro for std::byte

libstdc++-v3/ChangeLog:

* include/bits/cpp_type_traits.h (__is_byte<byte>): Guard with
__glibcxx_byte macro instead of checking __cplusplus.

(cherry picked from commit 00a87ee76f47d0fa5a10ef982101cb3c3b8e9c99)

8 months agolibstdc++: Make equal and is_permutation short-circuit (LWG 3560)
Jonathan Wakely [Thu, 14 Nov 2024 16:57:17 +0000 (16:57 +0000)] 
libstdc++: Make equal and is_permutation short-circuit (LWG 3560)

We already implement short-circuiting for random access iterators, but
we also need to do so for ranges::equal and ranges::is_permutation when
given sized ranges that are not random access ranges (e.g. std::list).

libstdc++-v3/ChangeLog:

* include/bits/ranges_algo.h (__is_permutation_fn::operator()):
Short-circuit for sized ranges with different sizes, as per LWG
3560.
* include/bits/ranges_algobase.h (__equal_fn::operator()):
Likewise.
* include/bits/stl_algo.h (__is_permutation): Use if-constexpr
for random access iterator branches.
* include/bits/stl_algobase.h (__equal4): Likewise.
* testsuite/25_algorithms/equal/lwg3560.cc: New test.
* testsuite/25_algorithms/is_permutation/lwg3560.cc: New test.

Reviewed-by: Patrick Palka <ppalka@redhat.com>
(cherry picked from commit 45cc42d6dc0642612e7076e95820438a1aab5479)

8 months agolibstdc++: Implement LWG 3798 for range adaptors [PR106676]
Jonathan Wakely [Sun, 13 Oct 2024 21:28:16 +0000 (22:28 +0100)] 
libstdc++: Implement LWG 3798 for range adaptors [PR106676]

LWG 3798 modified the iterator_category of the iterator types for
transform_view, join_with_view, zip_transform_view and
adjacent_transform_view, to allow the iterator's reference type to be an
rvalue reference.

libstdc++-v3/ChangeLog:

PR libstdc++/106676
* include/bits/iterator_concepts.h (__cpp17_fwd_iterator): Use
is_reference instead of is_value_reference.
rvalue references.
* include/std/ranges (transform_view:__iter_cat::_S_iter_cat):
Likewise.
(zip_transform_view::__iter_cat::_S_iter_cat): Likewise.
(adjacent_transform_view::__iter_cat::_S_iter_cat): Likewise.
(join_with_view::__iter_cat::_S_iter_cat): Likewise.
* testsuite/std/ranges/adaptors/transform.cc: Check
iterator_category when the transformation function returns an
rvalue reference type.

Reviewed-by: Patrick Palka <ppalka@redhat.com>
(cherry picked from commit 7f65f94917866c6b18d9698eec6451c1bf21e0f9)

8 months agolibstdc++: Fix -Wsign-compare warning in std::string::resize_for_overwrite
Jonathan Wakely [Fri, 27 Sep 2024 14:51:56 +0000 (15:51 +0100)] 
libstdc++: Fix -Wsign-compare warning in std::string::resize_for_overwrite

libstdc++-v3/ChangeLog:

* include/bits/basic_string.tcc (resize_for_overwrite): Fix
-Wsign-compare warning.
* include/bits/cow_string.h (resize_for_overwrite): Likewise.

(cherry picked from commit 7040c207baa6b5d5f6065a47dd3559f3d3974a1b)

8 months agolibstdc++: Fix std::vector<bool>::emplace to forward parameter
Jonathan Wakely [Sat, 26 Oct 2024 20:24:58 +0000 (21:24 +0100)] 
libstdc++: Fix std::vector<bool>::emplace to forward parameter

If the parameter is not lvalue-convertible to bool then the current code
will fail to compile. The parameter should be forwarded to restore the
original value category.

libstdc++-v3/ChangeLog:

* include/bits/stl_bvector.h (emplace_back, emplace): Forward
parameter pack to preserve value category.
* testsuite/23_containers/vector/bool/emplace_rvalue.cc: New
test.

(cherry picked from commit f1c844be5202f4be446f165d9a7625eb7ec4c5b4)