]> gcc.gnu.org Git - gcc.git/log
gcc.git
14 months agoRISC-V: Fix a bug that causes an error insn.
yulong [Tue, 8 Aug 2023 04:12:32 +0000 (12:12 +0800)]
RISC-V: Fix a bug that causes an error insn.

I test the following rvv intrinsics.
vint64m1_t test_vslide1up_vx_i64m1_m(vbool64_t mask, vint64m1_t src, int64_t value, size_t vl) {
  return __riscv_vslide1up_vx_i64m1_m(mask, src, value, vl);
}
And I got an error info,t hat is error:
  unrecognizable insn:(insn 17 16 18 2
    (set (reg:RVVMIDI 134 [ _1 ])(if_then_else:RVVMIDI
      (unspec:RVVMF64BI [(reg/v:SI 142 [ vl ])(const_int 2 [x2])(const_int 日 [o])(reg:SI 66 vl)(reg:SI 67 vtype)] UNSPEC_VPREDICATE
   (vec_merge:RVVMIDI (reg:RVVMIDI 134 [ _1 ])(unspec:RVVMIDI [(reg:sI 日 zero)] UNSPEC_VUNDEF)
   (reg/v:RVVMF64BI 137 [ mask ]))
   (unspec:RVVM1DI[(reg:sI 日 zero)] UNSPEC_VUNDEF)))

This patch fix it.

gcc/ChangeLog:

* config/riscv/riscv-v.cc (slide1_sew64_helper): Modify.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/base/vslide1down-1.c: New test.
* gcc.target/riscv/rvv/base/vslide1down-2.c: New test.
* gcc.target/riscv/rvv/base/vslide1down-3.c: New test.
* gcc.target/riscv/rvv/base/vslide1up-1.c: New test.
* gcc.target/riscv/rvv/base/vslide1up-2.c: New test.
* gcc.target/riscv/rvv/base/vslide1up-3.c: New test.

14 months agoDaily bump.
GCC Administrator [Tue, 8 Aug 2023 00:20:39 +0000 (00:20 +0000)]
Daily bump.

14 months agoc++: constexpr empty subobject elision [PR110197]
Patrick Palka [Thu, 27 Jul 2023 13:10:07 +0000 (09:10 -0400)]
c++: constexpr empty subobject elision [PR110197]

Now that init_subob_ctx no longer sets new_ctx.ctor for a subobject of
empty type, it seems we need to ensure its callers also consistently
omit entries in the parent ctx->ctor for such subobjects.  We also need
to allow cxx_eval_array_reference to synthesize an empty subobject even
if the array CONSTRUCTOR has CONSTRUCTOR_NO_CLEARING set.

PR c++/110197

gcc/cp/ChangeLog:

* constexpr.cc (cxx_eval_array_reference): Allow synthesizing an
empty subobject even if CONSTRUCTOR_NO_CLEARING is set.
(cxx_eval_bare_aggregate): Set 'no_slot' to true more generally
whenever new_ctx.ctor is set to NULL_TREE by init_subob_ctx,
i.e. whenever initializing an subobject of empty type.
(cxx_eval_vec_init_1): Define 'no_slot' as above and use it
accordingly.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/constexpr-empty18.C: New test.
* g++.dg/cpp0x/constexpr-empty19.C: New test.

(cherry picked from commit a426b91b27e28985f47d16827a532fbc28c09bd7)

14 months agoc++: passing partially inst tmpl as ttp [PR110566]
Patrick Palka [Wed, 26 Jul 2023 21:21:26 +0000 (17:21 -0400)]
c++: passing partially inst tmpl as ttp [PR110566]

Since the template arguments 'pargs' we pass to coerce_template_parms from
coerce_template_template_parms are always a full set, we need to make sure
we always pass the parameters of the most general template because if the
template is partially instantiated then the levels won't match up.  In the
testcase below during said call to coerce_template_parms the parameters are
{X, Y}, both level 1 rather than 2, and the arguments are {{int}, {N, M}},
which results in a crash during auto deduction for parameters' types.

PR c++/110566
PR c++/108179

gcc/cp/ChangeLog:

* pt.cc (coerce_template_template_parms): Simplify by using
DECL_INNERMOST_TEMPLATE_PARMS and removing redundant asserts.
Always pass the parameters of the most general template to
coerce_template_parms.

gcc/testsuite/ChangeLog:

* g++.dg/template/ttp38.C: New test.

(cherry picked from commit b3adcc60dcf3314f47f5409aecef40607f82b80b)

14 months agoPR modula2/110779 SysClock can not read the clock
Gaius Mulley [Mon, 7 Aug 2023 14:08:49 +0000 (15:08 +0100)]
PR modula2/110779 SysClock can not read the clock

This patch completes the implementation of the ISO module
SysClock.mod.  Three new testcases are provided.  wrapclock.{cc,def}
are new support files providing access to clock_settime, clock_gettime
and glibc timezone variables.

gcc/m2/ChangeLog:

PR modula2/110779
* gm2-libs-iso/SysClock.mod: Re-implement using wrapclock.
* gm2-libs-iso/wrapclock.def: New file.

libgm2/ChangeLog:

PR modula2/110779
* config.h.in: Regenerate.
* configure: Regenerate.
* configure.ac (GM2_CHECK_LIB): Check for clock_gettime
and clock_settime.
* libm2iso/Makefile.am (M2DEFS): Add wrapclock.def.
* libm2iso/Makefile.in: Regenerate.
* libm2iso/wraptime.cc: Replace HAVE_TIMEVAL with
HAVE_STRUCT_TIMEVAL.
* libm2iso/wrapclock.cc: New file.

gcc/testsuite/ChangeLog:

PR modula2/110779
* gm2/iso/run/pass/m2date.mod: New test.
* gm2/iso/run/pass/testclock.mod: New test.
* gm2/iso/run/pass/testclock2.mod: New test.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
14 months agolibsanitizer: Fix SPARC stacktraces
Rainer Orth [Mon, 7 Aug 2023 09:31:56 +0000 (11:31 +0200)]
libsanitizer: Fix SPARC stacktraces

As detailed in LLVM Issue #57624
(https://github.com/llvm/llvm-project/issues/57624), a patch to
sanitizer_internal_defs.h broke SPARC stacktraces in the sanitizers.
The issue has now been fixed upstream (https://reviews.llvm.org/D156504)
and I'd like to cherry-pick that patch.

Bootstrapped without regressions on sparc-sun-solaris2.11.

2023-07-27  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

libsanitizer:
* sanitizer_common/sanitizer_stacktrace_sparc.cpp,
sanitizer_common/sanitizer_unwind_linux_libcdep.cpp: Cherry-pick
llvm-project revision 679c076ae446af81eba81ce9b94203a273d4b88a.

14 months agoDaily bump.
GCC Administrator [Mon, 7 Aug 2023 00:20:25 +0000 (00:20 +0000)]
Daily bump.

15 months agoDaily bump.
GCC Administrator [Sun, 6 Aug 2023 00:19:23 +0000 (00:19 +0000)]
Daily bump.

15 months agoDaily bump.
GCC Administrator [Sat, 5 Aug 2023 00:20:10 +0000 (00:20 +0000)]
Daily bump.

15 months agoAVR: Add some more devices: AVR16DD*, AVR32DD*, AVR64DD*, AVR64EA*, ATtiny42*, ATtiny...
Georg-Johann Lay [Fri, 4 Aug 2023 08:24:39 +0000 (10:24 +0200)]
AVR: Add some more devices: AVR16DD*, AVR32DD*, AVR64DD*, AVR64EA*, ATtiny42*, ATtiny82*, ATtiny162*, ATtiny322*, ATtiny10*.

gcc/
* config/avr/avr-mcus.def (avr64dd14, avr64dd20, avr64dd28, avr64dd32)
(avr64ea28, avr64ea32, avr64ea48, attiny424, attiny426, attiny427)
(attiny824, attiny826, attiny827, attiny1624, attiny1626, attiny1627)
(attiny3224, attiny3226, attiny3227, avr16dd14, avr16dd20, avr16dd28)
(avr16dd32, avr32dd14, avr32dd20, avr32dd28, avr32dd32)
(attiny102, attiny104): New devices.
* doc/avr-mmcu.texi: Regenerate.

15 months agoFix some minor typos in avr-mcus.def.
Georg-Johann Lay [Fri, 4 Aug 2023 07:51:11 +0000 (09:51 +0200)]
Fix some minor typos in avr-mcus.def.

gcc/
* config/avr/avr-mcus.def (avr128d*, avr64d*): Fix their FLASH_SIZE
and PM_OFFSET entries.

15 months agoDaily bump.
GCC Administrator [Fri, 4 Aug 2023 00:19:47 +0000 (00:19 +0000)]
Daily bump.

15 months ago[libbacktrace] fix up broken test
Richard Biener [Thu, 3 Aug 2023 13:21:51 +0000 (15:21 +0200)]
[libbacktrace] fix up broken test

zstdtest has some inline data where some testcases lack the
uncompressed length field.  Thus it computes that but still
ends up allocating memory for the uncompressed buffer based on
that (zero) length.  Oops.  Causes memory corruption if the
allocator returns non-NULL.

libbacktrace/
* zstdtest.c (test_samples): Properly compute the allocation
size for the uncompressed data.

(cherry picked from commit a9b6043983b2ebd9d5c0f72043b17110b54f1910)

15 months agoDaily bump.
GCC Administrator [Thu, 3 Aug 2023 00:19:47 +0000 (00:19 +0000)]
Daily bump.

15 months agoDaily bump.
GCC Administrator [Wed, 2 Aug 2023 00:20:56 +0000 (00:20 +0000)]
Daily bump.

15 months agoPR modula2/110161 Comparing a typed procedure variable to 0 gives ICE or assertion
Gaius Mulley [Tue, 1 Aug 2023 23:42:06 +0000 (00:42 +0100)]
PR modula2/110161 Comparing a typed procedure variable to 0 gives ICE or assertion

This patch allows a proc type to be compared against an address.

gcc/m2/ChangeLog:

PR modula2/110161
* gm2-compiler/M2Check.mod (checkProcTypeEquivalence): New
procedure function.
(checkTypeKindEquivalence): Call checkProcTypeEquivalence
if either left or right is a proc type.
* gm2-compiler/M2Quads.mod (BuildRelOp): Create
combinedTok prior to creating the range check quadruple.
Use combinedTok when creating the range check quadruple.

gcc/testsuite/ChangeLog:

PR modula2/110161
* gm2/pim/fail/badxproc.mod: New test.

(cherry picked from commit 8bf244e32a0d505720396fbb7df26f824c7f77eb)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
15 months agoPR modula2/110865 Unable to access copied const array
Gaius Mulley [Tue, 1 Aug 2023 13:59:48 +0000 (14:59 +0100)]
PR modula2/110865 Unable to access copied const array

This patch allows constants of an array type to be indexed.

gcc/m2/ChangeLog:

PR modula2/110865
* gm2-compiler/M2Quads.mod (BuildDesignatorArray):
Rename t as type and d as dim.  New variable result.
Allow constants of an array type to be indexed.

gcc/testsuite/ChangeLog:

PR modula2/110865
* gm2/iso/pass/constvec.mod: New test.
* gm2/iso/pass/constvec2.mod: New test.
* gm2/iso/run/pass/constvec3.mod: New test.

(cherry picked from commit 8a47474f2cf48837d6adf4a1232a89fd398ca7fa)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
15 months agotarget/110220: Set JUMP_LABEL and LABEL_NUSES of new branch insn generated by
Georg-Johann Lay [Tue, 1 Aug 2023 11:49:17 +0000 (13:49 +0200)]
target/110220: Set JUMP_LABEL and LABEL_NUSES of new branch insn generated by

target specific RTL optimization pass .avr-casesi.

gcc/
PR target/110220
* config/avr/avr.cc (avr_optimize_casesi): Set JUMP_LABEL and
LABEL_NUSES of new conditional branch instruction.

15 months agors6000: Correct vsx operands output for xxeval [PR110741]
Kewen Lin [Wed, 26 Jul 2023 08:42:29 +0000 (03:42 -0500)]
rs6000: Correct vsx operands output for xxeval [PR110741]

PR110741 exposes one issue that we didn't use the correct
character for vsx operands in output operand substitution,
consequently it can map to the wrong registers which hold
some unexpected values.

PR target/110741

gcc/ChangeLog:

* config/rs6000/vsx.md (define_insn xxeval): Correct vsx
operands output with "x".

gcc/testsuite/ChangeLog:

* g++.target/powerpc/pr110741.C: New test.

(cherry picked from commit 96a839233ced3a0bfc3d5492a6d8b102e6981472)

15 months agoDaily bump.
GCC Administrator [Tue, 1 Aug 2023 00:21:31 +0000 (00:21 +0000)]
Daily bump.

15 months agomodula2: Fix bootstrap
Gaius Mulley [Mon, 31 Jul 2023 18:43:02 +0000 (19:43 +0100)]
modula2: Fix bootstrap

Combining 3 patches from master for Make-lang.in and header
file changes to ensure that this sequence does not break git bisect.

gcc/m2/ChangeLog:

PR modula2/110284
* Make-lang.in: Build $(generated_files) before building
all $(GM2_C_OBJS).
(m2_OBJS): Assign $(GM2_C_OBJS).  Add m2/gm2-gcc/rtegraph.o and
m2/gm2-compiler-boot/m2flex.o.
(GM2_C_OBJS): Remove m2/stor-layout.o.
(m2/stor-layout.o): Remove rule.
* gm2-gcc/gcc-consolidation.h (rtl.h): Remove include.
(df.h): Remove include.
(except.h): Remove include.
(c-family/m2pp.o): Remove.
* Make-maintainer.in (c-family/m2pp.o): Add.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
15 months agoriscv: fix error: control reaches end of non-void function
Martin Liska [Wed, 3 May 2023 14:35:26 +0000 (16:35 +0200)]
riscv: fix error: control reaches end of non-void function

Fixes:
gcc/config/riscv/sync.md:66:1: error: control reaches end of non-void function [-Werror=return-type]
66 |   [(set (attr "length") (const_int 4))])
   | ^

PR target/109713

gcc/ChangeLog:

* config/riscv/sync.md: Add gcc_unreachable to a switch.

15 months agoRISC-V: Table A.6 conformance tests
Patrick O'Neill [Fri, 7 Apr 2023 20:13:21 +0000 (13:13 -0700)]
RISC-V: Table A.6 conformance tests

These tests cover basic cases to ensure the atomic mappings follow the
strengthened Table A.6 mappings that are compatible with Table A.7.

2023-04-27 Patrick O'Neill <patrick@rivosinc.com>

gcc/testsuite/ChangeLog:

* gcc.target/riscv/amo-table-a-6-amo-add-1.c: New test.
* gcc.target/riscv/amo-table-a-6-amo-add-2.c: New test.
* gcc.target/riscv/amo-table-a-6-amo-add-3.c: New test.
* gcc.target/riscv/amo-table-a-6-amo-add-4.c: New test.
* gcc.target/riscv/amo-table-a-6-amo-add-5.c: New test.
* gcc.target/riscv/amo-table-a-6-compare-exchange-1.c: New test.
* gcc.target/riscv/amo-table-a-6-compare-exchange-2.c: New test.
* gcc.target/riscv/amo-table-a-6-compare-exchange-3.c: New test.
* gcc.target/riscv/amo-table-a-6-compare-exchange-4.c: New test.
* gcc.target/riscv/amo-table-a-6-compare-exchange-5.c: New test.
* gcc.target/riscv/amo-table-a-6-compare-exchange-6.c: New test.
* gcc.target/riscv/amo-table-a-6-compare-exchange-7.c: New test.
* gcc.target/riscv/amo-table-a-6-fence-1.c: New test.
* gcc.target/riscv/amo-table-a-6-fence-2.c: New test.
* gcc.target/riscv/amo-table-a-6-fence-3.c: New test.
* gcc.target/riscv/amo-table-a-6-fence-4.c: New test.
* gcc.target/riscv/amo-table-a-6-fence-5.c: New test.
* gcc.target/riscv/amo-table-a-6-load-1.c: New test.
* gcc.target/riscv/amo-table-a-6-load-2.c: New test.
* gcc.target/riscv/amo-table-a-6-load-3.c: New test.
* gcc.target/riscv/amo-table-a-6-store-1.c: New test.
* gcc.target/riscv/amo-table-a-6-store-2.c: New test.
* gcc.target/riscv/amo-table-a-6-store-compat-3.c: New test.
* gcc.target/riscv/amo-table-a-6-subword-amo-add-1.c: New test.
* gcc.target/riscv/amo-table-a-6-subword-amo-add-2.c: New test.
* gcc.target/riscv/amo-table-a-6-subword-amo-add-3.c: New test.
* gcc.target/riscv/amo-table-a-6-subword-amo-add-4.c: New test.
* gcc.target/riscv/amo-table-a-6-subword-amo-add-5.c: New test.

Signed-off-by: Patrick O'Neill <patrick@rivosinc.com>
15 months agoRISC-V: Weaken atomic loads
Patrick O'Neill [Fri, 7 Apr 2023 22:14:17 +0000 (15:14 -0700)]
RISC-V: Weaken atomic loads

This change brings atomic loads in line with table A.6 of the ISA
manual.

2023-04-27 Patrick O'Neill <patrick@rivosinc.com>

gcc/ChangeLog:

* config/riscv/sync.md (atomic_load<mode>): Implement atomic
load mapping.

Signed-off-by: Patrick O'Neill <patrick@rivosinc.com>
15 months agoRISC-V: Weaken mem_thread_fence
Patrick O'Neill [Fri, 7 Apr 2023 17:44:09 +0000 (10:44 -0700)]
RISC-V: Weaken mem_thread_fence

This change brings atomic fences in line with table A.6 of the ISA
manual.

Relax mem_thread_fence according to the memmodel given.

2023-04-27 Patrick O'Neill <patrick@rivosinc.com>

gcc/ChangeLog:

* config/riscv/sync.md (mem_thread_fence_1): Change fence
depending on the given memory model.

Signed-off-by: Patrick O'Neill <patrick@rivosinc.com>
15 months agoRISC-V: Weaken LR/SC pairs
Patrick O'Neill [Wed, 5 Apr 2023 16:49:20 +0000 (09:49 -0700)]
RISC-V: Weaken LR/SC pairs

Introduce the %I and %J flags for setting the .aqrl bits on LR/SC pairs
as needed.

Atomic compare and exchange ops provide success and failure memory
models. C++17 and later place no restrictions on the relative strength
of each model, so ensure we cover both by using a model that enforces
the ordering of both given models.

This change brings LR/SC ops in line with table A.6 of the ISA manual.

2023-04-27 Patrick O'Neill <patrick@rivosinc.com>

gcc/ChangeLog:

* config/riscv/riscv-protos.h (riscv_union_memmodels): Expose
riscv_union_memmodels function to sync.md.
* config/riscv/riscv.cc (riscv_union_memmodels): Add function to
get the union of two memmodels in sync.md.
(riscv_print_operand): Add %I and %J flags that output the
optimal LR/SC flag bits for a given memory model.
* config/riscv/sync.md: Remove static .aqrl bits on LR op/.rl
bits on SC op and replace with optimized %I, %J flags.

Signed-off-by: Patrick O'Neill <patrick@rivosinc.com>
15 months agoRISC-V: Eliminate AMO op fences
Patrick O'Neill [Wed, 5 Apr 2023 16:48:06 +0000 (09:48 -0700)]
RISC-V: Eliminate AMO op fences

Atomic operations with the appropriate bits set already enfore release
semantics. Remove unnecessary release fences from atomic ops.

This change brings AMO ops in line with table A.6 of the ISA manual.

2023-04-27 Patrick O'Neill <patrick@rivosinc.com>

gcc/ChangeLog:

* config/riscv/riscv.cc
(riscv_memmodel_needs_amo_release): Change function name.
(riscv_print_operand): Remove unneeded %F case.
* config/riscv/sync.md: Remove unneeded fences.

Signed-off-by: Patrick O'Neill <patrick@rivosinc.com>
15 months agoRISC-V: Strengthen atomic stores
Patrick O'Neill [Wed, 5 Apr 2023 16:56:33 +0000 (09:56 -0700)]
RISC-V: Strengthen atomic stores

This change makes atomic stores strictly stronger than table A.6 of the
ISA manual. This mapping makes the overall patchset compatible with
table A.7 as well.

2023-04-27 Patrick O'Neill <patrick@rivosinc.com>

PR target/89835

gcc/ChangeLog:

* config/riscv/sync.md (atomic_store<mode>): Use simple store
instruction in combination with fence(s).

gcc/testsuite/ChangeLog:

* gcc.target/riscv/pr89835.c: New test.

Signed-off-by: Patrick O'Neill <patrick@rivosinc.com>
15 months agoRISC-V: Add AMO release bits
Patrick O'Neill [Wed, 5 Apr 2023 16:47:05 +0000 (09:47 -0700)]
RISC-V: Add AMO release bits

This patch sets the relevant .rl bits on amo operations.

2023-04-27 Patrick O'Neill <patrick@rivosinc.com>

gcc/ChangeLog:

* config/riscv/riscv.cc (riscv_print_operand): Change behavior
of %A to include release bits.

Signed-off-by: Patrick O'Neill <patrick@rivosinc.com>
15 months agoRISC-V: Enforce atomic compare_exchange SEQ_CST
Patrick O'Neill [Wed, 5 Apr 2023 16:46:37 +0000 (09:46 -0700)]
RISC-V: Enforce atomic compare_exchange SEQ_CST

This patch enforces SEQ_CST for atomic compare_exchange ops.

Replace Fence/LR.aq/SC.aq pairs with SEQ_CST LR.aqrl/SC.rl pairs
recommended by table A.6 of the ISA manual.

2023-04-27 Patrick O'Neill <patrick@rivosinc.com>

gcc/ChangeLog:

* config/riscv/sync.md (atomic_cas_value_strong<mode>): Change
FENCE/LR.aq/SC.aq into sequentially consistent LR.aqrl/SC.rl
pair.

Signed-off-by: Patrick O'Neill <patrick@rivosinc.com>
15 months agoRISC-V: Enforce subword atomic LR/SC SEQ_CST
Patrick O'Neill [Fri, 21 Apr 2023 20:11:35 +0000 (13:11 -0700)]
RISC-V: Enforce subword atomic LR/SC SEQ_CST

Replace LR.aq/SC.rl pairs with the SEQ_CST LR.aqrl/SC.rl pairs
recommended by table A.6 of the ISA manual.

2023-04-27 Patrick O'Neill <patrick@rivosinc.com>

gcc/ChangeLog:

* config/riscv/sync.md: Change LR.aq/SC.rl pairs into
sequentially consistent LR.aqrl/SC.rl pairs.

Signed-off-by: Patrick O'Neill <patrick@rivosinc.com>
15 months agoRISC-V: Enforce Libatomic LR/SC SEQ_CST
Patrick O'Neill [Wed, 5 Apr 2023 16:44:57 +0000 (09:44 -0700)]
RISC-V: Enforce Libatomic LR/SC SEQ_CST

Replace LR.aq/SC.rl pairs with the SEQ_CST LR.aqrl/SC.rl pairs
recommended by table A.6 of the ISA manual.

2023-04-27 Patrick O'Neill <patrick@rivosinc.com>

libgcc/ChangeLog:

* config/riscv/atomic.c: Change LR.aq/SC.rl pairs into
sequentially consistent LR.aqrl/SC.rl pairs.

Signed-off-by: Patrick O'Neill <patrick@rivosinc.com>
15 months agoRISC-V: Eliminate SYNC memory models
Patrick O'Neill [Wed, 5 Apr 2023 16:44:33 +0000 (09:44 -0700)]
RISC-V: Eliminate SYNC memory models

Remove references to MEMMODEL_SYNC_* models by converting via
memmodel_base().

2023-04-27 Patrick O'Neill <patrick@rivosinc.com>

gcc/ChangeLog:

* config/riscv/riscv.cc: Remove MEMMODEL_SYNC_* cases and
sanitize memmodel input with memmodel_base.

Signed-off-by: Patrick O'Neill <patrick@rivosinc.com>
15 months agoUpdate gcc sv.po
Joseph Myers [Mon, 31 Jul 2023 16:00:20 +0000 (16:00 +0000)]
Update gcc sv.po

* sv.po: Update.

15 months ago[aarch64/match.pd] Fix ICE observed in PR110280.
Prathamesh Kulkarni [Wed, 26 Jul 2023 17:06:26 +0000 (22:36 +0530)]
[aarch64/match.pd] Fix ICE observed in PR110280.

gcc/ChangeLog:
PR tree-optimization/110280
* match.pd (vec_perm_expr(v, v, mask) -> v): Explicitly build vector
using build_vector_from_val with the element of input operand, and
mask's type if operand and mask's types don't match.

gcc/testsuite/ChangeLog:
PR tree-optimization/110280
* gcc.target/aarch64/sve/pr110280.c: New test.

(cherry picked from commit 85d8e0d8d5342ec8b4e6a54e22741c30b33c6f04)

15 months agoDaily bump.
GCC Administrator [Mon, 31 Jul 2023 00:20:57 +0000 (00:20 +0000)]
Daily bump.

15 months agoPR modula2/110174 Bugfixes to M2GenGCC.mod:CodeInline preventing an ICE
Gaius Mulley [Mon, 31 Jul 2023 00:05:20 +0000 (01:05 +0100)]
PR modula2/110174 Bugfixes to M2GenGCC.mod:CodeInline preventing an ICE

This patch calls skip_const_decl before chaining parameter values and
ensures that all strings passed to build_stmt (..., ASM_EXPR, ...) are
nul terminated.  It also improves the accuracy of locations in
function calls and asm statements.

gcc/m2/

PR modula2/110174
* gm2-compiler/M2GCCDeclare.def (PromoteToCString): New procedure
function.
* gm2-compiler/M2GCCDeclare.mod (PromoteToCString): New procedure
function.
* gm2-compiler/M2GenGCC.mod (BuildTreeFromInterface): Call
skip_const_decl before chaining the parameter value.
Use PromoteToCString to ensure the string is nul terminated.
(CodeInline): Remove all parameters and replace with quad.
Use GetQuadOtok to get operand token numbers.
Remove call to DeclareConstant and replace it with PromoteToCString.
* gm2-compiler/M2Quads.def (BuildInline): Rename into ...
(BuildAsm): ... this.
* gm2-compiler/M2Quads.mod: (BuildInline): Rename into ...
(BuildAsm): ... this.
(BuildAsmElement): Add debugging.
* gm2-compiler/P1Build.bnf: Remove import of BuildInline.
* gm2-compiler/P2Build.bnf: Remove import of BuildInline.
* gm2-compiler/P3Build.bnf: Remove import of BuildInline and
import BuildAsm.
* gm2-compiler/PHBuild.bnf: Remove import of BuildInline.
* gm2-libs-iso/SysClock.mod (foo): Remove.
* gm2-libs/FIO.mod (BufferedRead): Rename parameter a to dest.
Rename variable t to src.
* m2pp.cc (pf): Correct block comment.
(pe): Correct block comment.
(m2pp_asm_expr): New function.
(m2pp_statement): Call m2pp_asm_expr.

gcc/testsuite/

PR modula2/110174
* gm2/pim/pass/program2.mod: Remove import of BuildInline.
* gm2/extensions/asm/fail/extensions-asm-fail.exp: New test.
* gm2/extensions/asm/fail/stressreturn.mod: New test.
* gm2/extensions/asm/pass/extensions-asm-pass.exp: New test.
* gm2/extensions/asm/pass/fooasm.mod: New test.

(cherry picked from commit c4637cbed3f23095b98962b41063380c4ab9eda9)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
15 months agoPR modula2/110631 Bugfix to FIO WriteCardinal
Gaius Mulley [Sun, 30 Jul 2023 20:44:49 +0000 (21:44 +0100)]
PR modula2/110631 Bugfix to FIO WriteCardinal

FIO.WriteCardinal fails to write binary data.  This patch fixes two
bugs in FIO.mod and provides a testcase which writes and reads binary
cardinals.  There was an off by one error when using HIGH (a) to
determine the number of bytes and the dest/src pointers were switched
when calling memcpy.

gcc/m2/ChangeLog:

PR modula2/110631
* gm2-libs/FIO.def (ReadAny): Correct comment as
HIGH (a) + 1 is number of bytes.
(WriteAny): Correct comment as HIGH (a) + 1 is number of
bytes.
* gm2-libs/FIO.mod (ReadAny): Correct comment as
HIGH (a) + 1 is number of bytes.  Also pass HIGH (a) + 1
to BufferedRead.
(WriteAny): Correct comment as HIGH (a) + 1 is number of
bytes. Also pass HIGH (a) + 1 to BufferedWrite.
(BufferedWrite): Rename parameter a to src, rename variable
t to dest.  Correct parameter order to memcpy.

gcc/testsuite/ChangeLog:

PR modula2/110631
* gm2/pimlib/run/pass/testfiobinary.mod: New test.

(cherry picked from commit 73cc6ce1294ec35e9322b1bbc91009cfc76f732b)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
15 months agomodula2: Implement limited VAR parameter static analysis
Gaius Mulley [Sun, 30 Jul 2023 19:09:35 +0000 (20:09 +0100)]
modula2: Implement limited VAR parameter static analysis

This patch implements limited VAR parameter static analysis for pointer
parameters.

gcc/m2/ChangeLog:

* gm2-compiler/M2SymInit.mod (IsExempt): Remove parameter exemption.
(CheckIndrX): Call SetupLAlias between lhs and content.
(trashParam): Re-write.
(SetVarLRInitialized): Indicate shadow and heap are initialized.
Call SetupIndr between shadow and heap.
* gm2-compiler/P2SymBuild.mod: Import
PutProcedureParameterHeapVars.
(EndBuildProcedure): Call PutProcedureParameterHeapVars.
* gm2-compiler/SymbolTable.def (GetParameterHeapVar): New
procedure function.
(PutProcedureParameterHeapVars): New procedure function.
* gm2-compiler/SymbolTable.mod (MakeParameterHeapVar): New
procedure function.
(GetParameterHeapVar): New procedure function.
(PuttParameterHeapVar): New procedure function.
(PutProcedureParameterHeapVars): New procedure.
(VarParam): HeapVar new record field.
(PutVarParam): HeapVar assigned to NulSym.

gcc/testsuite/ChangeLog:

* gm2/switches/uninit-variable-checking/procedures/fail/testdispose3.mod: New test.
* gm2/switches/uninit-variable-checking/procedures/fail/testdispose4.mod: New test.
* gm2/switches/uninit-variable-checking/procedures/pass/testdispose3.mod: New test.
* gm2/switches/uninit-variable-checking/procedures/pass/testdispose4.mod: New test.

(cherry picked from commit 083e7857a9ebf187b9116c74f6acf161f593bad9)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
15 months agoFortran: do not pass hidden character length for TYPE(*) dummy [PR110825]
Harald Anlauf [Thu, 27 Jul 2023 19:30:26 +0000 (21:30 +0200)]
Fortran: do not pass hidden character length for TYPE(*) dummy [PR110825]

gcc/fortran/ChangeLog:

PR fortran/110825
* gfortran.texi: Clarify argument passing convention.
* trans-expr.cc (gfc_conv_procedure_call): Do not pass the character
length as hidden argument when the declared dummy argument is
assumed-type.

gcc/testsuite/ChangeLog:

PR fortran/110825
* gfortran.dg/assumed_type_18.f90: New test.

(cherry picked from commit 02f4ca0df2d69b922a622e7cc9b396cf686d5a0f)

15 months agomodula2: Location improvement and bugfix when issuing parameter errors
Gaius Mulley [Sun, 30 Jul 2023 13:36:01 +0000 (14:36 +0100)]
modula2: Location improvement and bugfix when issuing parameter errors

This patch improves the accuracy of error messages mentioning a
parameter in M2Quads.mod (when handling builtins).  The error location
now points to the parameter rather than the function or procedure.

gcc/m2/ChangeLog:

* gm2-compiler/M2Quads.mod (BuildDifAdrFunction): Removed
unnecessary in error message.  Use vartok for location.
(BuildOddFunction): Use optok for location.
(BuildAbsFunction): Use vartok for location.  Bugfix set vartok.
(BuildCapFunction): Use optok for location.
(BuildOrdFunction): Use optok for location and correct format
specifier.
(BuildShiftFunction): Use vartok for location.
(BuildRotateFunction): Use vartok for location.
(BuildTruncFunction): Use vartok for location.
(BuildFloatFunction): Use vartok for location.
(BuildReFunction): Use vartok for location.
(BuildImFunction): Use vartok for location.
* gm2-compiler/M2SymInit.mod (trashParam): Remove commented code.

gcc/testsuite/ChangeLog:

* gm2/errors/fail/badabs.mod: New test.
* gm2/errors/fail/badenum.mod: New test.

(cherry picked from commit 029c7ebe7f4f9ea37d715dbc2da36687d8657c2c)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
15 months agoFortran: Seg fault passing string to type cptr dummy [PR108961].
Paul Thomas [Sun, 30 Jul 2023 12:25:19 +0000 (13:25 +0100)]
Fortran: Seg fault passing string to type cptr dummy [PR108961].

2023-07-30  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
PR fortran/108961
* trans-expr.cc (gfc_conv_procedure_call): The hidden string
length must not be passed to a formal arg of type(cptr).

gcc/testsuite/
PR fortran/108961
* gfortran.dg/pr108961.f90: New test.

15 months agomodula2: Variable analysis understands DISPOSE and NIL
Gaius Mulley [Sun, 30 Jul 2023 11:34:38 +0000 (12:34 +0100)]
modula2: Variable analysis understands DISPOSE and NIL

This patch allows the uninitialized variable analysis to detect pointer
through NIL and incorrectly reusing a pointer after a call to DISPOSE.

gcc/m2/ChangeLog:

* gm2-compiler/M2Quads.mod (BuildRealFuncProcCall): Set the trash
parameter value to NIL if DEALLOCATE is detected.
* gm2-compiler/M2SymInit.mod (CheckDeferredRecordAccess): Pass
tok to SetVarInitialized.  Pass tok to GetVarComponentInitialized.
(ComponentFindVar): Add tok parameter.  Check aliased pointer
against Nil and generate warning if necessary.
(deRefComponent): Add tok and sym parameters and pass them to
getContent.
(SetVarComponentInitialized): Add tok parameter.  Pass tok to
ComponentFindVar.  Pass tok and sym to deRefComponent.
(GetVarComponentInitialized): Add tok parameter.  Pass tok to
ComponentFindVar.  Pass tok to deRefComponent.
(SetVarInitialized): Add tok parameter.  Pass tok to
SetVarComponentInitialized.
(doGetVarInitialized): Add tok parameter.  Pass tok to
GetVarComponentInitialized.
(CheckXIndr): Pass lhs and lhstok to getContent.
(CheckIndrX): Pass rhs and rhstok to getContent.
(CheckBecomes): Pass destok to ComponentFindVar.  Pass des and
destok to deRefComponent.
(CheckAddr): Pass contenttok to GetVarInitialized.  Pass ptrtok
to SetVarInitialized.
(CheckReadBeforeInitQuad): Pass op1tok to SetVarInitialized for
op1 cases and op3tok for op3 cases.
(trashParam): Get operand tokens.  Pass op3tok to
SetVarInitialized.  Pass op3 and op3tok to getContent.
Alias ptr to NIL if procedure is DEALLOCATE.  Pass op3tok to
SetVarInitialized.
(IsDeallocate): New procedure function.
(DetectTrash): Use IsDeallocate.
(SetupLAlias): Allow exp to be Nil.
(getContent): Generate warning message if ptr is Nil.

gcc/testsuite/ChangeLog:

* gm2/switches/uninit-variable-checking/procedures/fail/testdispose.mod: New test.
* gm2/switches/uninit-variable-checking/procedures/fail/testdispose2.mod: New test.
* gm2/switches/uninit-variable-checking/procedures/fail/testnil.mod: New test.

(cherry picked from commit e029635cb72e6db72f1826b6b43fa4b299b2145f)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
15 months agomodula2: Uninitialized variable static analysis improvements
Gaius Mulley [Sun, 30 Jul 2023 10:00:24 +0000 (11:00 +0100)]
modula2: Uninitialized variable static analysis improvements

This patch fixes many limitations of the uninitialized static analysis.
NEW is understood, local variable pointers and non var parameters
will be tracked.

gcc/ChangeLog:

* doc/gm2.texi (Semantic checking): Change example testwithptr
to testnew6.

gcc/m2/ChangeLog:

* Make-lang.in: Minor formatting change.
* gm2-compiler/M2GCCDeclare.mod
(DeclareUnboundedProcedureParameters): Rename local variables.
(WalkUnboundedProcedureParameters): Rename local variables.
(DoVariableDeclaration): Avoid declaration of a variable if
it is on the heap (used by static analysis only).
* gm2-compiler/M2GenGCC.mod: Formatting.
* gm2-compiler/M2Quads.def (GetQuadTrash): New procedure function.
* gm2-compiler/M2Quads.mod (GetQuadTrash): New procedure function.
(QuadFrame): Add Trash field.
(BuildRealFuncProcCall): Detect ALLOCATE and DEALLOCATE and create
a heap variable for parameter 1 saving it as the trashed variable
for static analysis.
(GenQuadOTrash): New procedure.
(DisplayQuadRange): Bugfix.  Write the scope number.
* gm2-compiler/M2SymInit.mod: Rewritten to separate LValue
equivalence from LValue to RValue pairings.  Comprehensive
detection of variant record implemented.  Allow dereferencing
of pointers through LValue/RValue chains.
* gm2-compiler/SymbolTable.def (PutVarHeap): New procedure.
(IsVarHeap): New procedure function.
(ForeachParamSymDo): New procedure.
* gm2-compiler/SymbolTable.mod (PutVarHeap): New procedure.
(IsVarHeap): New procedure function.
(ForeachParamSymDo): New procedure.
(MakeVariableForParam): Reformatted.
(CheckForUnknownInModule): Reformatted.
(SymVar): Add field Heap.
(MakeVar): Assign Heap to FALSE.

gcc/testsuite/ChangeLog:

* gm2/switches/uninit-variable-checking/pass/assignparam.mod: New test.
* gm2/switches/uninit-variable-checking/pass/tiny.mod: New test.
* gm2/switches/uninit-variable-checking/procedures/fail/switches-uninit-variable-checking-procedures-fail.exp:
New test.
* gm2/switches/uninit-variable-checking/procedures/fail/testnew.mod: New test.
* gm2/switches/uninit-variable-checking/procedures/fail/testnew2.mod: New test.
* gm2/switches/uninit-variable-checking/procedures/fail/testnew3.mod: New test.
* gm2/switches/uninit-variable-checking/procedures/fail/testnew4.mod: New test.
* gm2/switches/uninit-variable-checking/procedures/fail/testnew5.mod: New test.
* gm2/switches/uninit-variable-checking/procedures/fail/testnew6.mod: New test.
* gm2/switches/uninit-variable-checking/procedures/fail/testptrptr.mod: New test.
* gm2/switches/uninit-variable-checking/procedures/pass/assignparam2.mod: New test.
* gm2/switches/uninit-variable-checking/procedures/pass/switches-uninit-variable-checking-procedures-pass.exp:
New test.
* gm2/switches/uninit-variable-checking/procedures/pass/testnew5.mod: New test.
* gm2/switches/uninit-variable-checking/procedures/pass/testnew6.mod: New test.
* gm2/switches/uninit-variable-checking/procedures/pass/testparamlvalue.mod: New test.
* gm2/switches/uninit-variable-checking/procedures/pass/testparamrvalue.mod: New test.
* gm2/switches/uninit-variable-checking/procedures/pass/testproc.mod: New test.
* gm2/switches/uninit-variable-checking/procedures/pass/testptrptr.mod: New test.

(cherry picked from commit b80e3c468e373cc6fd4e41a5879dbca95a40ac8c)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
15 months agomodula2: Improve uninitialized variable analysis by combining basic blocks
Gaius Mulley [Sun, 30 Jul 2023 02:55:30 +0000 (03:55 +0100)]
modula2: Improve uninitialized variable analysis by combining basic blocks

This patch combines basic blocks for static analysis of uninitialized
variables providing that they are not the top of a loop, are not reached
by a conditional and are not reached after a procedure call.  It also
avoids checking array accesses for static analysis.  Finally the patch
adds switch modifiers to allow static analysis to include conditional
branches for subsequent basic block analysis.

gcc/ChangeLog:

* doc/gm2.texi (-Wuninit-variable-checking=) New item.

gcc/m2/ChangeLog:

* gm2-compiler/M2BasicBlock.def (InitBasicBlocksFromRange): New
parameter ScopeSym.
* gm2-compiler/M2BasicBlock.mod (ConvertQuads2BasicBlock): New
parameter ScopeSym.
(InitBasicBlocksFromRange): New parameter ScopeSym.  Call
ConvertQuads2BasicBlock with ScopeSym.
(DisplayBasicBlocks): Uncomment.
* gm2-compiler/M2Code.mod: Replace VariableAnalysis with
ScopeBlockVariableAnalysis.
(InitialDeclareAndOptiomize): Add parameter scope.
(SecondDeclareAndOptimize): Add parameter scope.
* gm2-compiler/M2GCCDeclare.mod (DeclareConstructor): Add scope
parameter to DeclareTypesConstantsProceduresInRange.
(DeclareTypesConstantsProceduresInRange): New parameter scope.
Pass scope to DisplayQuadRange.  Reformatted.
* gm2-compiler/M2GenGCC.def (ConvertQuadsToTree): New parameter
scope.
* gm2-compiler/M2GenGCC.mod (ConvertQuadsToTree): New parameter
scope.
* gm2-compiler/M2Optimize.mod (KnownReachable): New parameter
scope.
* gm2-compiler/M2Options.def (SetUninitVariableChecking): Add
arg parameter.
* gm2-compiler/M2Options.mod (SetUninitVariableChecking): Add
arg parameter and set boolean UninitVariableChecking and
UninitVariableConditionalChecking.
(UninitVariableConditionalChecking): New boolean set to FALSE.
* gm2-compiler/M2Quads.def (IsGoto): New procedure function.
(DisplayQuadRange): Add scope parameter.
(LoopAnalysis): Add scope parameter.
* gm2-compiler/M2Quads.mod: Import PutVarArrayRef.
(IsGoto): New procedure function.
(LoopAnalysis): Add scope parameter and use MetaErrorT1 instead
of WarnStringAt.
(BuildStaticArray): Call PutVarArrayRef.
(BuildDynamicArray): Call PutVarArrayRef.
(DisplayQuadRange): Add scope parameter.
(GetM2OperatorDesc): Add relational condition cases.
* gm2-compiler/M2Scope.def (ScopeProcedure): Add parameter.
* gm2-compiler/M2Scope.mod (DisplayScope): Pass scopeSym to
DisplayQuadRange.
(ForeachScopeBlockDo): Pass scopeSym to p.
* gm2-compiler/M2SymInit.def (VariableAnalysis): Rename to ...
(ScopeBlockVariableAnalysis): ... this.
* gm2-compiler/M2SymInit.mod (ScopeBlockVariableAnalysis): Add
scope parameter.
(bbEntry): New pointer to record.
(bbArray): New array.
(bbFreeList): New variable.
(errorList): New list.
(IssueConditional): New procedure.
(GenerateNoteFlow): New procedure.
(IssueWarning): New procedure.
(IsUniqueWarning): New procedure.
(CheckDeferredRecordAccess): Re-implement.
(CheckBinary): Add warning and lst parameters.
(CheckUnary): Add warning and lst parameters.
(CheckXIndr): Add warning and lst parameters.
(CheckIndrX): Add warning and lst parameters.
(CheckBecomes): Add warning and lst parameters.
(CheckComparison): Add warning and lst parameters.
(CheckReadBeforeInitQuad): Add warning and lst parameters to all
Check procedures.  Add all case quadruple clauses.
(FilterCheckReadBeforeInitQuad): Add warning and lst parameters.
(CheckReadBeforeInitFirstBasicBlock): Add warning and lst parameters.
(bbArrayKill): New procedure.
(DumpBBEntry): New procedure.
(DumpBBArray): New procedure.
(DumpBBSequence): New procedure.
(TestBBSequence): New procedure.
(CreateBBPermultations): New procedure.
(ScopeBlockVariableAnalysis): New procedure.
(GetOp3): New procedure.
(GenerateCFG): New procedure.
(NewEntry): New procedure.
(AppendEntry): New procedure.
(init): Initialize bbFreeList and errorList.
* gm2-compiler/SymbolTable.def (PutVarArrayRef): New procedure.
(IsVarArrayRef): New procedure function.
* gm2-compiler/SymbolTable.mod (SymVar): ArrayRef new field.
(MakeVar): Set ArrayRef to FALSE.
(PutVarArrayRef): New procedure.
(IsVarArrayRef): New procedure function.
* gm2-gcc/init.cc (_M2_M2SymInit_init): New prototype.
(init_PerCompilationInit): Add call to _M2_M2SymInit_init.
* gm2-gcc/m2options.h (M2Options_SetUninitVariableChecking):
New definition.
* gm2-lang.cc (gm2_langhook_handle_option): Add new case
OPT_Wuninit_variable_checking_.
* lang.opt: Wuninit-variable-checking= new entry.

gcc/testsuite/ChangeLog:

* gm2/switches/uninit-variable-checking/cascade/fail/cascadedif.mod: New test.
* gm2/switches/uninit-variable-checking/cascade/fail/switches-uninit-variable-checking-cascade-fail.exp:
New test.

(cherry picked from commit 40b91158c373fb17e26c161ddb453792e8746678)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
15 months agoPR modula2/110125 variables reported as uninitialized when set inside WITH
Gaius Mulley [Sun, 30 Jul 2023 01:18:57 +0000 (02:18 +0100)]
PR modula2/110125 variables reported as uninitialized when set inside WITH

The modula-2 static analysis incorrectly identifies variables as
uninitialized if they are initialized within a WITH statement.  This bug
fix re-implements the variable static analysis and will detect simple
pointer record fields being accessed before being initialized.
The static analysis is limited to the first basic block in a procedure.
It does not check variant records, arrays or sets.  A new option
-Wuninit-variable-checking will turn on the new semantic checking
(-Wall also enables the new checking).

gcc/ChangeLog:

PR modula2/110125
* doc/gm2.texi (Semantic checking): Include examples using
-Wuninit-variable-checking.

gcc/m2/ChangeLog:

PR modula2/110125
* Make-lang.in (GM2-COMP-BOOT-DEFS): Add M2SymInit.def.
(GM2-COMP-BOOT-MODS): Add M2SymInit.mod.
* gm2-compiler/M2BasicBlock.mod: Formatting changes.
* gm2-compiler/M2Code.mod: Remove import of VariableAnalysis from
M2Quads.  Import VariableAnalysis from M2SymInit.mod.
* gm2-compiler/M2GCCDeclare.mod (PrintVerboseFromList):
Add debugging print for a component.
(TypeConstFullyDeclared): Call RememberType for every type.
* gm2-compiler/M2GenGCC.mod (CodeReturnValue): Add parameter to
GetQuadOtok.
(CodeBecomes): Add parameter to GetQuadOtok.
(CodeXIndr): Add parameter to GetQuadOtok.
* gm2-compiler/M2Optimize.mod (ReduceBranch): Reformat and
preserve operand token positions when reducing the branch
quadruples.
(ReduceGoto): Reformat.
(FoldMultipleGoto): Reformat.
(KnownReachable): Reformat.
* gm2-compiler/M2Options.def (UninitVariableChecking): New
variable declared and exported.
(SetUninitVariableChecking): New procedure.
* gm2-compiler/M2Options.mod (SetWall): Set
UninitVariableChecking.
(SetUninitVariableChecking): New procedure.
* gm2-compiler/M2Quads.def (PutQuadOtok): Exported and declared.
(VariableAnalysis): Removed.
* gm2-compiler/M2Quads.mod (PutQuadOtok): New procedure.
(doVal): Reformatted.
(MarkAsWrite): Reformatted.
(MarkArrayAsWritten): Reformatted.
(doIndrX): Use PutQuadOtok.
(MakeRightValue): Use GenQuadOtok.
(MakeLeftValue): Use GenQuadOtok.
(CheckReadBeforeInitialized): Remove.
(IsNeverAltered): Reformat.
(DebugLocation): New procedure.
(BuildDesignatorPointer): Use GenQuadO to preserve operand token
position.
(BuildRelOp): Use GenQuadOtok ditto.
* gm2-compiler/SymbolTable.def (VarCheckReadInit): New procedure.
(VarInitState): New procedure.
(PutVarInitialized): New procedure.
(PutVarFieldInitialized): New procedure function.
(GetVarFieldInitialized): New procedure function.
(PrintInitialized): New procedure.
* gm2-compiler/SymbolTable.mod (VarCheckReadInit): New procedure.
(VarInitState): New procedure.
(PutVarInitialized): New procedure.
(PutVarFieldInitialized): New procedure function.
(GetVarFieldInitialized): New procedure function.
(PrintInitialized): New procedure.
(LRInitDesc): New type.
(SymVar): InitState new field.
(MakeVar): Initialize InitState.
* gm2-gcc/m2options.h (M2Options_SetUninitVariableChecking):
New function declaration.
* gm2-lang.cc (gm2_langhook_handle_option): Detect
OPT_Wuninit_variable_checking and call SetUninitVariableChecking.
* lang.opt: Add Wuninit-variable-checking.
* gm2-compiler/M2SymInit.def: New file.
* gm2-compiler/M2SymInit.mod: New file.

gcc/testsuite/ChangeLog:

PR modula2/110125
* gm2/switches/uninit-variable-checking/fail/testinit.mod: New test.
* gm2/switches/uninit-variable-checking/fail/testlarge.mod: New test.
* gm2/switches/uninit-variable-checking/fail/testlarge2.mod: New test.
* gm2/switches/uninit-variable-checking/fail/testrecinit.mod: New test.
* gm2/switches/uninit-variable-checking/fail/testrecinit2.mod: New test.
* gm2/switches/uninit-variable-checking/fail/testrecinit5.mod: New test.
* gm2/switches/uninit-variable-checking/fail/testsmallrec.mod: New test.
* gm2/switches/uninit-variable-checking/fail/testsmallrec2.mod: New test.
* gm2/switches/uninit-variable-checking/fail/testsmallvec.mod: New test.
* gm2/switches/uninit-variable-checking/fail/testvarinit.mod: New test.
* gm2/switches/uninit-variable-checking/fail/testwithnoptr.mod: New test.
* gm2/switches/uninit-variable-checking/fail/testwithptr.mod: New test.
* gm2/switches/uninit-variable-checking/fail/testwithptr2.mod: New test.
* gm2/switches/uninit-variable-checking/fail/testwithptr3.mod: New test.
* gm2/switches/uninit-variable-checking/pass/testrecinit3.mod: New test.
* gm2/switches/uninit-variable-checking/pass/testrecinit5.mod: New test.
* gm2/switches/uninit-variable-checking/pass/testsmallrec.mod: New test.
* gm2/switches/uninit-variable-checking/pass/testsmallrec2.mod: New test.
* gm2/switches/uninit-variable-checking/pass/testvarinit.mod: New test.
* gm2/switches/uninit-variable-checking/pass/testwithptr.mod: New test.
* gm2/switches/uninit-variable-checking/pass/testwithptr2.mod: New test.
* gm2/switches/uninit-variable-checking/pass/testwithptr3.mod: New test.

(cherry picked from commit b0762d4c7e7894845e70e839c8513ae4c9e9d42e)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
15 months agoDaily bump.
GCC Administrator [Sun, 30 Jul 2023 00:20:32 +0000 (00:20 +0000)]
Daily bump.

15 months agomodula2: Fixes to the error format specifications
Gaius Mulley [Sat, 29 Jul 2023 23:24:06 +0000 (00:24 +0100)]
modula2: Fixes to the error format specifications

This patch contains a python3 script to check the meta format error
specifications.  It also includes about 20 fixes to M2Quads.mod format
specifications.

gcc/m2/ChangeLog:

* Make-lang.in (check-format-error): New rule.
* gm2-compiler/M2MetaError.mod (op): Add calls InternalError if
digits are detected.
* gm2-compiler/M2Quads.mod (BuildForToByDo): Bugfix to format
specifier.
(BuildLengthFunction): Bugfix to format specifiers.
(BuildOddFunction): Bugfix to format specifiers.
(BuildAbsFunction): Bugfix to format specifiers.
(BuildCapFunction): Bugfix to format specifiers.
(BuildChrFunction): Bugfix to format specifiers.
(BuildOrdFunction): Bugfix to format specifiers.
(BuildMakeAdrFunction): Bugfix to format specifiers.
(BuildSizeFunction): Bugfix to format specifiers.
(BuildBitSizeFunction): Bugfix to format specifiers.
* tools-src/checkmeta.py: New file.

(cherry picked from commit c980eeb88f897e0c3cc2ed40577b22d8032480a9)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
15 months agoPR modula2/110189 Using an unknown TYPE as argument to VAL gives ICE
Gaius Mulley [Sat, 29 Jul 2023 21:41:13 +0000 (22:41 +0100)]
PR modula2/110189 Using an unknown TYPE as argument to VAL gives ICE

This patch tidies P3Build.bnf and fixes error format specs in
M2Quads.mod when encountering unknown symbols.

gcc/m2/ChangeLog:

PR modula2/110189
* gm2-compiler/M2Quads.mod (BuildAbsFunction): Replace abort
format specifier.
(BuildValFunction): Replace abort format specifier.
(BuildCastFunction): Replace abort format specifier.
(BuildMinFunction): Replace abort format specifier.
(BuildMaxFunction): Replace abort format specifier.
(BuildTruncFunction): Replace abort format specifier.
* gm2-compiler/P3Build.bnf (Pass1): Remove.
(Pass2): Remove.
(Pass3): Remove.
(Expect): Add Pass1.
(AsmStatement): Remove Pass3.
(AsmOperands): Remove Pass3.
(AsmOperandSpec): Remove Pass3.
(AsmInputElement): Remove Pass3.
(AsmOutputElement): Remove Pass3.
(AsmTrashList): Remove Pass3.

gcc/testsuite/ChangeLog:

PR modula2/110189
* gm2/pim/fail/foovaltype.mod: New test.

(cherry picked from commit 8089f26b94f47d9923d3bc0c05aae09363983b2e)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
15 months agoPR modula2/110126 variables are reported as unused when referenced by ASM fix
Gaius Mulley [Sat, 29 Jul 2023 20:04:26 +0000 (21:04 +0100)]
PR modula2/110126 variables are reported as unused when referenced by ASM fix

This patch fixes the trash list of the asm statement.  It introduces a
separate build procedure for trashed elements.

gcc/m2/ChangeLog:

PR modula2/110126
* gm2-compiler/M2Quads.def (BuildAsmElement): Remove
trash parameter.
(BuildAsmTrash): New procedure.
* gm2-compiler/M2Quads.mod (BuildAsmTrash): New procedure.
(BuildAsmElement): Remove trash parameter.
* gm2-compiler/P3Build.bnf (AsmTrashList): Rewrite.

(cherry picked from commit bf470895905e9152424076d1630a9d2c60de023b)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
15 months agoPR modula2/109952 Fix oversight in latest change
Gaius Mulley [Sat, 29 Jul 2023 16:33:28 +0000 (17:33 +0100)]
PR modula2/109952 Fix oversight in latest change

gcc/
PR modula2/109952
* doc/gm2.texi (Standard procedures): Fix Next link.

(cherry picked from commit e8d41e031b9f52601249ec7e4c4215b851cc8ffe)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
15 months agoPR modula2/110126 variables are reported as unused when referenced by ASM
Gaius Mulley [Sat, 29 Jul 2023 16:24:38 +0000 (17:24 +0100)]
PR modula2/110126 variables are reported as unused when referenced by ASM

This patches fixes two problems with the asm statement.
gm2 -Wall -c fooasm3.mod generates an incorrect warning and
gm2 cannot concatenate strings before an ASM statement.
The asm statement now accepts a constant expression (rather than
a string) and it updates the variable read/write use lists as
appropriate.

gcc/m2/ChangeLog:

PR modula2/110126
* gm2-compiler/M2GenGCC.mod (BuildTreeFromInterface): Remove
tokenno parameter.  Use object tok instead of tokenno.
(BuildTrashTreeFromInterface): Use object tok instead of
GetDeclaredMod.
(CodeInline): Remove tokenno from parameter list to BuildTreeFromInterface.
* gm2-compiler/M2Quads.def (BuildAsmElement): Exported and
defined.
* gm2-compiler/M2Quads.mod (BuildOptimizeOff): Reformatted.
(BuildInline): Reformatted.
(BuildLineNo): Reformatted.
(UseLineNote): Reformatted.
(BuildAsmElement): New procedure.
* gm2-compiler/P0SyntaxCheck.bnf (AsmOperands): Use
ConstExpression instead of string.
(AsmElement): Use ConstExpression instead of string.
(TrashList): Use ConstExpression instead of string.
* gm2-compiler/P1Build.bnf (AsmOperands): Use
ConstExpression instead of string.
(AsmElement): Use ConstExpression instead of string.
(TrashList): Use ConstExpression instead of string.
* gm2-compiler/P2Build.bnf (AsmOperands): Use
ConstExpression instead of string.
(AsmElement): Use ConstExpression instead of string.
(TrashList): Use ConstExpression instead of string.
* gm2-compiler/P3Build.bnf (AsmOperands): Rewrite.
(AsmOperandSpec): Rewrite.
(AsmOutputList): New rule.
(AsmInputList): New rule.
(TrashList): Rewrite.
* gm2-compiler/PCBuild.bnf (AsmOperands): Use
ConstExpression instead of string.
(AsmElement): Use ConstExpression instead of string.
(TrashList): Use ConstExpression instead of string.
* gm2-compiler/PHBuild.bnf (AsmOperands): Use
ConstExpression instead of string.
(AsmElement): Use ConstExpression instead of string.
(TrashList): Use ConstExpression instead of string.
* gm2-compiler/SymbolTable.def (PutRegInterface):
Rewrite interface.
(GetRegInterface): Rewrite interface.
* gm2-compiler/SymbolTable.mod (SetFirstUsed): New procedure.
(PutFirstUsed): New procedure.
(PutRegInterface): Rewrite.
(GetRegInterface): Rewrite.

gcc/testsuite/ChangeLog:

PR modula2/110126
* gm2/pim/pass/fooasm3.mod: New test.

(cherry picked from commit 990d10ab23360fef8b5eb6937ac10b4f67f46e2d)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
15 months agoPR modula2/110019 Reported line numbers off by 1 when cpp invoked.
Gaius Mulley [Sat, 29 Jul 2023 14:16:08 +0000 (15:16 +0100)]
PR modula2/110019 Reported line numbers off by 1 when cpp invoked.

Fix off by one in m2.flex when the line number is set via cpp.

gcc/m2/ChangeLog:

PR modula2/110019
* gm2-compiler/SymbolKey.mod (SearchAndDo): Reformatted.
(ForeachNodeDo): Reformatted.
* gm2-compiler/SymbolTable.mod (AddListify): Join list
with "," or "and" if more than one word is in the list.
* m2.flex: Remove -1 from atoi(yytext) line number.

gcc/testsuite/ChangeLog:

PR modula2/110019
* gm2/cpp/fail/cpp-fail.exp: New test.
* gm2/cpp/fail/foocpp.mod: New test.

(cherry picked from commit 29c82c6ca929e0f5eccfe038dea71177d814c6b7)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
15 months agoChange fma_reassoc_width tuning for ampere1
Di Zhao OS [Thu, 22 Jun 2023 14:16:57 +0000 (15:16 +0100)]
Change fma_reassoc_width tuning for ampere1

This patch enables reassociation of floating-point additions on ampere1.
This brings about 1% overall benefit on spec2017 fprate cases. (There
are minor regressions in 510.parest_r and 508.namd_r, analyzed here:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110279 .)

gcc/ChangeLog:

* config/aarch64/aarch64.cc: Change fma_reassoc_width for ampere1.

15 months agoPR modula2/110003 Wrong source line listed for unused parameters
Gaius Mulley [Sat, 29 Jul 2023 12:48:22 +0000 (13:48 +0100)]
PR modula2/110003 Wrong source line listed for unused parameters

Ensure that the parameter token position is recorded for both
definition and implementation modules.  The shadow variable
is created inside BuildFormalParameterSection.  The shadow
variable needs to have the other definition or implementation module
token position set when CheckFormalParameterSection is called.
This allows the MetaError family of procedures to request the
implementation module token position when reporting unused parameters.

gcc/m2/ChangeLog:

PR modula2/110003
* gm2-compiler/P2SymBuild.mod (GetParameterShadowVar): Import.
(CheckFormalParameterSection): Call PutDeclared for the shadow
variable associated with the parameter.

(cherry picked from commit 7c0e2159afb3235950d3d8f61ef085cd1ccf0dfc)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
15 months agoPR modula2/109952 Inconsistent HIGH values with 'ARRAY OF CHAR'
Gaius Mulley [Sat, 29 Jul 2023 03:13:34 +0000 (04:13 +0100)]
PR modula2/109952 Inconsistent HIGH values with 'ARRAY OF CHAR'

This patch fixes the case when a single character constant literal is
passed as a string actual parameter to an ARRAY OF CHAR formal parameter.
To be consistent a single character is promoted to a string and nul
terminated (and its high value is 1).  Previously a single character
string would not be nul terminated and the high value was 0.
The documentation now includes a section describing the expected behavior
and included in this patch is some regression test code matching the
table inside the documentation.

gcc/ChangeLog:

PR modula2/109952
* doc/gm2.texi (High procedure function): New node.
(Using): New menu entry for High procedure function.

gcc/m2/ChangeLog:

PR modula2/109952
* Make-maintainer.in: Change header to include emacs file mode.
* gm2-compiler/M2GenGCC.mod (BuildHighFromChar): Check whether
operand is a constant string and is nul terminated then return one.
* gm2-compiler/PCSymBuild.mod (WalkFunction): Add default return
TRUE.  Static analysis missing return path fix.
* gm2-libs/IO.mod (Init): Rewrite to help static analysis.
* target-independent/m2/gm2-libs.texi: Rebuild.

gcc/testsuite/ChangeLog:

PR modula2/109952
* gm2/pim/run/pass/hightests.mod: New test.

(cherry picked from commit b4df098647b687ca4e43952ec4a198b2816732ba)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
15 months agoPR modula2/109908 Delete from m2iso Strings is broken
Gaius Mulley [Sat, 29 Jul 2023 01:03:43 +0000 (02:03 +0100)]
PR modula2/109908 Delete from m2iso Strings is broken

This patch re-implements Strings.Delete and also supplies
some runtime test code.

gcc/m2/ChangeLog:

PR modula2/109908
* gm2-libs-iso/Strings.mod (Delete): Re-implement.

gcc/testsuite/ChangeLog:

PR modula2/109908
* gm2/isolib/run/pass/testdelete.mod: New test.

(cherry picked from commit 0a78bc26dadcb6f4c8b59b41858d70bb5432fadd)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
15 months agoDaily bump.
GCC Administrator [Sat, 29 Jul 2023 00:21:20 +0000 (00:21 +0000)]
Daily bump.

15 months agoPR modula2/109879 WholeIO.ReadCard and ReadInt should consume leading space
Gaius Mulley [Fri, 28 Jul 2023 23:27:22 +0000 (00:27 +0100)]
PR modula2/109879 WholeIO.ReadCard and ReadInt should consume leading space

The Read{TYPE} procedures in LongIO, LongWholeIO, RealIO, ShortWholeIO and
WholeIO all require skip space functionality.  A new module TextUtil
is supplied with this functionality and the previous modules have been
changed to call SkipSpaces.

gcc/m2/ChangeLog:

PR modula2/109879
* gm2-libs-iso/LongIO.mod (ReadReal): Call SkipSpaces.
* gm2-libs-iso/LongWholeIO.mod (ReadInt): Call SkipSpaces.
(ReadCard): Call SkipSpaces.
* gm2-libs-iso/RealIO.mod (ReadReal): Call SkipSpaces.
* gm2-libs-iso/ShortWholeIO.mod: (ReadInt): Call SkipSpaces.
(ReadCard): Call SkipSpaces.
* gm2-libs-iso/TextIO.mod: Import SkipSpaces.
* gm2-libs-iso/WholeIO.mod (ReadInt): Call SkipSpaces.
(ReadCard): Call SkipSpaces.
* gm2-libs-iso/TextUtil.def: New file.
* gm2-libs-iso/TextUtil.mod: New file.

libgm2/ChangeLog:

PR modula2/109879
* Makefile.in: Regenerate.
* aclocal.m4: Regenerate.
* libm2cor/Makefile.in: Regenerate.
* libm2iso/Makefile.am (M2DEFS): Add TextUtil.def.
(M2MODS): Add TextUtil.mod.
* libm2iso/Makefile.in: Regenerate.
* libm2log/Makefile.in: Regenerate.
* libm2min/Makefile.in: Regenerate.
* libm2pim/Makefile.in: Regenerate.

gcc/testsuite/ChangeLog:

PR modula2/109879
* gm2/isolib/run/pass/testreadint.mod: New test.

(cherry picked from commit 509eef9314b24eff20a5dbdd92f6ab52e2c0c786)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
15 months ago[PATCH] PR modula2/108344 disable default opening of /dev/tty
Gaius Mulley [Fri, 28 Jul 2023 21:50:41 +0000 (22:50 +0100)]
[PATCH] PR modula2/108344 disable default opening of /dev/tty

This patch changes removes the static initialisation code for
KeyBoardLEDs.cc.  The module is only initialised if one of the
exported functions is called.  This is useful as the module will
access /dev/tty which might not be available.  TimerHandler.mod has
also been changed to disable the scroll lock LED as a sign of life.

gcc/m2/ChangeLog:

PR modula2/108344
* gm2-libs-coroutines/TimerHandler.mod (EnableLED): New
constant.
(Timer): Test EnableLED before switching on the scroll LED.

libgm2/ChangeLog:

PR modula2/108344
* libm2cor/KeyBoardLEDs.cc (initialize_module): New
function.
(SwitchScroll): Call initialize_module.
(SwitchNum): Call initialize_module.
(SwitchCaps): Call initialize_module.
(SwitchLEDs): Call initialize_module.
(M2EXPORT): Remove initialization code.

(cherry picked from commit cf4dcfa6727b89362494bd49e2a28ebd10d767ce)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
15 months agoUpdate gcc .po files
Joseph Myers [Fri, 28 Jul 2023 20:11:47 +0000 (20:11 +0000)]
Update gcc .po files

* be.po, da.po, de.po, el.po, es.po, fi.po, fr.po, hr.po, id.po,
ja.po, nl.po, ru.po, sr.po, sv.po, tr.po, uk.po, vi.po, zh_CN.po,
zh_TW.po: Update.

15 months agoPR modula2/109830 m2iso library SeqFile.mod appending to a file overwrites content
Gaius Mulley [Fri, 28 Jul 2023 20:08:29 +0000 (21:08 +0100)]
PR modula2/109830 m2iso library SeqFile.mod appending to a file overwrites content

This patch is for the m2iso library SeqFile.mod to fix a bug when a
file is opened using OpenAppend.  The patch checks to see if the file
exists and it uses FIO.OpenForRandom to ensure the file is not
overwritten.

gcc/m2/ChangeLog:

PR modula2/109830
* gm2-libs-iso/SeqFile.mod (newCid): New parameter toAppend
used to select FIO.OpenForRandom.
(OpenRead): Pass extra parameter to newCid.
(OpenWrite): Pass extra parameter to newCid.
(OpenAppend): Pass extra parameter to newCid.

gcc/testsuite/ChangeLog:

PR modula2/109830
* gm2/isolib/run/pass/seqappend.mod: New test.

(cherry picked from commit 1953c0cfb006a696723baa7d5ea14038f6d901a4)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
15 months agoPR modula2/109810 ICE fix when an array is assigned by a larger string
Gaius Mulley [Fri, 28 Jul 2023 18:27:18 +0000 (19:27 +0100)]
PR modula2/109810 ICE fix when an array is assigned by a larger string

This patch fixes an ICE when an array variable is assigned with
a string which exceeds the array size.  It improves the accuracy
of the virtual token used to indicate the error message.

gcc/m2/ChangeLog:

PR modula2/109810
* gm2-compiler/M2ALU.mod (ConvertConstToType): Use
PrepareCopyString in place of DoCopyString.
* gm2-compiler/M2GenGCC.def (DoCopyString): Rename to ...
(PrepareCopyString): ... this.
* gm2-compiler/M2GenGCC.mod (CodeStatement): Call CodeReturnValue
with a single parameter.  Call CodeXIndr with a single parameter.
(CodeReturnValue): Remove parameters and replace with a single
quadno.  Reimplement using PrepareCopyString.  Issue error
if the string exceeds designator space.
(DoCopyString): Reimplement and rename to ...
(PrepareCopyString): ... this.
(CodeXIndr): Remove parameters and replace with a single
quadno.  Reimplement using PrepareCopyString.  Issue error
if the string exceeds designator space.
(CodeBecomes): Remove parameters and replace with a single
quadno.  Reimplement using PrepareCopyString.  Issue error
if the string exceeds designator space.
* gm2-compiler/M2Quads.def (BuildReturn): Rename parameter to
tokreturn.
* gm2-compiler/M2Quads.mod (BuildReturn): Rename parameter to
tokreturn.  Rename tokno to tokcombined.

gcc/testsuite/ChangeLog:

PR modula2/109810
* gm2/pim/fail/highice.mod: New test.

(cherry picked from commit c787f593e62869ae0b230949b4791f4f3a26e50e)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
15 months agolibstdc++: Fix formatting of negative chrono::hh_mm_ss
Jonathan Wakely [Wed, 19 Jul 2023 13:42:51 +0000 (14:42 +0100)]
libstdc++: Fix formatting of negative chrono::hh_mm_ss

When formatting with an empty chrono spec ("{}") two minus signs were
being added to hh_mm_ss values. This is because the __is_neg flag was
checked to add one explicitly, and then the ostream operator added
another one.

We should only check the __is_neg flag for durations, because those are
the only types which are modified to be non-negative before calling
_M_format. We don't change hh_mm_ss values to be negative, because that
would require performing arithmetic on the hh_mm_ss members to sum them,
and then again to construct a new hh_mm_ss object with the positive
value.  Instead, we can just be careful about using the __is_neg flag
correctly.

To fix the bug, _M_format_to_ostream no longer checks the __is_neg flag
for non-durations, and _M_format doesn't set it for hh_mm_ss until after
the call to _M_format_to_ostream. We can also avoid setting it for types
that it doesn't apply to, by making the __print_sign lambda only inspect
it for duration and hh_mm_ss types.

libstdc++-v3/ChangeLog:

* include/bits/chrono_io.h (__formatter_chrono::_M_format):
Do not set __is_neg for hh_mm_ss before calling
_M_format_to_ostream. Change __print_sign lambda to only check
__is_neg for durations and hh_mm_ss types.
(__formatter_chrono::_M_format_to_ostream): Only check __is_neg
for duration types.
* testsuite/std/time/hh_mm_ss/io.cc: Check negative values.

(cherry picked from commit 344f41322023cdbf4532b5278443a22a4f391627)

15 months agolibstdc++: Fix locale-specific duration formatting [PR110719]
Jonathan Wakely [Wed, 19 Jul 2023 13:38:08 +0000 (14:38 +0100)]
libstdc++: Fix locale-specific duration formatting [PR110719]

The r14-2640-gf4bce119f617dc commit only removed fractional seconds for
time points, but it needs to be done for durations and hh_mm_ss types
too.

libstdc++-v3/ChangeLog:

PR libstdc++/110719
* include/bits/chrono_io.h (__formatter_chrono::_S_floor_seconds):
Handle duration and hh_mm_ss.
* testsuite/20_util/duration/io.cc: Check locale-specific
formats.
* testsuite/std/time/hh_mm_ss/io.cc: Likewise.

(cherry picked from commit 86b36e9f7e3839e923db2fda4962cd3faf2ea47b)

15 months agolibstdc++: Implement correct locale-specific chrono formatting [PR110719]
Jonathan Wakely [Tue, 18 Jul 2023 11:46:07 +0000 (12:46 +0100)]
libstdc++: Implement correct locale-specific chrono formatting [PR110719]

This fixes some TODOs in the C++20 <chrono> format support, where the
locale-specific output was incorrect or unimplemented. The approach
taken here is to either use the formatting locale's std::time_put facet
to do the formatting, or to remove subsecond precision from time points
so that locale-specific formats don't print fractional seconds. This
ensures that we are consistent with what the std::time_put facet would
print (which never includes fractional seconds) even if we actually
reimplement the formatting by hand instead of using the facet.

This also fixes a misplaced statement that allowed modifiers for %Z
which should have been on %z instead. There was also some ill-formed
code in an untested branch for formatting time zone names to wide
characters. A new test for zoned_time I/O has been added to exercise
that code properly.

libstdc++-v3/ChangeLog:

PR libstdc++/110719
* include/bits/chrono_io.h (__formatter_chrono::_M_parse): Fix
allowed modifiers for %z and %Z. Fix -Wparentheses and
-Wnarrowing warnings.
(__formatter_chrono::_M_format): Call new functions for %d, %e,
%H, %I, %m and %M.
(__formatter_chrono::_M_c): Use _S_floor_seconds to remove
subsecond precision.
(__formatter_chrono::_M_C_y_Y): Use _M_locale_fmt to handle
modifiers.
(__formatter_chrono::_M_e): Replace with _M_d_e and use
_M_locale_fmt.
(__formatter_chrono::_M_I): Replace with _M_H_I and use
_M_locale_fmt.
(__formatter_chrono::_M_m): New function.
(__formatter_chrono::_M_M): New function.
(__formatter_chrono::_M_r): Use _M_locale_fmt.
(__formatter_chrono::_M_S): Likewise.
(__formatter_chrono::_M_u_w): Likewise.
(__formatter_chrono::_M_U_V_W): Likewise.
(__formatter_chrono::_M_X): Use _S_floor_seconds.
(__formatter_chrono::_M_Z): Fix untested branch for wchar_t.
(__formatter_chrono::_S_altnum): Remove function.
(__formatter_chrono::_S_dd_zero_fill): Remove function.
(__formatter_chrono::_S_floor_seconds): New function.
(__formatter_chrono::_M_locale_fmt): New function.
* testsuite/std/time/clock/system/io.cc: Adjust expected output
for locale-specific formats and check modified formats.
* testsuite/std/time/clock/utc/io.cc: Likewise.
* testsuite/std/time/zoned_time/io.cc: New test.

(cherry picked from commit f4bce119f617dc4663fb43f55784908daf16b4b6)

15 months agolibstdc++: Check for multiple modifiers in chrono format string [PR110708]
Jonathan Wakely [Tue, 18 Jul 2023 09:36:37 +0000 (10:36 +0100)]
libstdc++: Check for multiple modifiers in chrono format string [PR110708]

The logic for handling modified chrono specs like %Ey was just
restarting the loop after each modifier, and not checking whether we'd
already seen a modifier.

libstdc++-v3/ChangeLog:

PR libstdc++/110708
* include/bits/chrono_io.h (__formatter_chrono::_M_parse): Only
allow a single modifier.
* testsuite/std/time/format.cc: Check multiple modifiers.

(cherry picked from commit 52bfec7ea0eb0f1a4c5bfa55b0d6b9b6c8808e26)

15 months agolibstdc++: Avoid warning in std::format
Jonathan Wakely [Tue, 18 Jul 2023 21:14:32 +0000 (22:14 +0100)]
libstdc++: Avoid warning in std::format

With -Wmaybe-uninitialized -Wsystem-headers there's a warning about
creating a string_view from an uninitalized array. Initializing the
first element of the array avoids the warning.

libstdc++-v3/ChangeLog:

* include/std/format (__write_padded): Initialize first element
of array to avoid a -Wmaybe-uninitialized warning.

(cherry picked from commit 2af0f4c34667efe9924fa4e3aa7b9a87617e5ccd)

15 months agolibstdc++: Check for std::ratio in arithmetic and comparisons [PR110593]
Jonathan Wakely [Wed, 19 Jul 2023 17:18:46 +0000 (18:18 +0100)]
libstdc++: Check for std::ratio in arithmetic and comparisons [PR110593]

The standard says that it should be ill-formed to use std::ratio_equal
etc. with types which are not specializations of std::ratio. This
implements that requirement.

We don't need to add assertions to every one of the class templates,
because many of them are implemented in terms of other ones. For
example, ratio_divide and ratio_subtract can rely on the assertions in
ratio_multiply and ratio_add respectively.

libstdc++-v3/ChangeLog:

PR libstdc++/110593
* include/bits/chrono.h (duration): Improve static assert
messages.
(__is_ratio): Move to ...
* include/std/ratio (__is_ratio): ... here.
(__is_ratio_v): New variable template and partial
specialization.
(__are_both_ratios): New function template.
(__ratio_multiply, ratio_equal, ratio_less, __ratio_add):
Add static assertion.
* testsuite/20_util/ratio/requirements/type_constraints.cc:
New test.
* testsuite/20_util/duration/requirements/typedefs_neg1.cc:
Adjust expected error.
* testsuite/20_util/duration/requirements/typedefs_neg2.cc:
Likewise.

(cherry picked from commit 2d614822e9ea2a3d8800045d66e3220743753d09)

15 months agolibstdc++: Add missing constexpr specifiers in <format>
Deev Patel [Mon, 24 Jul 2023 20:10:52 +0000 (21:10 +0100)]
libstdc++: Add missing constexpr specifiers in <format>

A couple of virtual functions in the libstdc++ format header are marked
constexpr in the base class, but not in the derived class. This was
causing build failures when trying to compile latest gcc libstdc++ with
clang 16 using c++20. Adding the constexpr specifier resolves the issue.

libstdc++-v3/ChangeLog:

* include/std/format (_Formatting_scanner::_M_on_chars): Add
missing constexpr specifier.
(_Formatting_scanner::_M_format_arg): Likewise.

(cherry picked from commit 96482ffe60d9bdec802fcad705c69641b2a3e040)

15 months agolibstdc++: Avoid bogus overflow warnings in std::vector<bool> [PR110807]
Jonathan Wakely [Wed, 26 Jul 2023 13:09:24 +0000 (14:09 +0100)]
libstdc++: Avoid bogus overflow warnings in std::vector<bool> [PR110807]

GCC thinks the allocation can alter the object being copied if it's
globally reachable, so doesn't realize that [x.begin(), x.end()) after
the allocation is the same as x.size() before it.

This causes a testsuite failure when testing with -D_GLIBCXX_DEBUG:
FAIL: 23_containers/vector/bool/swap.cc (test for excess errors)
A fix is to move the calls to x.begin() and x.end() to before the
allocation.

A similar problem exists in vector<bool>::_M_insert_range where *this is
globally reachable, as reported in PR libstdc++/110807. That can also be
fixed by moving calls to begin() and end() before the allocation.

libstdc++-v3/ChangeLog:

PR libstdc++/110807
* include/bits/stl_bvector.h (vector(const vector&)): Access
iterators before allocating.
* include/bits/vector.tcc (vector<bool>::_M_insert_range):
Likewise.
* testsuite/23_containers/vector/bool/110807.cc: New test.

(cherry picked from commit 7931a1de9ec87b996d51d3d60786f5c81f63919f)

15 months agolibstdc++: Add deprecated attribute to std::random_shuffle declarations
Jonathan Wakely [Wed, 26 Jul 2023 13:05:58 +0000 (14:05 +0100)]
libstdc++: Add deprecated attribute to std::random_shuffle declarations

We already have these attributes on the definitions in <bits/stl_algo.h>
but they don't work due to PR c++/84542. Add the attributes to the
declarations in <bits/algorithmfwd.h> as well, and add a test.

libstdc++-v3/ChangeLog:

* include/bits/algorithmfwd.h (random_shuffle): Add deprecated
attribute.
* include/bits/stl_algo.h (random_shuffle): Correct comments.
* testsuite/25_algorithms/random_shuffle/1.cc: Disable
deprecated warnings.
* testsuite/25_algorithms/random_shuffle/59603.cc: Likewise.
* testsuite/25_algorithms/random_shuffle/moveable.cc: Likewise.
* testsuite/25_algorithms/random_shuffle/deprecated.cc: New
test.

(cherry picked from commit c01b344e814001e07fd304ce98d013d811e90192)

15 months agoPR modula2/109779 isolib SkipLine skips the first character of the successive line
Gaius Mulley [Fri, 28 Jul 2023 16:51:53 +0000 (17:51 +0100)]
PR modula2/109779 isolib SkipLine skips the first character of the successive line

This is a patch for the m2iso library to prevent SkipLine from consuming
the next character on the next line.

gcc/m2/ChangeLog:

PR modula2/109779
* gm2-libs-iso/RTgen.mod (doLook): Remove old.
Remove re-assignment of result.
* gm2-libs-iso/TextIO.mod (CanRead): Rename into ...
(CharAvailable): ... this.
(DumpState): New procedure.
(SetResult): Rename as SetNul.
(WasGoodChar): Rename into ...
(EofOrEoln): ... this.
(SkipLine): Skip over the newline.
(ReadString): Flip THEN ELSE statements after testing for
EofOrEoln.
(ReadRestLine): Flip THEN ELSE statements after testing for
EofOrEoln.

gcc/testsuite/ChangeLog:

PR modula2/109779
* gm2/isolib/run/pass/skiplinetest.mod: New test.

(cherry picked from commit 434dade5a11f63533cbf6059a862856c9b11c711)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
15 months agoPR modula2/109729 cannot use a CHAR type as a FOR loop iterator
Gaius Mulley [Fri, 28 Jul 2023 14:00:29 +0000 (15:00 +0100)]
PR modula2/109729 cannot use a CHAR type as a FOR loop iterator

This patch introduces a new quadruple ArithAddOp which is used in
the construction of FOR loop to ensure that when constant folding
is applied it does not concatenate two constant char operands into
a string constant.  Overloading only occurs with constant operands.

gcc/m2/ChangeLog:

PR modula2/109729
PR modula2/110246
* gm2-compiler/M2GenGCC.mod (CodeStatement): Detect
ArithAddOp and call CodeAddChecked.
(ResolveConstantExpressions): Detect ArithAddOp and call
FoldArithAdd.
(FoldArithAdd): New procedure.
(FoldAdd): Refactor to use FoldArithAdd.
* gm2-compiler/M2Quads.def (QuadOperator): Add ArithAddOp.
* gm2-compiler/M2Quads.mod: Remove commented imports.
(QuadFrame): Changed comments to use GNU coding standards.
(ArithPlusTok): New global variable.
(BuildForToByDo): Use ArithPlusTok instead of PlusTok.
(MakeOp): Detect ArithPlusTok and return ArithAddOp.
(WriteQuad): Add ArithAddOp clause.
(WriteOperator): Add ArithAddOp clause.
(Init): Initialize ArithPlusTok.

gcc/testsuite/ChangeLog:

PR modula2/109729
* gm2/pim/run/pass/ForChar.mod: New test.

(cherry picked from commit ac7c9954ece9a75c5e7c3b76a4800f2432002487)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
15 months agomodula2: Remove M2LINK.o from m2/m2obj3/cc1gm2 in Make-maintainer.in
Gaius Mulley [Fri, 28 Jul 2023 12:14:33 +0000 (13:14 +0100)]
modula2: Remove M2LINK.o from m2/m2obj3/cc1gm2 in Make-maintainer.in

This patch removes M2LINK.o from m2/m2obj3/cc1gm2.

gcc/m2/ChangeLog:

* Make-maintainer.in (m2/m2obj3/cc1gm2$(exeext)):
Remove M2LINK.o from dependency and build rule.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
15 months agoPR modula2/109675 implementation of writeAddress is non portable
Gaius Mulley [Fri, 28 Jul 2023 11:55:12 +0000 (12:55 +0100)]
PR modula2/109675 implementation of writeAddress is non portable

The implementation of gcc/m2/gm2-libs/DynamicStrings.mod:writeAddress
is non portable as it casts a void * into an unsigned long int.  This
procedure has been re-implemented to use snprintf.  As it is a library
the support tools 'mc' and 'pge' have been rebuilt.  There have been
linking changes in the library and the underlying boolean type is now
bool since the last rebuild hence the size of the patch.

gcc/m2/ChangeLog:

PR modula2/109675
* Make-lang.in (MC-LIB-DEFS): Remove M2LINK.def.
(BUILD-PGE-O): Remove GM2LINK.o.
* Make-maintainer.in (PPG-DEFS): New define.
(PPG-LIB-DEFS): Remove M2LINK.def.
(BUILD-BOOT-PPG-H): Add PPGDEF .h files.
(m2/ppg$(exeext)): Remove M2LINK.o
(PGE-DEPS): New define.
(m2/pg$(exeext)): Remove M2LINK.o.
(m2/gm2-pge-boot/$(SRC_PREFIX)%.o): Add -Im2/gm2-pge-boot.
(m2/pge$(exeext)): Remove M2LINK.o.
(pge-maintainer): Re-implement.
(pge-libs-push): Re-implement.
(m2/m2obj3/cc1gm2$(exeext)): Remove M2LINK.o.
* gm2-libs/DynamicStrings.mod (writeAddress): Re-implement
using snprintf.
* gm2-libs/M2Dependent.mod: Remove commented out imports.
* mc-boot/GDynamicStrings.cc: Rebuild.
* mc-boot/GFIO.cc: Rebuild.
* mc-boot/GFormatStrings.cc: Rebuild.
* mc-boot/GM2Dependent.cc: Rebuild.
* mc-boot/GM2Dependent.h: Rebuild.
* mc-boot/GM2RTS.cc: Rebuild.
* mc-boot/GM2RTS.h: Rebuild.
* mc-boot/GRTExceptions.cc: Rebuild.
* mc-boot/GRTint.cc: Rebuild.
* mc-boot/GSFIO.cc: Rebuild.
* mc-boot/GStringConvert.cc: Rebuild.
* mc-boot/Gdecl.cc: Rebuild.
* pge-boot/GASCII.cc: Rebuild.
* pge-boot/GASCII.h: Rebuild.
* pge-boot/GArgs.cc: Rebuild.
* pge-boot/GArgs.h: Rebuild.
* pge-boot/GAssertion.cc: Rebuild.
* pge-boot/GAssertion.h: Rebuild.
* pge-boot/GBreak.h: Rebuild.
* pge-boot/GCmdArgs.h: Rebuild.
* pge-boot/GDebug.cc: Rebuild.
* pge-boot/GDebug.h: Rebuild.
* pge-boot/GDynamicStrings.cc: Rebuild.
* pge-boot/GDynamicStrings.h: Rebuild.
* pge-boot/GEnvironment.h: Rebuild.
* pge-boot/GFIO.cc: Rebuild.
* pge-boot/GFIO.h: Rebuild.
* pge-boot/GFormatStrings.h:: Rebuild.
* pge-boot/GFpuIO.h:: Rebuild.
* pge-boot/GIO.cc: Rebuild.
* pge-boot/GIO.h: Rebuild.
* pge-boot/GIndexing.cc: Rebuild.
* pge-boot/GIndexing.h: Rebuild.
* pge-boot/GLists.cc: Rebuild.
* pge-boot/GLists.h: Rebuild.
* pge-boot/GM2Dependent.cc: Rebuild.
* pge-boot/GM2Dependent.h: Rebuild.
* pge-boot/GM2EXCEPTION.cc: Rebuild.
* pge-boot/GM2EXCEPTION.h: Rebuild.
* pge-boot/GM2RTS.cc: Rebuild.
* pge-boot/GM2RTS.h: Rebuild.
* pge-boot/GNameKey.cc: Rebuild.
* pge-boot/GNameKey.h: Rebuild.
* pge-boot/GNumberIO.cc: Rebuild.
* pge-boot/GNumberIO.h: Rebuild.
* pge-boot/GOutput.cc: Rebuild.
* pge-boot/GOutput.h: Rebuild.
* pge-boot/GPushBackInput.cc: Rebuild.
* pge-boot/GPushBackInput.h: Rebuild.
* pge-boot/GRTExceptions.cc: Rebuild.
* pge-boot/GRTExceptions.h: Rebuild.
* pge-boot/GSArgs.h: Rebuild.
* pge-boot/GSEnvironment.h: Rebuild.
* pge-boot/GSFIO.cc: Rebuild.
* pge-boot/GSFIO.h: Rebuild.
* pge-boot/GSYSTEM.h: Rebuild.
* pge-boot/GScan.h: Rebuild.
* pge-boot/GStdIO.cc: Rebuild.
* pge-boot/GStdIO.h: Rebuild.
* pge-boot/GStorage.cc: Rebuild.
* pge-boot/GStorage.h: Rebuild.
* pge-boot/GStrCase.cc: Rebuild.
* pge-boot/GStrCase.h: Rebuild.
* pge-boot/GStrIO.cc: Rebuild.
* pge-boot/GStrIO.h: Rebuild.
* pge-boot/GStrLib.cc: Rebuild.
* pge-boot/GStrLib.h: Rebuild.
* pge-boot/GStringConvert.h: Rebuild.
* pge-boot/GSymbolKey.cc: Rebuild.
* pge-boot/GSymbolKey.h: Rebuild.
* pge-boot/GSysExceptions.h: Rebuild.
* pge-boot/GSysStorage.cc: Rebuild.
* pge-boot/GSysStorage.h: Rebuild.
* pge-boot/GTimeString.h: Rebuild.
* pge-boot/GUnixArgs.h: Rebuild.
* pge-boot/Gbnflex.cc: Rebuild.
* pge-boot/Gbnflex.h: Rebuild.
* pge-boot/Gdtoa.h: Rebuild.
* pge-boot/Gerrno.h: Rebuild.
* pge-boot/Gldtoa.h: Rebuild.
* pge-boot/Glibc.h: Rebuild.
* pge-boot/Glibm.h: Rebuild.
* pge-boot/Gpge.cc: Rebuild.
* pge-boot/Gtermios.h: Rebuild.
* pge-boot/Gwrapc.h: Rebuild.
* mc-boot/GM2LINK.h: Removed.
* pge-boot/GM2LINK.cc: Removed.
* pge-boot/GM2LINK.h: Removed.

(cherry picked from commit 9525daf0fbc5c836ee028f5b58612857de7da51d)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
15 months agoPR modula2/108121 Re-implement overflow detection for constant literals
Gaius Mulley [Fri, 28 Jul 2023 02:10:01 +0000 (03:10 +0100)]
PR modula2/108121 Re-implement overflow detection for constant literals

This patch fixes the overflow detection for constant literals.
The ZTYPE is changed to int128 (or int64) if int128 is unavailable and
constant literals are built from widest_int.  The widest_int is converted
into the tree type and checked for overflow.
m2expr_interpret_integer and append_m2_digit are removed.

gcc/m2/ChangeLog:

PR modula2/108121
* gm2-compiler/M2ALU.mod (Less): Reformatted.
* gm2-compiler/SymbolTable.mod (DetermineSizeOfConstant): Remove
from import.
(ConstantStringExceedsZType): Import.
(GetConstLitType): Re-implement using ConstantStringExceedsZType.
* gm2-gcc/m2decl.cc (m2decl_DetermineSizeOfConstant): Remove.
(m2decl_ConstantStringExceedsZType): New function.
(m2decl_BuildConstLiteralNumber): Re-implement.
* gm2-gcc/m2decl.def (DetermineSizeOfConstant): Remove.
(ConstantStringExceedsZType): New function.
* gm2-gcc/m2decl.h (m2decl_DetermineSizeOfConstant): Remove.
(m2decl_ConstantStringExceedsZType): New function.
* gm2-gcc/m2expr.cc (append_digit): Remove.
(m2expr_interpret_integer): Remove.
(append_m2_digit): Remove.
(m2expr_StrToWideInt): New function.
(m2expr_interpret_m2_integer): Remove.
* gm2-gcc/m2expr.def (CheckConstStrZtypeRange): New function.
* gm2-gcc/m2expr.h (m2expr_StrToWideInt): New function.
* gm2-gcc/m2type.cc (build_m2_word64_type_node): New function.
(build_m2_ztype_node): New function.
(m2type_InitBaseTypes): Call build_m2_ztype_node.
* gm2-lang.cc (gm2_type_for_size): Re-write using early returns.

gcc/testsuite/ChangeLog:

PR modula2/108121
* gm2/pim/fail/largeconst.mod: Increased constant value test
to fail now that cc1gm2 uses widest_int to represent a ZTYPE.
* gm2/pim/fail/largeconst2.mod: New test.

(cherry picked from commit 68201409bc2867da45791331e385198826fa4576)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
15 months agoDaily bump.
GCC Administrator [Fri, 28 Jul 2023 00:21:50 +0000 (00:21 +0000)]
Daily bump.

15 months agomodula2: Add -lnsl -lsocket libraries to gcc/testsuite/lib/gm2.exp
Gaius Mulley [Thu, 27 Jul 2023 21:53:15 +0000 (22:53 +0100)]
modula2: Add -lnsl -lsocket libraries to gcc/testsuite/lib/gm2.exp

Solaris requires -lnsl -lsocket (present in the driver) but not when
running the testsuite.  This patch tests target for *-*-solaris2
and conditionally appends the above libraries.

gcc/testsuite/ChangeLog:

* lib/gm2.exp (gm2_target_compile_default): Conditionally
append -lnsl -lsocket to ldflags.

(cherry picked from commit 8d7223f65799b170b1314a35bb98249d419e7215)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
15 months agoPR modula2/109586 cc1gm2 ICE when compiling large source files.
Gaius Mulley [Thu, 27 Jul 2023 21:11:26 +0000 (22:11 +0100)]
PR modula2/109586 cc1gm2 ICE when compiling large source files.

The function m2block_RememberConstant calls m2tree_IsAConstant.
However IsAConstant does not recognise TREE_CODE(t) ==
CONSTRUCTOR as a constant.  Without this patch CONSTRUCTOR
contants are garbage collected (and not preserved) resulting in
a corrupt tree and crash.

gcc/m2/ChangeLog:

PR modula2/109586
* gm2-gcc/m2tree.cc (m2tree_IsAConstant): Add (TREE_CODE
(t) == CONSTRUCTOR) to expression.

(cherry picked from commit a7e1ee39e4fa37d005929c4ff9457d1a199559c6)

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
15 months agorange-op-float: Fix up -frounding-math frange_arithmetic +- handling [PR110755]
Jakub Jelinek [Wed, 26 Jul 2023 08:50:50 +0000 (10:50 +0200)]
range-op-float: Fix up -frounding-math frange_arithmetic +- handling [PR110755]

IEEE754 says that x + (-x) and x - x result in +0 in all rounding modes
but rounding towards negative infinity, in which case the result is -0
for all finite x.  x + x and x - (-x) if it is zero retain sign of x.
Now, range_arithmetic implements the normal rounds to even rounding,
and as the addition or subtraction in those cases is exact, we don't do any
further rounding etc. and e.g. on the testcase below distilled from glibc
compute a range [+0, +INF], which is fine for -fno-rounding-math or
if we'd have a guarantee that those statements aren't executed with rounding
towards negative infinity.

I believe it is only +- which has this problematic behavior and I think
it is best to deal with it in frange_arithmetic; if we know -frounding-math
is on, it is x + (-x) or x - x and we are asked to round to negative
infinity (i.e. want low bound rather than high bound), change +0 result to
-0.

2023-07-26  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/110755
* range-op-float.cc (frange_arithmetic): Change +0 result to -0
for PLUS_EXPR or MINUS_EXPR if -frounding-math, inf is negative and
it is exact op1 + (-op1) or op1 - op1.

* gcc.dg/pr110755.c: New test.

(cherry picked from commit 21da32d995c8b574c929ec420cd3b0fcfe6fa4fe)

15 months agoc++: unifying REAL_CSTs [PR110809]
Patrick Palka [Wed, 26 Jul 2023 20:52:13 +0000 (16:52 -0400)]
c++: unifying REAL_CSTs [PR110809]

This teaches unify how to compare two REAL_CSTs.

PR c++/110809

gcc/cp/ChangeLog:

* pt.cc (unify) <case INTEGER_CST>: Generalize to handle
REAL_CST as well.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/nontype-float3.C: New test.

(cherry picked from commit 744e1f35266dbd6b6fb95c7e8422562815f8b56f)

15 months agoXFAIL parts broken deliberately by r13-1762-gf9d4c3b45c5ed5
Richard Biener [Thu, 27 Jul 2023 10:34:34 +0000 (12:34 +0200)]
XFAIL parts broken deliberately by r13-1762-gf9d4c3b45c5ed5

The following XFAILs recognizing a complex store as memset.

PR tree-optimization/110829
* gcc.dg/pr56837.c: XFAIL part of the testcase.

(cherry picked from commit 41482832ad0aeaa0e4ae2f8d2beff17023cd00bf)

15 months agotree-optimization/110799 - fix bug in code hoisting
Richard Biener [Wed, 26 Jul 2023 07:28:10 +0000 (09:28 +0200)]
tree-optimization/110799 - fix bug in code hoisting

Code hoisting part of GIMPLE PRE failed to adjust the TBAA behavior
of common loads in the case the alias set of the ref was the same
but the base alias set was not.  It also failed to adjust the
base behavior, assuming it would match.  The following plugs this
hole.

PR tree-optimization/110799
* tree-ssa-pre.cc (compute_avail): More thoroughly match
up TBAA behavior of redundant loads.

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

(cherry picked from commit 565e0e80660dac24e5193873ca07542b99cd8bc3)

15 months agotree-optimization/110766 - missing PHI location check
Richard Biener [Mon, 24 Jul 2023 06:40:19 +0000 (08:40 +0200)]
tree-optimization/110766 - missing PHI location check

The following adds a missing PHI location check before querying
the loop latch PHI arg from it.

PR tree-optimization/110766
* tree-scalar-evolution.cc
(analyze_and_compute_bitwise_induction_effect): Check the PHI
is defined in the loop header.

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

(cherry picked from commit fb132cdfb204bc12851eb1d5852eef6f03c13af3)

15 months agoBump BASE-VER
Jakub Jelinek [Thu, 27 Jul 2023 09:10:33 +0000 (11:10 +0200)]
Bump BASE-VER

2023-07-27  Jakub Jelinek  <jakub@redhat.com>

* BASE-VER: Set to 13.2.1.

15 months agoUpdate ChangeLog and version files for release releases/gcc-13.2.0
Jakub Jelinek [Thu, 27 Jul 2023 08:13:36 +0000 (08:13 +0000)]
Update ChangeLog and version files for release

15 months agoDaily bump.
GCC Administrator [Thu, 27 Jul 2023 00:21:41 +0000 (00:21 +0000)]
Daily bump.

15 months agoUpdate gcc uk.po
Joseph Myers [Wed, 26 Jul 2023 19:09:27 +0000 (19:09 +0000)]
Update gcc uk.po

* uk.po: Update.

15 months agoRegenerate gcc.pot
Joseph Myers [Wed, 26 Jul 2023 18:40:36 +0000 (18:40 +0000)]
Regenerate gcc.pot

* gcc.pot: Regenerate.

15 months agoDaily bump.
GCC Administrator [Wed, 26 Jul 2023 00:21:20 +0000 (00:21 +0000)]
Daily bump.

15 months agoUpdate gcc uk.po
Joseph Myers [Tue, 25 Jul 2023 20:42:41 +0000 (20:42 +0000)]
Update gcc uk.po

* uk.po: Update.

15 months agoDaily bump.
GCC Administrator [Tue, 25 Jul 2023 00:23:26 +0000 (00:23 +0000)]
Daily bump.

15 months agoDaily bump.
GCC Administrator [Mon, 24 Jul 2023 00:21:16 +0000 (00:21 +0000)]
Daily bump.

15 months agoDaily bump.
GCC Administrator [Sun, 23 Jul 2023 00:21:12 +0000 (00:21 +0000)]
Daily bump.

15 months agoDaily bump.
GCC Administrator [Sat, 22 Jul 2023 00:21:10 +0000 (00:21 +0000)]
Daily bump.

15 months agoUpdate gcc hr.po
Joseph Myers [Fri, 21 Jul 2023 17:01:02 +0000 (17:01 +0000)]
Update gcc hr.po

* hr.po: Update.

15 months agoDaily bump.
GCC Administrator [Fri, 21 Jul 2023 00:21:12 +0000 (00:21 +0000)]
Daily bump.

15 months agoaarch64: Remove architecture dependencies from intrinsics
Andrew Carlotti [Tue, 7 Mar 2023 14:37:00 +0000 (14:37 +0000)]
aarch64: Remove architecture dependencies from intrinsics

Many intrinsics currently depend on both an architecture version and a
feature, despite the corresponding instructions being available within
GCC at lower architecture versions.

LLVM has already removed these explicit architecture version
dependences; this patch does the same for GCC. Note that +fp16 does not
imply +simd, so we need to add an explicit +simd for the Neon fp16
intrinsics.

Binutils did not previously support all of these architecture+feature
combinations, but this problem is already reachable from GCC.  For
example, compiling the test gcc.target/aarch64/usadv16qi-dotprod.c
with -O3 -march=armv8-a+dotprod has resulted in an assembler error since
GCC 10.  This is fixed in Binutils 2.41.

This patch retains explicit architecture version dependencies for
features that do not currently have a separate feature flag.

gcc/ChangeLog:

* config/aarch64/aarch64.h (TARGET_MEMTAG): Remove armv8.5
dependency.
* config/aarch64/arm_acle.h: Remove unnecessary armv8.x
dependencies from target pragmas.
* config/aarch64/arm_fp16.h (target): Likewise.
* config/aarch64/arm_neon.h (target): Likewise.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/feature-bf16-backport.c: New test.
* gcc.target/aarch64/feature-dotprod-backport.c: New test.
* gcc.target/aarch64/feature-fp16-backport.c: New test.
* gcc.target/aarch64/feature-fp16-scalar-backport.c: New test.
* gcc.target/aarch64/feature-fp16fml-backport.c: New test.
* gcc.target/aarch64/feature-i8mm-backport.c: New test.
* gcc.target/aarch64/feature-memtag-backport.c: New test.
* gcc.target/aarch64/feature-sha3-backport.c: New test.
* gcc.target/aarch64/feature-sm4-backport.c: New test.

15 months agoRevert "Use PTEST to perform AND in TImode STV of (A & B) != 0 on x86_64."
Richard Biener [Thu, 20 Jul 2023 07:26:07 +0000 (09:26 +0200)]
Revert "Use PTEST to perform AND in TImode STV of (A & B) != 0 on x86_64."

This reverts commit a56c1641e9d25e46059168e811b4a2f185f07b6b.

This page took 0.127767 seconds and 5 git commands to generate.