platform/upstream/gcc.git
16 months agoc++: ICE with constexpr variable template [PR107938]
Marek Polacek [Thu, 23 Feb 2023 22:54:47 +0000 (17:54 -0500)]
c++: ICE with constexpr variable template [PR107938]

Since r11-557, cp_finish_decl can call check_initializer even in
a template for a constexpr initializer.  That ultimately leads to
convert_for_assignment and check_address_or_pointer_of_packed_member,
where we crash, because it doesn't expect that the CALL_EXPR is
a function object.  Q has a constexpr operator(), but since we're
in a template, q(0) is a CALL_EXPR whose CALL_EXPR_FN is just
a VAR_DECL; it hasn't been converted to Q::operator<int>(&q, 0) yet.
I propose to robustify check_address_or_pointer_of_packed_member.

var-templ74.C has an XFAIL, subject to 107939.

I noticed that our -Waddress-of-packed-member tests weren't testing
member functions, added thus.  (I was tempted to check
FUNCTION_POINTER_TYPE_P but that doesn't include METHOD_TYPE.)

PR c++/107938

gcc/c-family/ChangeLog:

* c-warn.cc (check_address_or_pointer_of_packed_member): Check
POINTER_TYPE_P.

gcc/testsuite/ChangeLog:

* g++.dg/cpp1y/var-templ73.C: New test.
* g++.dg/cpp1y/var-templ74.C: New test.
* g++.dg/warn/Waddress-of-packed-member3.C: New test.

16 months agoubsan: Honor -fstrict-flex-arrays= in -fsanitize=bounds [PR108894]
Jakub Jelinek [Tue, 28 Feb 2023 10:38:46 +0000 (11:38 +0100)]
ubsan: Honor -fstrict-flex-arrays= in -fsanitize=bounds [PR108894]

While this isn't really a regression, the -fstrict-flex-arrays*
option is new in GCC 13 and so I think we should make -fsanitize=bounds
play with it well from the beginning.

The current behavior is that -fsanitize=bounds considers all trailing
arrays as flexible member-like arrays and both -fsanitize=bounds and
-fsanitize=bounds-strict because of a bug don't even instrument
[0] arrays at all, not as trailing nor when followed by other members.

I think -fstrict-flex-arrays* options can be considered as language
mode changing options, by default flexible member-like arrays are
handled like flexible arrays, but that option can change the set of
the arrays which are treated like that.  So, -fsanitize=bounds should
change with that on what is considered acceptable and what isn't.
While -fsanitize=bounds-strict should reject them all always to
continue previous behavior.

The following patch implements that.  To support [0] array instrumentation,
I had to change the meaning of the bounds argument to .UBSAN_BOUNDS,
previously it was the TYPE_MAX_VALUE of the domain unless ignore_off_by_one
(used for taking address of the array element rather than accessing it;
in that case 1 is added to the bound argument) and the later lowered checks
were if (index > bound) report_failure ().
The problem with that is that for [0] arrays where (at least for C++)
the max value is all ones, for accesses that condition will be never true;
for addresses of elements it was working (in C++) correctly before.
This patch changes it to add 1 + ignore_off_by_one, so -1 becomes 0 or
1 for &array_ref and changing the lowering to be if (index >= bound)
report_failure ().  Furthermore, as C represents the [0] arrays with
NULL TYPE_MAX_VALUE, I treated those like the C++ ones.

2023-02-28  Jakub Jelinek  <jakub@redhat.com>

PR sanitizer/108894
gcc/
* ubsan.cc (ubsan_expand_bounds_ifn): Emit index >= bound
comparison rather than index > bound.
* gimple-fold.cc (gimple_fold_call): Use tree_int_cst_lt
rather than tree_int_cst_le for IFN_UBSAN_BOUND comparison.
* doc/invoke.texi (-fsanitize=bounds): Document that whether
flexible array member-like arrays are instrumented or not depends
on -fstrict-flex-arrays* options of strict_flex_array attributes.
(-fsanitize=bounds-strict): Document that flexible array members
are not instrumented.
gcc/c-family/
* c-common.h (c_strict_flex_array_level_of): Declare.
* c-common.cc (c_strict_flex_array_level_of): New function,
moved and renamed from c-decl.cc's strict_flex_array_level_of.
* c-ubsan.cc (ubsan_instrument_bounds): Fix comment typo.  For
C check c_strict_flex_array_level_of whether a trailing array
should be treated as flexible member like.  Handle C [0] arrays.
Add 1 + index_off_by_one rather than index_off_by_one to bounds
and use tree_int_cst_lt rather than tree_int_cst_le for idx vs.
bounds comparison.
gcc/c/
* c-decl.cc (strict_flex_array_level_of): Move to c-common.cc
and rename to c_strict_flex_array_level_of.
(is_flexible_array_member_p): Adjust caller.
gcc/testsuite/
* gcc.dg/ubsan/bounds-4.c: New test.
* gcc.dg/ubsan/bounds-4a.c: New test.
* gcc.dg/ubsan/bounds-4b.c: New test.
* gcc.dg/ubsan/bounds-4c.c: New test.
* gcc.dg/ubsan/bounds-4d.c: New test.
* g++.dg/ubsan/bounds-1.C: New test.

16 months agotestsuite/108942 - use sizetype in GIMPLE FE testcase
Richard Biener [Tue, 28 Feb 2023 10:36:01 +0000 (11:36 +0100)]
testsuite/108942 - use sizetype in GIMPLE FE testcase

The following properly uses __SIZETYPE__ for pointer offsets.

PR testsuite/108942
* gcc.dg/torture/ssa-fre-7.c: Use __SIZETYPE__.

16 months agolibstdc++: Fix uses_allocator_construction_args for pair<T&&, U&&> [PR108952]
Jonathan Wakely [Mon, 27 Feb 2023 22:34:57 +0000 (22:34 +0000)]
libstdc++: Fix uses_allocator_construction_args for pair<T&&, U&&> [PR108952]

This implements LWG 3527 which fixes the handling of pair<T&&, U&&> in
std::uses_allocator_construction_args.

libstdc++-v3/ChangeLog:

PR libstdc++/108952
* include/bits/uses_allocator_args.h
(uses_allocator_construction_args): Implement LWG 3527.
* testsuite/20_util/pair/astuple/get-2.cc: New test.
* testsuite/20_util/scoped_allocator/108952.cc: New test.
* testsuite/20_util/uses_allocator/lwg3527.cc: New test.

16 months agolibstdc++: Do not use memmove for 1-element ranges [PR108846]
Jonathan Wakely [Sat, 25 Feb 2023 14:28:36 +0000 (14:28 +0000)]
libstdc++: Do not use memmove for 1-element ranges [PR108846]

This avoids overwriting tail padding when algorithms like std::copy are
used to write a single value through a pointer to a base subobject.

The pointer arithmetic on a Base* is valid for N==1, but the copy/move
operation needs to be done using assignment, not a memmove or memcpy of
sizeof(Base) bytes.

Instead of putting a check for N==1 in all of copy, copy_n, move etc.
this adds it to the __copy_move and __copy_move_backward partial
specializations used for trivially copyable types. When N==1 those
partial specializations dispatch to new static member functions of the
partial specializations for non-trivial types, so that a copy/move
assignment is done appropriately for the _IsMove constant.

libstdc++-v3/ChangeLog:

PR libstdc++/108846
* include/bits/stl_algobase.h (__copy_move<false, false, RA>)
Add __assign_one static member function.
(__copy_move<true, false, RA>): Likewise.
(__copy_move<IsMove, true, RA>): Do not use memmove for a single
value.
(__copy_move_backward<IsMove, true, RA>): Likewise.
* testsuite/25_algorithms/copy/108846.cc: New test.
* testsuite/25_algorithms/copy_backward/108846.cc: New test.
* testsuite/25_algorithms/copy_n/108846.cc: New test.
* testsuite/25_algorithms/move/108846.cc: New test.
* testsuite/25_algorithms/move_backward/108846.cc: New test.

16 months agolibstdc++: Add likely/unlikely attributes to <codecvt> implementation
Jonathan Wakely [Fri, 24 Feb 2023 21:28:11 +0000 (21:28 +0000)]
libstdc++: Add likely/unlikely attributes to <codecvt> implementation

For the common case of converting valid text this improves performance
significantly.

libstdc++-v3/ChangeLog:

* src/c++11/codecvt.cc: Add [[likely]] and [[unlikely]]
attributes.

16 months agoFortran: Eliminate nuisance warnings by initializing.
Jerry DeLisle [Sun, 26 Feb 2023 04:30:35 +0000 (20:30 -0800)]
Fortran: Eliminate nuisance warnings by initializing.

Set sstride[0] and mstride[0] to zero, eliminating some warnings.

libgfortran/ChangeLog:

* generated/pack_c10.c (pack_c10): Regenerated.
* generated/pack_c16.c (pack_c16): Regenerated.
* generated/pack_c17.c (pack_c17): Regenerated.
* generated/pack_c4.c (pack_c4): Regenerated.
* generated/pack_c8.c (pack_c8): Regenerated.
* generated/pack_i1.c (pack_i1): Regenerated.
* generated/pack_i16.c (pack_i16): Regenerated.
* generated/pack_i2.c (pack_i2): Regenerated.
* generated/pack_i4.c (pack_i4): Regenerated.
* generated/pack_i8.c (pack_i8): Regenerated.
* generated/pack_r10.c (pack_r10): Regenerated.
* generated/pack_r16.c (pack_r16): Regenerated.
* generated/pack_r17.c (pack_r17): Regenerated.
* generated/pack_r4.c (pack_r4): Regenerated.
* generated/pack_r8.c (pack_r8): Regenerated.
* generated/spread_c10.c (spread_c10): Regenerated.
* generated/spread_c16.c (spread_c16): Regenerated.
* generated/spread_c17.c (spread_c17): Regenerated.
* generated/spread_c4.c (spread_c4): Regenerated.
* generated/spread_c8.c (spread_c8): Regenerated.
* generated/spread_i1.c (spread_i1): Regenerated.
* generated/spread_i16.c (spread_i16): Regenerated.
* generated/spread_i2.c (spread_i2): Regenerated.
* generated/spread_i4.c (spread_i4): Regenerated.
* generated/spread_i8.c (spread_i8): Regenerated.
* generated/spread_r10.c (spread_r10): Regenerated.
* generated/spread_r16.c (spread_r16): Regenerated.
* generated/spread_r17.c (spread_r17): Regenerated.
* generated/spread_r4.c (spread_r4): Regenerated.
* generated/spread_r8.c (spread_r8): Regenerated.
* intrinsics/execute_command_line.c (execute_command_line_i4),
(execute_command_line_i8): Set estat_initial to zero.
* intrinsics/pack_generic.c (pack_internal): Set sstride[0] and
mstride[0] to zero.
* intrinsics/spread_generic.c (spread_internal): Set sstride[0].
* m4/pack.m4: Set sstride[0] and mstride[0].
* m4/spread.m4: Set sstride[0].

16 months agotestsuite: No xfail infoleak-vfio_iommu_type1.c bogus for default_packed
Hans-Peter Nilsson [Mon, 27 Feb 2023 19:44:46 +0000 (20:44 +0100)]
testsuite: No xfail infoleak-vfio_iommu_type1.c bogus for default_packed

There are no messages about padding for targets that don't
pad, i.e. default_packed.  Noticed for cris-elf, verified
for pru-elf at gcc-testresults@.

testsuite:
* gcc.dg/plugin/infoleak-vfio_iommu_type1.c: Don't xfail bogus
message for "default_packed" targets.

16 months agotestsuite: Shorten multiline pattern message to the same for fail and pass
Hans-Peter Nilsson [Mon, 27 Feb 2023 19:00:25 +0000 (20:00 +0100)]
testsuite: Shorten multiline pattern message to the same for fail and pass

As recommended by testsuite maintainer: Regression analysis
works only if the string is the same.

testsuite:
* lib/multiline.exp (handle-multiline-outputs): Shorten
message to the same for fail and pass.

16 months agotestsuite: Remove xfail gcc.dg/tree-ssa/pr91091-2.c RHS ! natural_alignment_32
Hans-Peter Nilsson [Mon, 27 Feb 2023 17:40:02 +0000 (18:40 +0100)]
testsuite: Remove xfail gcc.dg/tree-ssa/pr91091-2.c RHS ! natural_alignment_32

Reacting to a long-standing XPASS for CRIS.  This one is
slightly brown paper-bag level; it was never the here-removed
xfailed scan that failed and I didn't notice that XPASS when
reporting success on the commit as a whole.  It's not logical to
re-read what was just-written even with overlap issues, and I'm
sure that edit was originally a copy-pasto.  I checked
historical m68k-linux and pru-elf test-results too, to verify
that I got that part right.

PR testsuite/91419
* gcc.dg/tree-ssa/pr91091-2.c:15 Remove xfail for RHS.

16 months agoUpdate cpplib sr.po, sv.po
Joseph Myers [Tue, 28 Feb 2023 01:18:28 +0000 (01:18 +0000)]
Update cpplib sr.po, sv.po

* sr.po, sv.po: Update.

16 months agotestsuite: Add CRIS to targets not xfailing gcc.dg/attr-alloc_size-11.c:50,51
Hans-Peter Nilsson [Mon, 27 Feb 2023 16:22:44 +0000 (17:22 +0100)]
testsuite: Add CRIS to targets not xfailing gcc.dg/attr-alloc_size-11.c:50,51

Reacting to a long-standing XPASS for CRIS.  Maybe better do
as https://gcc.gnu.org/PR79356#c11 suggests: xfail it for
x86 only ...except I see m68k also does not xpass.

testsuite:
PR testsuite/79356
* gcc.dg/attr-alloc_size-11.c: Add CRIS to the list
of targets excluding xfail on lines 50 and 51.

16 months agotestsuite: Add -fno-ivopts to gcc.dg/Wuse-after-free-2.c, PR108828
Hans-Peter Nilsson [Fri, 24 Feb 2023 16:22:02 +0000 (17:22 +0100)]
testsuite: Add -fno-ivopts to gcc.dg/Wuse-after-free-2.c, PR108828

For cris-elf before this patch, ever since it was added,
this test gets:

Running /x/gcc/testsuite/gcc.dg/dg.exp ...
FAIL: gcc.dg/Wuse-after-free-2.c  (test for warnings, line 115)
FAIL: gcc.dg/Wuse-after-free-2.c  (test for warnings, line 116)

and comparing tree dumps with a native x86_64-pc-linux-gnu
run shows a suspicious difference in the "180t.ivopts" dump.
Indeed -fno-ivopts makes the warning appear for cris-elf
too.  It was suggested to simply add -fno-ivopts to the
test-flags, like before -fno-tree-loop-distribute-patterns
was added; thus.

PR tree-optimization/108828
* gcc.dg/Wuse-after-free-2.c: Add -fno-ivopts.

16 months agoDaily bump.
GCC Administrator [Tue, 28 Feb 2023 00:18:40 +0000 (00:18 +0000)]
Daily bump.

16 months agoFortran: fix corner case of IBITS intrinsic [PR108937]
Harald Anlauf [Mon, 27 Feb 2023 20:37:11 +0000 (21:37 +0100)]
Fortran: fix corner case of IBITS intrinsic [PR108937]

gcc/fortran/ChangeLog:

PR fortran/108937
* trans-intrinsic.cc (gfc_conv_intrinsic_ibits): Handle corner case
LEN argument of IBITS equal to BITSIZE(I).

gcc/testsuite/ChangeLog:

PR fortran/108937
* gfortran.dg/ibits_2.f90: New test.

16 months agoi386: Do not constrain fmod and remainder patterns with flag_finite_math_only [PR108922]
Uros Bizjak [Mon, 27 Feb 2023 21:10:01 +0000 (22:10 +0100)]
i386: Do not constrain fmod and remainder patterns with flag_finite_math_only [PR108922]

According to Intel ISA manual, fprem and fprem1 return NaN when invalid
arithmetic exception is generated. This is documented in Table 8-10 of the
ISA manual and makes these two instructions fully IEEE compatible.

The reverted patch was based on the data from table 3-30 and 3-31 of the
Intel ISA manual, where results in case of st(0) being infinity or
st(1) being 0 are not specified.

2023-02-27  Uroš Bizjak  <ubizjak@gmail.com>

gcc/ChangeLog:

PR target/108922
Revert:
* config/i386/i386.md (fmodxf3): Enable for flag_finite_math_only only.
(fmod<mode>3): Ditto.
(fpremxf4_i387): Ditto.
(reminderxf3): Ditto.
(reminder<mode>3): Ditto.
(fprem1xf4_i387): Ditto.

16 months agoFix RTL simplifications of FFS, POPCOUNT and PARITY.
Roger Sayle [Mon, 27 Feb 2023 17:26:54 +0000 (17:26 +0000)]
Fix RTL simplifications of FFS, POPCOUNT and PARITY.

In 2011, the rtl.texi documentation was updated to reflect that the
modes of the RTX unary operations FFS, POPCOUNT and PARITY should
match those of their operands.  Unfortunately, some of the transformations
in simplify-rtx.cc predate this tightening of RTL semantics, and have
not (until now) been updated/fixed.  i.e. The POPCOUNT and PARITY
optimizations were "correct" when I added them back in 2007.

2023-02-27  Roger Sayle  <roger@nextmovesoftware.com>

gcc/ChangeLog
* simplify-rtx.cc (simplify_unary_operation_1) <case FFS>: Avoid
generating FFS with mismatched operand and result modes, by using
an explicit SIGN_EXTEND/ZERO_EXTEND.
<case POPCOUNT>: Likewise, for POPCOUNT of ZERO_EXTEND.
<case PARITY>: Likewise, for PARITY of {ZERO,SIGN}_EXTEND.

16 months agolibgm2/libm2pim/sckt.cc:254:3: warning: memset() called to fill 0 bytes [PR108944]
Gaius Mulley [Mon, 27 Feb 2023 16:29:18 +0000 (16:29 +0000)]
libgm2/libm2pim/sckt.cc:254:3: warning: memset() called to fill 0 bytes [PR108944]

The pattern parameter to memset is second.  Correct an obvious mistake
in libm2pim/sckt.cc.

libgm2/ChangeLog:

PR modula2/108944
* libm2pim/sckt.cc (getLocalIP): Correct parameter order.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
16 months agodon't declare header-defined functions both static and inline, cont.
Patrick Palka [Mon, 27 Feb 2023 15:12:25 +0000 (10:12 -0500)]
don't declare header-defined functions both static and inline, cont.

This fixes some header-defined functions that are undesirably declared
static and weren't caught by the "^static inline" pattern used for the
main patch r13-6096-gcb3e0eac262e55.

gcc/ChangeLog:

* hash-table.h (gt_pch_nx(hash_table<D>)): Remove static.
* lra-int.h (lra_change_class): Likewise.
* recog.h (which_op_alt): Likewise.
* sel-sched-ir.h (sel_bb_empty_or_nop_p): Declare inline
instead of static.

16 months agolibstdc++: Add Doxygen comment for string::resize_and_overwite
Jonathan Wakely [Thu, 23 Feb 2023 15:50:28 +0000 (15:50 +0000)]
libstdc++: Add Doxygen comment for string::resize_and_overwite

This is a complicated API that should be clearly documented.

Also improve the comment on basic_ios::_M_setstate.

libstdc++-v3/ChangeLog:

* include/bits/basic_ios.h (basic_ios::_M_setstate): Add
caveat to comment.
* include/bits/basic_string.h (resize_and_overwrite): Add
doxygen comment.

16 months agoxtensa: Make use of CLAMPS instruction if configured
Takayuki 'January June' Suwa [Sun, 26 Feb 2023 17:27:42 +0000 (02:27 +0900)]
xtensa: Make use of CLAMPS instruction if configured

This patch introduces the use of CLAMPS instruction when the instruction
is configured.

    /* example */
    int test(int a) {
      if (a < -512)
        return -512;
      if (a > 511)
        return 511;
      return a;
    }

    ;; prereq: TARGET_CLAMPS
    test:
clamps a2, a2, 9
ret.n

gcc/ChangeLog:

* config/xtensa/xtensa-protos.h (xtensa_match_CLAMPS_imms_p):
New prototype.
* config/xtensa/xtensa.cc (xtensa_match_CLAMPS_imms_p):
New function.
* config/xtensa/xtensa.h (TARGET_CLAMPS): New macro definition.
* config/xtensa/xtensa.md (*xtensa_clamps): New insn pattern.

16 months agogcc: xtensa: add XCHAL_HAVE_{CLAMPS,DEPBITS,EXCLUSIVE,XEA3} to dynconfig
Max Filippov [Mon, 27 Feb 2023 01:46:08 +0000 (17:46 -0800)]
gcc: xtensa: add XCHAL_HAVE_{CLAMPS,DEPBITS,EXCLUSIVE,XEA3} to dynconfig

gcc/
* config/xtensa/xtensa-dynconfig.cc (xtensa_get_config_v2)
(xtensa_get_config_v3): New functions.

include/
* xtensa-dynconfig.h (xtensa_config_v3): New struct.
(xtensa_get_config_v3): New declaration.
(XCHAL_HAVE_CLAMPS, XCHAL_HAVE_DEPBITS, XCHAL_HAVE_EXCLUSIVE)
(XCHAL_HAVE_XEA3, XTENSA_CONFIG_V3_ENTRY_LIST): New definitions.
(XTENSA_CONFIG_INSTANCE_LIST): Add xtensa_config_v3 instance.
(XTENSA_CONFIG_ENTRY_LIST): Add XTENSA_CONFIG_V3_ENTRY_LIST.

16 months agoaarch64: Fix typo in comment for aarch64_abs<mode>
Kyrylo Tkachov [Mon, 27 Feb 2023 09:59:10 +0000 (09:59 +0000)]
aarch64: Fix typo in comment for aarch64_abs<mode>

gcc/ChangeLog:

* config/aarch64/aarch64-simd.md (aarch64_abs<mode>): Fix typo in comment.

16 months agoLoongArch: Change the value of macro TRY_EMPTY_VM_SPACE from 0x8000000000 to 0x100000...
Lulu Cheng [Mon, 20 Feb 2023 08:47:11 +0000 (16:47 +0800)]
LoongArch: Change the value of macro TRY_EMPTY_VM_SPACE from 0x8000000000 to 0x1000000000.

The PCH mechanism first tries to map the .gch file to the virtual memory
space pointed to by TRY_EMPTY_VM_SPACE during the compilation process.

The original value of TRY_EMPTY_VM_SPACE macro is 0x8000000000,
but like la464 only has 40 bits of virtual address space, this value
just exceeds the address range.

If we want to support chips with less than 40 bits virtual addresses,
then the value of this macro needs to be set small. I think setting
this value small will increase the probability of virtual address
mapping failure. And the purpose of pch is to make compilation faster,
but I think we rarely compile on embedded systems. So this situation
may not be within our consideration.

So change the value of this macro to 0x1000000000.

gcc/ChangeLog:

* config/host-linux.cc (TRY_EMPTY_VM_SPACE): Modify the value of
the macro to 0x1000000000.

16 months agoDaily bump.
GCC Administrator [Mon, 27 Feb 2023 00:16:28 +0000 (00:16 +0000)]
Daily bump.

16 months agoRespect GNATMAKE Makefile variable
Peter Foley [Sun, 26 Feb 2023 17:52:50 +0000 (18:52 +0100)]
Respect GNATMAKE Makefile variable

gcc/ada/
PR ada/108909
* Make-generated.in: Use GNATMAKE.
* gcc-interface/Makefile.in: Ditto.

16 months agoAdjust example of compiler options for ACATS
Eric Botcazou [Wed, 22 Feb 2023 10:11:12 +0000 (11:11 +0100)]
Adjust example of compiler options for ACATS

gcc/testsuite/
* ada/acats/run_all.sh: Adjust example of compiler options.

16 months agoDaily bump.
GCC Administrator [Sun, 26 Feb 2023 00:17:15 +0000 (00:17 +0000)]
Daily bump.

16 months agoDisable tower socket runtest (gm2-simple-execute).
Gaius Mulley [Sat, 25 Feb 2023 22:12:23 +0000 (22:12 +0000)]
Disable tower socket runtest (gm2-simple-execute).

The projects-pim-run-pass-tower.exp test blocks indefinitely
on some platforms.  This patch disables it for now - it should
be enabled once a cross platform fix for RTint.mod is found.
Even disable the trivial execution test.

gcc/testsuite/ChangeLog:

* gm2/projects/pim/run/pass/tower/projects-pim-run-pass-tower.exp:
Also add conditional to gm2-simple-execute.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
16 months agoDisable tower socket runtest
Gaius Mulley [Sat, 25 Feb 2023 21:45:35 +0000 (21:45 +0000)]
Disable tower socket runtest

The projects-pim-run-pass-tower.exp test blocks indefinitely
on some platforms.  This patch disables it for now - it should
be enabled once a cross platform fix for RTint.mod is found.

gcc/testsuite/ChangeLog:

* gm2/projects/pim/run/pass/tower/projects-pim-run-pass-tower.exp
(gm2_run_tower_test): New global variable.  Add conditional
before invoking gm2-local-exec.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
16 months agofortran: Reuse associated_dummy memory if previously allocated [PR108923]
Mikael Morin [Sat, 25 Feb 2023 20:37:46 +0000 (21:37 +0100)]
fortran: Reuse associated_dummy memory if previously allocated [PR108923]

This avoids making the associted_dummy field point to a new memory chunk
if it's already pointing somewhere, in which case doing so would leak the
previously allocated chunk.

PR fortran/108923

gcc/fortran/ChangeLog:

* intrinsic.cc (get_intrinsic_dummy_arg,
set_intrinsic_dummy_arg): Rename the former to the latter.
Remove the return value, add a reference to the lhs as argument,
and do the pointer assignment inside the function.  Don't do
it if the pointer is already non-NULL.
(sort_actual): Update caller.

16 months agotestsuite: Don't include multiline patterns in the the pass/fail log
Hans-Peter Nilsson [Fri, 24 Feb 2023 17:41:13 +0000 (18:41 +0100)]
testsuite: Don't include multiline patterns in the the pass/fail log

I see overlong lines in the output when a test fails, for
example for a bug exposed for cris-elf and pru-elf in
gcc.dg/analyzer/allocation-size-multiline-3.c:

Running /x/gcc/testsuite/gcc.dg/analyzer/analyzer.exp ...
FAIL: gcc.dg/analyzer/allocation-size-multiline-3.c expected multiline pattern lines 16-25 not found: "\s*int32_t \*ptr = alloca \(99\);[^\n\r]*\n                  \^~~~~~\n  'test_constant_99': events 1-2[^\n\r]*\n    \|[^\n\r]*\n    \|   int32_t \*ptr = alloca \(99\);[^\n\r]*\n    \|                  \^~~~~~\n    \|                  \|[^\n\r]*\n    \|                  \(1\) allocated 99 bytes here[^\n\r]*\n    \|                  \(2\) assigned to 'int32_t \*' \{aka 'int \*'\} here; 'sizeof \(int32_t \{aka int\}\)' is '4'[^\n\r]*\n    \|[^\n\r]*\n"
FAIL: gcc.dg/analyzer/allocation-size-multiline-3.c expected multiline pattern lines 34-43 not found: "   int32_t \*ptr = alloca \(n \* 2\);[^\n\r]*\n                  \^~~~~~\n  'test_symbolic': events 1-2[^\n\r]*\n    \|[^\n\r]*\n    \|   int32_t \*ptr = alloca \(n \* 2\);[^\n\r]*\n    \|                  \^~~~~~\n    \|                  \|[^\n\r]*\n    \|                  \(1\) allocated 'n \* 2' bytes here[^\n\r]*\n    \|                  \(2\) assigned to 'int32_t \*' \{aka 'int \*'\} here; 'sizeof \(int32_t \{aka int\}\)' is '4'[^\n\r]*\n    \|[^\n\r]*\n"
FAIL: gcc.dg/analyzer/allocation-size-multiline-3.c (test for excess errors)

That multiline-pattern-quoted-on-a-single-line is redundant
when also outputting "lines 16-25" and "lines 34-43".  It's
also so noisy that it can be mistaken for a testsuite error.
If there's a need to inspect it, it can be seen at
verbose-level 4, i.e. persons interested in seeing it
without editing sources can just add "-v -v -v -v".

Let's "prune" the pattern from regular output, instead producing:
Running /x/gcc/testsuite/gcc.dg/analyzer/analyzer.exp ...
FAIL: gcc.dg/analyzer/allocation-size-multiline-3.c expected multiline pattern lines 16-25 not found
FAIL: gcc.dg/analyzer/allocation-size-multiline-3.c expected multiline pattern lines 34-43 not found
FAIL: gcc.dg/analyzer/allocation-size-multiline-3.c (test for excess errors)

* lib/multiline.exp (handle-multiline-outputs): Don't include the
quoted multiline pattern in the pass/fail output.

16 months agoFortran: fix memory leak with real to integer conversion warning
Harald Anlauf [Sat, 25 Feb 2023 18:05:38 +0000 (19:05 +0100)]
Fortran: fix memory leak with real to integer conversion warning

gcc/fortran/ChangeLog:

* arith.cc (gfc_real2int): Clear mpfr variable after use.

16 months agomodula-2 module registration process seems to fail with shared libraries [PR108261]
Gaius Mulley [Sat, 25 Feb 2023 16:28:19 +0000 (16:28 +0000)]
modula-2 module registration process seems to fail with shared libraries [PR108261]

The commit adds pathnames to modula-2 which in turn appears in any
external symbol.  This is necessary to allow different dialects of
libraries to coexist (different implementations of SYSTEM and Storage
for example in libm2pim and libm2iso).  It also makes it easier to
debug as the library name forms part of the external mangled name.
By default pathnames are not user facing.  This commit fixes
PR108261.

gcc/ChangeLog:

PR modula2/108261
* doc/gm2.texi (-fm2-pathname): New option documented.
(-fm2-pathnameI): New option documented.
(-fm2-prefix=): New option documented.
(-fruntime-modules=): Update default module list.

gcc/m2/ChangeLog:

PR modula2/108261
* Make-lang.in (GM2-COMP-BOOT-DEFS): DynamicStringPath.def
remove.  DynamicPath.def add.
(GM2-COMP-BOOT-MODS): DynamicStringPath.mod remove.
DynamicPath.mod add.
* Make-maintainer.in (BUILD-BOOT-PPG-H): New dependency.
(m2/gm2-ppg-boot/$(SRC_PREFIX)%.o): $(BUILD-BOOT-PPG-H) Add
dependency.
(PGE-DEF): New definition.
(BUILD-BOOT-PG-H): New dependency.
(m2/gm2-pg-boot/$(SRC_PREFIX)%.o): $(BUILD-BOOT-PG-H) Add
dependency.
(BUILD-BOOT-PGE-H): New dependency.
(m2/gm2-pge-boot/$(SRC_PREFIX)%.o): $(BUILD-BOOT-PGE-H) Add
dependency.
(GM2PATH): Add pathname entries.
(m2/boot-bin/mc-devel$(exeext)): Add m2/mc-boot-ch/Gm2rtsdummy.o
dependency.
(m2/boot-bin/mc-opt$(exeext)): Fix -I path.
* gm2-compiler/DynamicStringPath.def: Renamed module to
DynamicPath.
(GetUserPath): Remove.
(GetSystemPath): Remove.
(SetUserPath): Remove.
(SetSystemPath): Remove.
(DumpPath): New procedure definition.
* gm2-compiler/DynamicStringPath.mod: Renamed module to
DynamicPath.
(GetUserPath): Remove.
(GetSystemPath): Remove.
(SetUserPath): Remove.
(SetSystemPath): Remove.
(DumpPath): Remove Debugging conditional.
* gm2-compiler/M2AsmUtil.mod: Import EqualArray, NulName and
GetLibName.
(Debugging): New declaration.
(GetFullSymName): Re-implemented to prefix (mange) libname
to any extern variable/procedure which is IsExportQualified.
* gm2-compiler/M2Comp.mod (qprintLibName): New procedure.
* gm2-compiler/M2Graph.mod (resolveImports): Add libname.
* gm2-compiler/M2Options.def (SetM2Prefix): New procedure.
(GetM2Prefix): New procedure function.
(SetM2PathName): New procedure.
(GetM2PathName): New procedure function.
* gm2-compiler/M2Options.mod: (SetM2Prefix): New procedure implemented.
(GetM2Prefix): New procedure function implemented.
(SetM2PathName): New procedure implemented.
(GetM2PathName): New procedure function implemented.
(RuntimeModuleOverride): Set to DefaultRuntimeModuleOverride.
* gm2-compiler/M2Quads.mod: Import GetLibName.
(SafeRequestSym) Pass result of GetLibName to RequestDependant.
(callRequestDependant): Add libname as a parameter.
(BuildM2InitFunction): Add libname as a parameter.
(BuildM2FiniFunction): Add libname as a parameter.
(BuildM2CtorFunction): Add libname as a parameter.
* gm2-compiler/M2Scaffold.mod (LookupModuleSym): Set LibName
if a definition source was found.
* gm2-compiler/M2Search.def (FindSourceFile): Add named library parameter.
(FindSourceDefFile): Add named library parameter.
(FindSourceModFile): Add named library parameter.
* gm2-compiler/M2Search.mod (FindSourceFile): Reimplement.
(FindSourceDefFile): Add named library parameter.
(FindSourceModFile): Add named library parameter.
* gm2-compiler/SymbolTable.def (MakeProcedureCtorExtern): Add
libname parameter.
(PutLibName): New procedure.
(GetLibName): New procedure function.
* gm2-compiler/SymbolTable.mod (MakeProcedureCtorExtern): Add
libname parameter.
(GenName): Add libname parameter.
(InitCtorFields): Add moduleSym as a parameter.
(PutCtorExtern): Add libname parameter to GenName.
* gm2-gcc/init.cc (_M2_DynamicStringPath_init): Rename function...
(_M2_DynamicPath_init): ...to this.
(_M2_PathName_init): Added.
* gm2-gcc/m2decl.cc (m2decl_DeclareM2linkStaticInitialization):
Add m2pim as the manged component of the exported symbol.
(m2decl_DeclareM2linkForcedModuleInitOrder): Add m2pim mangle prefix.
* gm2-gcc/m2options.h (M2Options_SetM2Prefix): New function.
(M2Options_GetM2Prefix): New function.
(M2Options_SetM2PathName): New function.
(M2Options_GetM2PathName): New function.
* gm2-lang.cc (push_back_Ipath): New function.
(add_one_import_path): New function.
(gm2_langhook_handle_option): Record -I component.  Call
SetM2PathName when -fm2-pathname= is seen.  Record -fm2-pathnameI
component.  Call SetM2Prefix when -fm2-prefix= is seen.
(gm2_langhook_post_options): Iterative over pathname entries
and call SetM2PathName, SetSearchPath as appropriate.
* gm2-libs-iso/M2RTS.def (ConstructModules): Add libname parameter.
(DeconstructModules): Add libname parameter.
(RegisterModule): Add libname parameter.
(RequestDependant): Add libname parameter.
* gm2-libs-iso/M2RTS.mod (ConstructModules): Add libname parameter.
(DeconstructModules): Add libname parameter.
(RegisterModule): Add libname parameter.
(RequestDependant): Add libname parameter.
* gm2-libs-min/M2RTS.def (ConstructModules): Add libname parameter.
(DeconstructModules): Add libname parameter.
(RegisterModule): Add libname parameter.
(RequestDependant): Add libname parameter.
* gm2-libs-min/M2RTS.mod (ConstructModules): Add libname parameter.
(DeconstructModules): Add libname parameter.
(RegisterModule): Add libname parameter.
(RequestDependant): Add libname parameter.
* gm2-libs/M2Dependent.def (ConstructModules): Add libname parameter.
(DeconstructModules): Add libname parameter.
(RegisterModule): Add libname parameter.
(RequestDependant): Add libname parameter.
* gm2-libs/M2Dependent.mod (ConstructModules): Add libname parameter.
(DeconstructModules): Add libname parameter.
(RegisterModule): Add libname parameter.
(RequestDependant): Add libname parameter.
* gm2-libs/M2RTS.def (ConstructModules): Add libname parameter.
(DeconstructModules): Add libname parameter.
(RegisterModule): Add libname parameter.
(RequestDependant): Add libname parameter.
* gm2-libs/M2RTS.mod (ConstructModules): Add libname parameter.
(DeconstructModules): Add libname parameter.
(RegisterModule): Add libname parameter.
(RequestDependant): Add libname parameter.
* gm2-libs/RTint.mod (FindVector): Rename variables.
(initInputVector): Rename variables.
(initOutputVector): Rename variables.
(InitTimeVector): Rename variables.
(FindVectorNo): Rename variables.
(FindPendingVector): Rename variables.
(ReArmTimeVector): Rename variables.
(GetTimeVector): Rename variables.
(AttachVector): Rename variables.
(AttachVector): Rename variables.
(IncludeVector): Rename variables.
(ExcludeVector): Rename variables.
(AddFd): Rename variables.
(AddFd): Rename variables.
(DumpPendingQueue): Rename variables.
(stop): Remove.
(activatePending): Rename variables.
(Listen): Rename variables.
* gm2-libs/libc.def (snprintf): New function.
* gm2-libs/sckt.def: Change all exported identifiers to be
export qualified.
* gm2spec.cc (push_back_Ipath): New function.
(add_m2_I_path): New function.
(lang_specific_driver): Skip -fm2-pathname= and remember pathname.
Skip -I and record the path and current pathname.  Call add_m2_I_path.
* lang-specs.h: Replace %{I*} with %{fm2-pathname*}.
* lang.opt (-fm2-pathname=): New entry.
(-fm2-pathname): New entry.
(-fm2-prefix=): New entry.
* mc-boot-ch/GUnixArgs.cc (_M2_UnixArgs_dep): New function.
(_M2_UnixArgs_ctor::_M2_UnixArgs_ctor): New method.
* mc-boot-ch/Glibc.c (libc_snprintf): New function.
* mc-boot-ch/m2rts.h (M2RTS_RequestDependant): Changed prototype.
(M2RTS_RegisterModule): Changed prototype.
* mc-boot/GDynamicStrings.c: Rebuild.
* mc-boot/GFIO.c: Rebuild.
* mc-boot/GIndexing.c: Rebuild.
* mc-boot/GM2Dependent.c: Rebuild.
* mc-boot/GM2Dependent.h: Rebuild.
* mc-boot/GM2EXCEPTION.c: Rebuild.
* mc-boot/GM2RTS.c: Rebuild.
* mc-boot/GM2RTS.h: Rebuild.
* mc-boot/GPushBackInput.c: Rebuild.
* mc-boot/GRTExceptions.c: Rebuild.
* mc-boot/GRTint.c: Rebuild.
* mc-boot/GStdIO.c: Rebuild.
* mc-boot/GStringConvert.c: Rebuild.
* mc-boot/GSysStorage.c: Rebuild.
* mc-boot/Gdecl.c: Rebuild.
* mc-boot/Gkeyc.c: Rebuild.
* mc-boot/Glibc.h: Rebuild.
* mc-boot/GmcComment.c: Rebuild.
* mc-boot/GmcComp.c: Rebuild.
* mc-boot/GmcDebug.c: Rebuild.
* mc-boot/GmcMetaError.c: Rebuild.
* mc-boot/GmcStack.c: Rebuild.
* mc-boot/GnameKey.c: Rebuild.
* mc-boot/GsymbolKey.c: Rebuild.
* pge-boot/GASCII.c: Rebuild.
* pge-boot/GArgs.c: Rebuild.
* pge-boot/GAssertion.c: Rebuild.
* pge-boot/GDebug.c: Rebuild.
* pge-boot/GDynamicStrings.c: Rebuild.
* pge-boot/GFIO.c: Rebuild.
* pge-boot/GIO.c: Rebuild.
* pge-boot/GIndexing.c: Rebuild.
* pge-boot/GLists.c: Rebuild.
* pge-boot/GM2Dependent.c: Rebuild.
* pge-boot/GM2Dependent.h: Rebuild.
* pge-boot/GM2EXCEPTION.c: Rebuild.
* pge-boot/GM2RTS.c: Rebuild.
* pge-boot/GM2RTS.h: Rebuild.
* pge-boot/GNameKey.c: Rebuild.
* pge-boot/GNumberIO.c: Rebuild.
* pge-boot/GOutput.c: Rebuild.
* pge-boot/GPushBackInput.c: Rebuild.
* pge-boot/GRTExceptions.c: Rebuild.
* pge-boot/GSFIO.c: Rebuild.
* pge-boot/GStdIO.c: Rebuild.
* pge-boot/GStorage.c: Rebuild.
* pge-boot/GStrCase.c: Rebuild.
* pge-boot/GStrIO.c: Rebuild.
* pge-boot/GStrLib.c: Rebuild.
* pge-boot/GSymbolKey.c: Rebuild.
* pge-boot/GSysExceptions.c (_M2_SysExceptions_finish): Rename this...
(_M2_SysExceptions_fini): ... to this.
* pge-boot/GSysStorage.c: Rebuild.
(_M2_SysStorage_finish): Rename this...
(_M2_SysStorage_fini): ... to this.
* pge-boot/GUnixArgs.cc: New file.
* pge-boot/Gbnflex.c (_M2_bnflex_finish): Rename this...
(_M2_bnflex_fini): ... to this.
* pge-boot/Gerrno.c (_M2_errno_finish): Rename this...
(_M2_errno_fini): ... to this.
* pge-boot/Glibc.c (libc_snprintf): New function.
* pge-boot/Glibc.h (libc_snprintf): New prototype.
* pge-boot/Gpge.c (_M2_pge_finish): Rename this...
(_M2_pge_fini): ... to this.
* pge-boot/Gtermios.cc (_M2_termios_finish): Rename this...
(_M2_termios_fini): ... to this.
* pge-boot/main.c (_M2_RTExceptions_finish): Rename this...
(_M2_RTExceptions_fini): ... to this.
(_M2_M2EXCEPTION_finish): Rename this...
(_M2_M2EXCEPTION_fini): ... to this.
(_M2_M2RTS_finish): Rename this...
(_M2_M2RTS_fini): ... to this.
(_M2_SysExceptions_finish): Rename this...
(_M2_SysExceptions_fini): ... to this.
(_M2_StrLib_finish): Rename this...
(_M2_StrLib_fini): ... to this.
(_M2_errno_finish): Rename this...
(_M2_errno_fini): ... to this.
(_M2_termios_finish): Rename this...
(_M2_termios_fini): ... to this.
(_M2_IO_finish): Rename this...
(_M2_IO_fini): ... to this.
(_M2_StdIO_finish): Rename this...
(_M2_StdIO_fini): ... to this.
(_M2_Debug_finish): Rename this...
(_M2_Debug_fini): ... to this.
(_M2_SysStorage_finish): Rename this...
(_M2_SysStorage_fini): ... to this.
(_M2_Storage_finish): Rename this...
(_M2_Storage_fini): ... to this.
(_M2_StrIO_finish): Rename this...
(_M2_StrIO_fini): ... to this.
(_M2_DynamicStrings_finish): Rename this...
(_M2_DynamicStrings_fini): ... to this.
(_M2_Assertion_finish): Rename this...
(_M2_Assertion_fini): ... to this.
(_M2_Indexing_finish): Rename this...
(_M2_Indexing_fini): ... to this.
(_M2_NameKey_finish): Rename this...
(_M2_NameKey_fini): ... to this.
(_M2_NumberIO_finish): Rename this...
(_M2_NumberIO_fini): ... to this.
(_M2_PushBackInput_finish): Rename this...
(_M2_PushBackInput_fini): ... to this.
(_M2_SymbolKey_finish): Rename this...
(_M2_SymbolKey_fini): ... to this.
(_M2_UnixArgs_finish): Rename this...
(_M2_UnixArgs_fini): ... to this.
(_M2_FIO_finish): Rename this...
(_M2_FIO_fini): ... to this.
(_M2_SFIO_finish): Rename this...
(_M2_SFIO_fini): ... to this.
(_M2_StrCase_finish): Rename this...
(_M2_StrCase_fini): ... to this.
(_M2_bnflex_finish): Rename this...
(_M2_bnflex_fini): ... to this.
(_M2_Lists_finish): Rename this...
(_M2_Lists_fini): ... to this.
(_M2_Args_finish): Rename this...
(_M2_Args_fini): ... to this.
(_M2_Output_finish): Rename this...
(_M2_Output_fini): ... to this.
(_M2_pge_finish): Rename this...
(_M2_pge_fini): ... to this.
* plugin/m2rte.cc (m2_runtime_error_calls): Change all runtime
procedure names to their name mangled counterparts.
* gm2-libs-iso/wrapsock.c: Removed.
* gm2-libs-iso/wraptime.c: Removed.
* mc-boot/Gpth.h: Removed.
* gm2-compiler/PathName.def: New file.
* gm2-compiler/PathName.mod: New file.

libgm2/ChangeLog:

PR modula2/108261
* libm2cor/KeyBoardLEDs.cc (EXPORT): New define.
(M2EXPORT): New define.
(M2LIBNAME): New define.
(KeyBoardLEDs_SwitchScroll): EXPORT.
(KeyBoardLEDs_SwitchNum): EXPORT.
(KeyBoardLEDs_SwitchCaps): EXPORT.
(KeyBoardLEDs_SwitchLeds): EXPORT.
(_M2_KeyBoardLEDs_init): M2EXPORT.
(_M2_KeyBoardLEDs_finish): M2EXPORT.
(_M2_KeyBoardLEDs_dep): M2EXPORT.
* libm2cor/Makefile.am (libm2cor_la_M2FLAGS): Define
path names.
* libm2cor/Makefile.in: Rebuild.
* libm2iso/ErrnoCategory.cc (EXPORT): New define.
(M2EXPORT): New define.
(M2LIBNAME): New define.
(ErrnoCategory_IsErrnoHard): EXPORT.
(ErrnoCategory_IsErrnoSoft): EXPORT.
(ErrnoCategory_UnAvailable): EXPORT.
(ErrnoCategory_GetOpenResults): EXPORT.
(_M2_ErrnoCategory_init): M2EXPORT.
(_M2_ErrnoCategory_fini): M2EXPORT.
(_M2_ErrnoCategory_dep): M2EXPORT.
(_M2_ErrnoCategory_ctor): M2EXPORT.
* libm2iso/Makefile.am (libm2iso_la_M2FLAGS): Define
path names.
* libm2iso/Makefile.in: Rebuild.
* libm2iso/RTco.cc (EXPORT): New define.
(M2EXPORT): New define.
(M2LIBNAME): New define.
(newSem): Add module libname prefix to HaltC.
(currentThread): Remove variable and replace with a function.
(never): Add module libname prefix to HaltC.
(initThread): Add module libname prefix to HaltC.
* libm2iso/m2rts.h (str): New define.
(M2RTS_RequestDependant): Change to the mangled name equivalent.
(M2RTS_RegisterModule): Change to the mangled name equivalent.
(m2iso_M2RTS_RequestDependant): Add libname parameter.
(m2iso_M2RTS_RegisterModule): Add libname parameter.
(m2pim_M2RTS_RegisterModule): Add libname parameter.
(_M2_M2RTS_init): Rename this...
(m2iso_M2_M2RTS_init): ...to this.
(M2RTS_ConstructModules): Change to the mangled name equivalent.
(M2RTS_Terminate): Change to the mangled name equivalent.
(M2RTS_DeconstructModules): Change to the mangled name equivalent.
(m2iso_M2RTS_ConstructModules): Add libname parameter.
(m2iso_M2RTS_Terminate): Add libname parameter.
(m2iso_M2RTS_DeconstructModules): Add libname parameter.
(M2RTS_HaltC): Rename this...
(m2iso_M2RTS_HaltC): ...to this.
* libm2iso/wrapsock.c (EXPORT): New define.
(IMPORT): New define.
(M2EXPORT): New define.
(M2LIBNAME): New define.
(m2iso_M2RTS_RequestDependant): Add prototype.
(wrapsock_clientOpen): EXPORT.
(wrapsock_clientOpenIP): EXPORT.
(wrapsock_getClientPortNo): EXPORT.
(wrapsock_getClientHostname): EXPORT.
(wrapsock_getClientSocketFd): EXPORT.
(wrapsock_getClientIP): EXPORT.
(wrapsock_getPushBackChar): EXPORT.
(wrapsock_setPushBackChar): EXPORT.
(wrapsock_getSizeOfClientInfo): EXPORT.
(_M2_wrapsock_init): M2EXPORT.
(_M2_wrapsock_fini): M2EXPORT.
(ctor): M2EXPORT.  New function.
* libm2iso/wraptime.c: Rename to...
* libm2iso/wraptime.cc: ...this.
(EXPORT): New define.
(M2EXPORT): New define.
(M2LIBNAME): New define.
(wraptime_InitTimeval): EXPORT.
(wraptime_KillTimeval): EXPORT.
(wraptime_InitTimezone): EXPORT.
(wraptime_KillTimezone): EXPORT.
(wraptime_InitTM): EXPORT.
(wraptime_KillTM): EXPORT.
(wraptime_gettimeofday): EXPORT.
(wraptime_settimeofday): EXPORT.
(wraptime_GetFractions): EXPORT.
(wraptime_localtime_r): EXPORT.
(wraptime_GetYear): EXPORT.
(wraptime_GetMonth): EXPORT.
(wraptime_GetDay): EXPORT.
(wraptime_GetHour): EXPORT.
(wraptime_GetMinute): EXPORT.
(wraptime_GetSecond): EXPORT.
(wraptime_GetSummerTime): EXPORT.
(wraptime_GetDST): EXPORT.
(wraptime_SetTimezone): EXPORT.
(wraptime_SetTimeval): EXPORT.
(_M2_wraptime_init): M2EXPORT.
(_M2_wraptime_fini): M2EXPORT.
(ctor): M2EXPORT.  New function.
* libm2log/Makefile.am (libm2log_la_M2FLAGS): Define
path names.
* libm2log/Makefile.in:
* libm2min/Makefile.am (libm2min_la_M2FLAGS): Define
path names.
* libm2min/Makefile.in:
* libm2pim/Makefile.am (libm2pim_la_M2FLAGS): Define
path names.
* libm2pim/Makefile.in:
* libm2pim/Selective.cc (EXPORT): New define.
(M2EXPORT): New define.
(M2LIBNAME): New define.
(Selective_Select): EXPORT.
(Selective_InitTime): EXPORT.
(Selective_GetTime): EXPORT.
(Selective_SetTime): EXPORT.
(Selective_KillTime): EXPORT.
(Selective_InitSet): EXPORT.
(Selective_KillSet): EXPORT.
(Selective_FdZero): EXPORT.
(Selective_FdSet): EXPORT.
(Selective_FdClr): EXPORT.
(Selective_FdIsSet): EXPORT.
(Selective_GetTimeOfDay): EXPORT.
(Selective_MaxFdsPlusOne): EXPORT.
(Selective_WriteCharRaw): EXPORT.
(Selective_ReadCharRaw): EXPORT.
(_M2_Selective_init): M2EXPORT.
(_M2_Selective_fini): M2EXPORT.
(_M2_Selective_dep): M2EXPORT.
(_M2_Selective_ctor): M2EXPORT.
* libm2pim/SysExceptions.cc (EXPORT): New define.
(M2EXPORT): New define.
(M2LIBNAME): New define.
(SysExceptions_InitExceptionHandlers): EXPORT.
(_M2_SysExceptions_init): M2EXPORT.
(_M2_SysExceptions_fini): M2EXPORT.
(_M2_SysExceptions_dep): M2EXPORT.
(_M2_SysExceptions_ctor): M2EXPORT.
* libm2pim/UnixArgs.cc (EXPORT): New define.
(M2EXPORT): New define.
(M2LIBNAME): New define.
(UnixArgs_GetArgC): EXPORT.
(UnixArgs_GetArgV): EXPORT.
(UnixArgs_GetEnvV): EXPORT.
(_M2_UnixArgs_init): M2EXPORT.
(_M2_UnixArgs_fini): M2EXPORT.
(_M2_UnixArgs_dep): M2EXPORT.
(_M2_UnixArgs_ctor): M2EXPORT.
* libm2pim/cgetopt.cc (EXPORT): New define.
(M2EXPORT): New define.
(M2LIBNAME): New define.
(cgetopt_getopt): EXPORT.
(cgetopt_getopt_long): EXPORT.
(cgetopt_getopt_long_only): EXPORT.
(cgetopt_InitOptions): EXPORT.
(cgetopt_KillOptions): EXPORT.
(cgetopt_SetOption): EXPORT.
(cgetopt_GetLongOptionArray): EXPORT.
(_M2_cgetopt_init): M2EXPORT.
(_M2_cgetopt_fini): M2EXPORT.
(_M2_cgetopt_dep): M2EXPORT.
(_M2_cgetopt_ctor): M2EXPORT.
* libm2pim/dtoa.cc (EXPORT): New define.
(M2EXPORT): New define.
(M2LIBNAME): New define.
(dtoa_strtod): EXPORT.
(dtoa_calcmaxsig): EXPORT.
(dtoa_calcdecimal): EXPORT.
(dtoa_calcsign): EXPORT.
(dtoa_dtoa): EXPORT.
(_M2_dtoa_init): M2EXPORT.
(_M2_dtoa_fini): M2EXPORT.
(_M2_dtoa_dep): M2EXPORT.
(_M2_dtoa_ctor): M2EXPORT.
* libm2pim/errno.cc (EXPORT): New define.
(M2EXPORT): New define.
(M2LIBNAME): New define.
(errno_geterrno): EXPORT.
(_M2_errno_init): M2EXPORT.
(_M2_errno_fini): M2EXPORT.
(_M2_errno_dep): M2EXPORT.
(_M2_errno_ctor): M2EXPORT.
* libm2pim/ldtoa.cc (EXPORT): New define.
(IMPORT): New define.
(M2EXPORT): New define.
(M2LIBNAME): New define.
(dtoa_calcmaxsig): EXPORT.
(dtoa_calcdecimal): EXPORT.
(dtoa_calcsign): EXPORT.
(ldtoa_strtold): EXPORT.
(ldtoa_ldtoa): EXPORT.
(_M2_ldtoa_init): M2EXPORT.
(_M2_ldtoa_fini): M2EXPORT.
(_M2_ldtoa_dep): M2EXPORT.
(_M2_ldtoa_ctor): M2EXPORT.
* libm2pim/sckt.cc (EXPORT): New define.
(M2EXPORT): New define.
(M2LIBNAME): New define.
(tcpServerEstablishPort): EXPORT.
(tcpServerEstablish): EXPORT.
(tcpServerAccept): EXPORT.
(tcpServerPortNo): EXPORT.
(tcpServerSocketFd): EXPORT.
(getLocalIP): EXPORT.
(tcpServerIP): EXPORT.
(tcpServerClientIP): EXPORT.
(tcpServerClientPortNo): EXPORT.
(tcpClientSocket): EXPORT.
(tcpClientSocketIP): EXPORT.
(tcpClientConnect): EXPORT.
(tcpClientPortNo): EXPORT.
(tcpClientSocketFd): EXPORT.
(tcpClientIP): EXPORT.
(_M2_sckt_init): M2EXPORT.
(_M2_sckt_finish): M2EXPORT.
(_M2_sckt_dep): M2EXPORT.
(_M2_sckt_ctor): M2EXPORT.
* libm2pim/termios.cc (EXPORT): New define.
(M2EXPORT): New define.
(M2LIBNAME): New define.
(_M2_termios_init): M2EXPORT.
(_M2_termios_fini): M2EXPORT.
(_M2_termios_dep): M2EXPORT.
(_M2_termios_ctor): M2EXPORT.
* libm2pim/wrapc.c (EXPORT): New define.
(M2EXPORT): New define.
(M2LIBNAME): New define.
(wrapc_strtime): EXPORT.
(wrapc_filesize): EXPORT.
(wrapc_filemtime): EXPORT.
(wrapc_fileinode): EXPORT.
(wrapc_getrand): EXPORT.
(wrapc_getusername): EXPORT.
(wrapc_getnameuidgid): EXPORT.
(wrapc_signbit): EXPORT.
(wrapc_signbitl): EXPORT.
(wrapc_signbitf): EXPORT.
(wrapc_isfinite): EXPORT.
(wrapc_isfinitel): EXPORT.
(wrapc_isfinitef): EXPORT.
(_M2_wrapc_init): M2EXPORT.
(_M2_wrapc_fini): M2EXPORT.
(_M2_wrapc_ctor): M2EXPORT.

gcc/testsuite/ChangeLog:

PR modula2/108261
* gm2/examples/callingC/pass/examples-callingC-pass.exp: Tidy up
variable access.
* gm2/examples/callingC/run/pass/examples-callingC-run-pass.exp: Tidy up
variable access.
* gm2/examples/cpp/pass/examples-cpp-pass.exp: Tidy up
variable access.
* gm2/examples/cppDef/pass/examples-cppDef-pass.exp: Tidy up
variable access.
* gm2/examples/hello/pass/examples-hello-pass.exp: Tidy up
variable access.
* gm2/examples/map/pass/examples-map-pass.exp: Tidy up
variable access.
* gm2/iso/check/fail/iso-check-fail.exp: Add pathname.
* gm2/link/externalscaffold/pass/link-externalscaffold-pass.exp:
Add pathname.
* gm2/link/externalscaffold/pass/scaffold.c: Add mangled export name.
* gm2/pimlib/base/run/pass/FIO.mod: Updated test code.
* gm2/pimlib/base/run/pass/StrLib.mod: Updated test code.
* gm2/pimlib/base/run/pass/pimlib-base-run-pass.exp: Remove path.
* gm2/projects/pim/run/pass/random/projects-pim-run-pass-random.exp:
Tidy up variable access.
* gm2/switches/auto-init/fail/switches-auto-init-fail.exp: Add pathname.
* gm2/switches/check-all/pim2/fail/switches-check-all-pim2-fail.exp:
Add pathname.
* gm2/switches/makeall/fail/switches-makeall-fail.exp: Remove -fmakeall.
* gm2/switches/makeall/pass/switches-makeall-pass.exp: Remove -fmakeall.
* lib/gm2-simple.exp (gm2_keep_executable): New global variable.
(gm2_simple_execute): Keep executable if global is true.
* lib/gm2-torture.exp: Add ; after global variable access.
* lib/gm2.exp: Set up pathnames.
* gm2/projects/pim/run/pass/tower/AdvCmd.def: New test.
* gm2/projects/pim/run/pass/tower/AdvCmd.mod: New test.
* gm2/projects/pim/run/pass/tower/AdvIntroduction.def: New test.
* gm2/projects/pim/run/pass/tower/AdvIntroduction.mod: New test.
* gm2/projects/pim/run/pass/tower/AdvMap.def: New test.
* gm2/projects/pim/run/pass/tower/AdvMap.mod: New test.
* gm2/projects/pim/run/pass/tower/AdvMath.def: New test.
* gm2/projects/pim/run/pass/tower/AdvMath.mod: New test.
* gm2/projects/pim/run/pass/tower/AdvParse.bnf: New test.
* gm2/projects/pim/run/pass/tower/AdvParse.def: New test.
* gm2/projects/pim/run/pass/tower/AdvParse.mod: New test.
* gm2/projects/pim/run/pass/tower/AdvSound.def: New test.
* gm2/projects/pim/run/pass/tower/AdvSound.mod: New test.
* gm2/projects/pim/run/pass/tower/AdvSystem.def: New test.
* gm2/projects/pim/run/pass/tower/AdvSystem.mod: New test.
* gm2/projects/pim/run/pass/tower/AdvTreasure.def: New test.
* gm2/projects/pim/run/pass/tower/AdvTreasure.mod: New test.
* gm2/projects/pim/run/pass/tower/AdvUtil.def: New test.
* gm2/projects/pim/run/pass/tower/AdvUtil.mod: New test.
* gm2/projects/pim/run/pass/tower/DrawG.def: New test.
* gm2/projects/pim/run/pass/tower/DrawG.mod: New test.
* gm2/projects/pim/run/pass/tower/DrawL.def: New test.
* gm2/projects/pim/run/pass/tower/DrawL.mod: New test.
* gm2/projects/pim/run/pass/tower/Dungeon.mod: New test.
* gm2/projects/pim/run/pass/tower/Lock.def: New test.
* gm2/projects/pim/run/pass/tower/Lock.mod: New test.
* gm2/projects/pim/run/pass/tower/ProcArgs.def: New test.
* gm2/projects/pim/run/pass/tower/ProcArgs.mod: New test.
* gm2/projects/pim/run/pass/tower/Screen.def: New test.
* gm2/projects/pim/run/pass/tower/Screen.mod: New test.
* gm2/projects/pim/run/pass/tower/SocketControl.c: New test.
* gm2/projects/pim/run/pass/tower/SocketControl.def: New test.
* gm2/projects/pim/run/pass/tower/Window.def: New test.
* gm2/projects/pim/run/pass/tower/Window.mod: New test.
* gm2/projects/pim/run/pass/tower/adv.flex: New test.
* gm2/projects/pim/run/pass/tower/advflex.c: New test.
* gm2/projects/pim/run/pass/tower/advflex.def: New test.
* gm2/projects/pim/run/pass/tower/projects-pim-run-pass-tower.exp:
New test.
* gm2/projects/pim/run/pass/tower/star: New test.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
16 months agogcc: xtensa: fix PR target/108919
Max Filippov [Wed, 22 Feb 2023 22:17:11 +0000 (14:17 -0800)]
gcc: xtensa: fix PR target/108919

gcc/
PR target/108919

* config/xtensa/xtensa-protos.h
(xtensa_prepare_expand_call): Rename to xtensa_expand_call.
* config/xtensa/xtensa.cc (xtensa_prepare_expand_call): Rename
to xtensa_expand_call.
(xtensa_expand_call): Emit the call and add a clobber expression
for the static chain to it in case of windowed ABI.
* config/xtensa/xtensa.md (call, call_value, sibcall)
(sibcall_value): Call xtensa_expand_call and complete expansion
right after that call.

gcc/testsuite/
* gcc.target/xtensa/pr108919.c: New test.

16 months agoFortran: Skip bound conv in gfc_conv_gfc_desc_to_cfi_desc with intent(out) ptr [PR108621]
Tobias Burnus [Sat, 25 Feb 2023 10:55:08 +0000 (11:55 +0100)]
Fortran: Skip bound conv in gfc_conv_gfc_desc_to_cfi_desc with intent(out) ptr [PR108621]

When the dummy argument of the bind(C) proc is 'pointer, intent(out)', the conversion
of the GFC to the CFI bounds can be skipped: it is not needed and avoids issues with
noninit memory.

Note that the 'cfi->base_addr = gfc->addr' assignment is kept as the C code of a user
might assume that a nullified pointer arrives as NULL (or even a specific value).
For instance, gfortran.dg/c-interop/section-{1,2}.f90 assumes the value NULL.

Note 2: The PR is about a may-be-uninitialized warning with intent(out). In the PR's
testcase, the pointer was nullified and should not have produced that warning.
That is a diagnostic issue, now tracked as PR middle-end/108906 as the issue in principle
still exists (e.g. with 'intent(inout)'). [But no longer for intent(out).]

Note 3: With undefined pointers and no 'intent', accessing uninit memory is unavoidable
on the caller side as the compiler cannot know what the C function does (but this usage
determines whether the pointer is permitted be undefined or whether the bounds must be
gfc-to-cfi converted).

gcc/fortran/ChangeLog:

PR fortran/108621
* trans-expr.cc (gfc_conv_gfc_desc_to_cfi_desc): Skip setting of
bounds of CFI desc for 'pointer,intent(out)'.

gcc/testsuite/ChangeLog:

PR fortran/108621
* gfortran.dg/c-interop/fc-descriptor-pr108621.f90: New test.

16 months agoDaily bump.
GCC Administrator [Sat, 25 Feb 2023 00:17:49 +0000 (00:17 +0000)]
Daily bump.

16 months agoUpdate .po files
Joseph Myers [Fri, 24 Feb 2023 22:46:33 +0000 (22:46 +0000)]
Update .po files

gcc/po/
* 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.

libcpp/po/
* be.po, ca.po, da.po, de.po, el.po, eo.po, es.po, fi.po, fr.po,
id.po, ja.po, ka.po, nl.po, pt_BR.po, ro.po, ru.po, sr.po, sv.po,
tr.po, uk.po, vi.po, zh_CN.po, zh_TW.po: Update.

16 months agoFortran: Add support for WEAK attribute for variables
Rimvydas Jasinskas [Fri, 24 Feb 2023 04:41:00 +0000 (04:41 +0000)]
Fortran: Add support for WEAK attribute for variables

Add the rest of the weak-*.f90 testcases.

gcc/fortran/ChangeLog:

* trans-decl.cc (gfc_finish_var_decl): Apply attribute.
(generate_local_decl): Add diagnostic for dummy and local variables.

gcc/testsuite/ChangeLog:

* gfortran.dg/weak-2.f90: New test.
* gfortran.dg/weak-3.f90: New test.

Signed-off-by: Rimvydas Jasinskas <rimvydas.jas@gmail.com>
16 months agofortran: Plug leak of associated_dummy memory. [PR108923]
Mikael Morin [Fri, 24 Feb 2023 21:11:17 +0000 (22:11 +0100)]
fortran: Plug leak of associated_dummy memory. [PR108923]

This fixes a memory leak by accompanying the release of
gfc_actual_arglist elements' memory with a release of the
associated_dummy field memory (if allocated).
Actual argument copy is adjusted as well so that each copy can free
its field independently.

PR fortran/108923

gcc/fortran/ChangeLog:

* expr.cc (gfc_free_actual_arglist): Free associated_dummy
memory.
(gfc_copy_actual_arglist): Make a copy of the associated_dummy
field if it is set in the original element.

16 months agoFortran: frontend passes do_subscript leaks gmp memory [PR108924]
Harald Anlauf [Fri, 24 Feb 2023 18:56:32 +0000 (19:56 +0100)]
Fortran: frontend passes do_subscript leaks gmp memory [PR108924]

gcc/fortran/ChangeLog:

PR fortran/108924
* frontend-passes.cc (do_subscript): Clear used gmp variable.

16 months agolibstdc++: Fix formatting
Matthias Kretz [Tue, 21 Feb 2023 07:48:18 +0000 (08:48 +0100)]
libstdc++: Fix formatting

Whitespace changes only.

Signed-off-by: Matthias Kretz <m.kretz@gsi.de>
libstdc++-v3/ChangeLog:

* include/experimental/bits/simd.h: Line breaks and indenting
fixed to follow the libstdc++ standard.
* include/experimental/bits/simd_builtin.h: Likewise.
* include/experimental/bits/simd_fixed_size.h: Likewise.
* include/experimental/bits/simd_neon.h: Likewise.
* include/experimental/bits/simd_ppc.h: Likewise.
* include/experimental/bits/simd_scalar.h: Likewise.
* include/experimental/bits/simd_x86.h: Likewise.

16 months agolibstdc++: Always-inline most of non-cmath fixed_size implementation
Matthias Kretz [Mon, 20 Feb 2023 16:49:37 +0000 (17:49 +0100)]
libstdc++: Always-inline most of non-cmath fixed_size implementation

For simd, the inlining behavior should be similar to builtin types. (No
operator on buitin types is ever translated into a function call.)
Therefore, always_inline is the right choice (i.e. inline on -O0 as
well).

Signed-off-by: Matthias Kretz <m.kretz@gsi.de>
libstdc++-v3/ChangeLog:

PR libstdc++/108030
* include/experimental/bits/simd_fixed_size.h
(_SimdImplFixedSize::_S_broadcast): Replace inline with
_GLIBCXX_SIMD_INTRINSIC.
(_SimdImplFixedSize::_S_generate): Likewise.
(_SimdImplFixedSize::_S_load): Likewise.
(_SimdImplFixedSize::_S_masked_load): Likewise.
(_SimdImplFixedSize::_S_store): Likewise.
(_SimdImplFixedSize::_S_masked_store): Likewise.
(_SimdImplFixedSize::_S_min): Likewise.
(_SimdImplFixedSize::_S_max): Likewise.
(_SimdImplFixedSize::_S_complement): Likewise.
(_SimdImplFixedSize::_S_unary_minus): Likewise.
(_SimdImplFixedSize::_S_plus): Likewise.
(_SimdImplFixedSize::_S_minus): Likewise.
(_SimdImplFixedSize::_S_multiplies): Likewise.
(_SimdImplFixedSize::_S_divides): Likewise.
(_SimdImplFixedSize::_S_modulus): Likewise.
(_SimdImplFixedSize::_S_bit_and): Likewise.
(_SimdImplFixedSize::_S_bit_or): Likewise.
(_SimdImplFixedSize::_S_bit_xor): Likewise.
(_SimdImplFixedSize::_S_bit_shift_left): Likewise.
(_SimdImplFixedSize::_S_bit_shift_right): Likewise.
(_SimdImplFixedSize::_S_remquo): Add inline keyword (to be
explicit about not always-inline, yet).
(_SimdImplFixedSize::_S_isinf): Likewise.
(_SimdImplFixedSize::_S_isfinite): Likewise.
(_SimdImplFixedSize::_S_isnan): Likewise.
(_SimdImplFixedSize::_S_isnormal): Likewise.
(_SimdImplFixedSize::_S_signbit): Likewise.

16 months agolibstdc++: More efficient masked inc-/decrement implementation
Matthias Kretz [Mon, 20 Feb 2023 15:33:31 +0000 (16:33 +0100)]
libstdc++: More efficient masked inc-/decrement implementation

Signed-off-by: Matthias Kretz <m.kretz@gsi.de>
libstdc++-v3/ChangeLog:

PR libstdc++/108856
* include/experimental/bits/simd_builtin.h
(_SimdImplBuiltin::_S_masked_unary): More efficient
implementation of masked inc-/decrement for integers and floats
without AVX2.
* include/experimental/bits/simd_x86.h
(_SimdImplX86::_S_masked_unary): New. Use AVX512 masked subtract
builtins for masked inc-/decrement.

16 months agoAvoid default-initializing auto_vec<T, N> storage, fix vec<vl_embed>
Richard Biener [Thu, 23 Feb 2023 10:56:17 +0000 (11:56 +0100)]
Avoid default-initializing auto_vec<T, N> storage, fix vec<vl_embed>

The following avoids default-initializing auto_vec storage for
non-POD T since that's not what the allocated storage fallback
will do and it's also not expected for existing cases like

  auto_vec<std::pair<unsigned, unsigned>, 64> elts;

which exist to optimize the allocation.

It also fixes the array accesses done by vec<vl_embed> to not
use its own m_vecdata member but instead access the container
provided storage via pointer arithmetic.

* vec.h (vec<T, A, vl_embed>::m_vecdata): Remove.
(vec<T, A, vl_embed>::m_vecpfx): Align as T to avoid
changing alignment of vec<T, A, vl_embed> and simplifying
address.
(vec<T, A, vl_embed>::address): Compute as this + 1.
(vec<T, A, vl_embed>::embedded_size): Use sizeof the
vector instead of the offset of the m_vecdata member.
(auto_vec<T, N>::m_data): Turn storage into
uninitialized unsigned char.
(auto_vec<T, N>::auto_vec): Allow allocation of one
stack member.  Initialize m_vec in a special way to
avoid later stringop overflow diagnostics.
* vec.cc (test_auto_alias): New.
(vec_cc_tests): Call it.

16 months agoChange vec<,,vl_embed>::m_vecdata refrences into address ()
Richard Biener [Fri, 24 Feb 2023 08:54:09 +0000 (09:54 +0100)]
Change vec<,,vl_embed>::m_vecdata refrences into address ()

As preparation to remove m_vecdata in the vl_embed vector this
changes references to it into calls to address ().

As I was here it also fixes ::contains to avoid repeated bounds
checking and the same issue in ::lower_bound which also suffers
from unnecessary copying around values.

* vec.h (vec<T, A, vl_embed>::lower_bound): Adjust to
take a const reference to the object, use address to
access data.
(vec<T, A, vl_embed>::contains): Use address to access data.
(vec<T, A, vl_embed>::operator[]): Use address instead of
m_vecdata to access data.
(vec<T, A, vl_embed>::iterate): Likewise.
(vec<T, A, vl_embed>::copy): Likewise.
(vec<T, A, vl_embed>::quick_push): Likewise.
(vec<T, A, vl_embed>::pop): Likewise.
(vec<T, A, vl_embed>::quick_insert): Likewise.
(vec<T, A, vl_embed>::ordered_remove): Likewise.
(vec<T, A, vl_embed>::unordered_remove): Likewise.
(vec<T, A, vl_embed>::block_remove): Likewise.
(vec<T, A, vl_heap>::address): Likewise.

16 months agoasan: adjust module name for global variables
Martin Liska [Fri, 17 Feb 2023 14:11:02 +0000 (15:11 +0100)]
asan: adjust module name for global variables

As mentioned in the PR, when we use LTO, we wrongly use ltrans output
file name as a module name of a global variable. That leads to a
non-reproducible output.

After the suggested change, we emit context name of normal global
variables. And for artificial variables (like .Lubsan_data3), we use
aux_base_name (e.g. "./a.ltrans0.ltrans").

PR sanitizer/108834

gcc/ChangeLog:

* asan.cc (asan_add_global): Use proper TU name for normal
global variables (and aux_base_name for the artificial one).

gcc/testsuite/ChangeLog:

* c-c++-common/asan/global-overflow-1.c: Test line and column
info for a global variable.

16 months ago[PR105224] C++ modules and AAPCS/ARM EABI clash on inline key methods
Alexandre Oliva [Fri, 24 Feb 2023 14:31:05 +0000 (11:31 -0300)]
[PR105224] C++ modules and AAPCS/ARM EABI clash on inline key methods

g++.dg/modules/virt-2_a.C fails on arm-eabi and many other arm targets
that use the AAPCS variant.  ARM is the only target that overrides
TARGET_CXX_KEY_METHOD_MAY_BE_INLINE.  It's not clear to me which way
the clash between AAPCS and C++ Modules design should be resolved, but
currently it favors AAPCS and thus the test fails, so skip it on
arm_eabi.

for  gcc/testsuite/ChangeLog

PR c++/105224
* g++.dg/modules/virt-2_a.C: Skip on arm_eabi.

16 months agolibstdc++: Constrain net::executor constructors
Jonathan Wakely [Fri, 24 Feb 2023 13:03:49 +0000 (13:03 +0000)]
libstdc++: Constrain net::executor constructors

The TS says the arguments to these constructors shall meet the Executor
requirements, so it's undefined if they don't. Constraining on a subset
of those requirements won't affect valid cases, but prevents the
majority of invalid cases from trying to instantiate the constructor.

This prevents the non-explicit executor(Executor) constructor being a
candidate anywhere that a net::executor could be constructed e.g.
comparing ip::tcp::v4() == ip::udp::v4() would try to convert both
operands to executor using that constructor, then compare then using
operator==(const executor&, const executor&).

libstdc++-v3/ChangeLog:

* include/experimental/executor (executor): Constrain template
constructors.

16 months agolibstdc++: Make net::ip::basic_endpoint comparisons constexpr
Jonathan Wakely [Fri, 24 Feb 2023 13:00:41 +0000 (13:00 +0000)]
libstdc++: Make net::ip::basic_endpoint comparisons constexpr

libstdc++-v3/ChangeLog:

* include/experimental/internet (basic_endpoint): Add missing
constexpr to comparison operators.
* testsuite/experimental/net/internet/endpoint/cons.cc: New test.

16 months agolibstdc++: Fix members of net::ip::network_v4
Jonathan Wakely [Fri, 24 Feb 2023 12:21:06 +0000 (12:21 +0000)]
libstdc++: Fix members of net::ip::network_v4

libstdc++-v3/ChangeLog:

* include/experimental/internet (network_v4::netmask()): Avoid
undefined shift.
(network_v4::broadcast()): Optimize and fix for targets with
uint_least32_t wider than 32 bits.
(network_v4::to_string(const Allocator&)): Fix for custom
allocators and optimize using to_chars.
(operator==(const network_v4&, const network_v4&)): Add missing
constexpr.
(operator==(const network_v6&, const network_v6&)): Likewise.
* testsuite/experimental/net/internet/network/v4/cons.cc: New test.
* testsuite/experimental/net/internet/network/v4/members.cc: New test.

16 months agolibstdc++: Fix conversion to/from net::ip::address_v4::bytes_type
Jonathan Wakely [Fri, 24 Feb 2023 10:08:26 +0000 (10:08 +0000)]
libstdc++: Fix conversion to/from net::ip::address_v4::bytes_type

I messed up the endianness of the address_v4::bytes_type array, which
should always be in network byte order. We can just use bit_cast to
convert the _M_addr member to/from bytes_type.

libstdc++-v3/ChangeLog:

* include/experimental/internet (address_4(const bytes_type&)):
Use __builtin_bit_cast if available, otherwise convert to
network byte order.
(address_v4::to_bytes()): Likewise, but convert from network
byte order.
* testsuite/experimental/net/internet/address/v4/cons.cc: Fix
incorrect tests. Check for constexpr too.
* testsuite/experimental/net/internet/address/v4/creation.cc:
Likewise.
* testsuite/experimental/net/internet/address/v4/members.cc:
Check that bytes_type is a standard-layout type.

16 months agolibstdc++: Optimize net::ip::address_v4::to_string()
Jonathan Wakely [Thu, 23 Feb 2023 17:39:33 +0000 (17:39 +0000)]
libstdc++: Optimize net::ip::address_v4::to_string()

This is an order of magnitude faster than calling inet_ntop (and not
only because we now avoid allocating a string that is one byte larger
than the SSO buffer).

libstdc++-v3/ChangeLog:

* include/experimental/internet (address_v4::to_string):
Optimize.
* testsuite/experimental/net/internet/address/v4/members.cc:
Check more addresses.

16 months agolibstdc++: Suppress warnings about use of deprecated std::aligned_storage
Jonathan Wakely [Thu, 23 Feb 2023 17:37:59 +0000 (17:37 +0000)]
libstdc++: Suppress warnings about use of deprecated std::aligned_storage

libstdc++-v3/ChangeLog:

* include/ext/aligned_buffer.h (__aligned_buffer): Add
diagnostic pragmas.

16 months agolibstdc++: Reorder dg-options before dg-do
Jonathan Wakely [Thu, 16 Feb 2023 15:31:22 +0000 (15:31 +0000)]
libstdc++: Reorder dg-options before dg-do

The options need to be set first, so that -std=gnu++20 is used when
checking the c++20 effective target.

libstdc++-v3/ChangeLog:

* testsuite/std/format/arguments/lwg3810.cc: Move dg-options
before dg-do.

16 months agoi386: Update i386-builtin.def file comment description of BDESC{,_FIRST}
Jakub Jelinek [Fri, 24 Feb 2023 12:07:58 +0000 (13:07 +0100)]
i386: Update i386-builtin.def file comment description of BDESC{,_FIRST}

I've noticed the description of these wasn't updated when the mask2
argument has been added in 2019.

2023-02-24  Jakub Jelinek  <jakub@redhat.com>

* config/i386/i386-builtin.def: Update description of BDESC
and BDESC_FIRST in file comment to include mask2.

16 months agoaarch64: Update FLAGS field documentation comment in aarch64-cores.def
Kyrylo Tkachov [Fri, 24 Feb 2023 11:41:28 +0000 (11:41 +0000)]
aarch64: Update FLAGS field documentation comment in aarch64-cores.def

With the cleanup of the arch features in GCC 13 the comment on the FLAGS field in aarch64-cores.def
is now outdated. It's now a comma-separated list rather than a bitwise or.
Spotted while reviewing an aarch64-cores.def patch.
Update the comment.

gcc/ChangeLog:

* config/aarch64/aarch64-cores.def (FLAGS): Update comment.

16 months agocgraphclones: Don't share DECL_ARGUMENTS between thunk and its artificial thunk ...
Jakub Jelinek [Fri, 24 Feb 2023 10:05:27 +0000 (11:05 +0100)]
cgraphclones: Don't share DECL_ARGUMENTS between thunk and its artificial thunk [PR108854]

The following testcase ICEs on x86_64-linux with -m32.  The problem is
we create an artificial thunk and because of -fPIC, ia32 and thunk
destination which doesn't bind locally can't use a mi thunk.
The ICE is because during expansion to RTL we see SSA_NAME for a PARM_DECL,
but the PARM_DECL doesn't have DECL_CONTEXT of the current function.
This is because duplicate_thunk_for_node creates a new DECL_ARGUMENTS chain
only if some arguments need modification.

The following patch fixes it by copying the DECL_ARGUMENTS list even if
the arguments can stay as is, to update DECL_CONTEXT on them.  While for
mi thunks it doesn't really matter because we don't use those arguments
in any way, for other thunks it is important.

2023-02-23  Jakub Jelinek  <jakub@redhat.com>

PR middle-end/108854
* cgraphclones.cc (duplicate_thunk_for_node): If no parameter
changes are needed, copy at least DECL_ARGUMENTS PARM_DECL
nodes and adjust their DECL_CONTEXT.

* g++.dg/opt/pr108854.C: New test.

16 months agoi386: Fix up builtins used in avx512bf16vlintrin.h [PR108881]
Jakub Jelinek [Fri, 24 Feb 2023 09:12:44 +0000 (10:12 +0100)]
i386: Fix up builtins used in avx512bf16vlintrin.h [PR108881]

The builtins used in avx512bf16vlintrin.h implementation need both
avx512bf16 and avx512vl ISAs, which the header ensures for them, but
the builtins weren't actually requiring avx512vl, so when used by hand
with just -mavx512bf16 -mno-avx512vl it resulted in ICEs.

Fixed by adding OPTION_MASK_ISA_AVX512VL to their BDESC.

2023-02-24  Jakub Jelinek  <jakub@redhat.com>

PR target/108881
* config/i386/i386-builtin.def (__builtin_ia32_cvtne2ps2bf16_v16bf,
__builtin_ia32_cvtne2ps2bf16_v16bf_mask,
__builtin_ia32_cvtne2ps2bf16_v16bf_maskz,
__builtin_ia32_cvtne2ps2bf16_v8bf,
__builtin_ia32_cvtne2ps2bf16_v8bf_mask,
__builtin_ia32_cvtne2ps2bf16_v8bf_maskz,
__builtin_ia32_cvtneps2bf16_v8sf_mask,
__builtin_ia32_cvtneps2bf16_v8sf_maskz,
__builtin_ia32_cvtneps2bf16_v4sf_mask,
__builtin_ia32_cvtneps2bf16_v4sf_maskz,
__builtin_ia32_dpbf16ps_v8sf, __builtin_ia32_dpbf16ps_v8sf_mask,
__builtin_ia32_dpbf16ps_v8sf_maskz, __builtin_ia32_dpbf16ps_v4sf,
__builtin_ia32_dpbf16ps_v4sf_mask,
__builtin_ia32_dpbf16ps_v4sf_maskz): Require also
OPTION_MASK_ISA_AVX512VL.

* gcc.target/i386/avx512bf16-pr108881.c: New test.

16 months agolibsanitizer: cherry-pick commit 8f5962b1ccb5fcd4d4544121d43efb860ac3cc6d from upstream
Martin Liska [Fri, 24 Feb 2023 08:14:40 +0000 (09:14 +0100)]
libsanitizer: cherry-pick commit 8f5962b1ccb5fcd4d4544121d43efb860ac3cc6d from upstream

ASAN: keep support for Global::location

We as GCC still emit __asan_global_source_location for global variables
and we would like to use it in the future. On other hand, we don't
support llvm-symbolizer and the default libbacktraace symbolizer
does not support location info.

16 months agoRTEMS: Tune multilib selection
Sebastian Huber [Wed, 22 Feb 2023 20:38:18 +0000 (21:38 +0100)]
RTEMS: Tune multilib selection

gcc/ChangeLog:

* config/riscv/t-rtems: Keep only -mcmodel=medany 64-bit multilibs.
Add non-compact 32-bit multilibs.

16 months agoMIPS: Add pattern for clo
Junxian Zhu [Fri, 17 Feb 2023 08:35:56 +0000 (16:35 +0800)]
MIPS: Add pattern for clo

gcc/ChangeLog:

* config/mips/mips.md (*clo<mode>2): New pattern.

gcc/testsuite/ChangeLog:

* gcc.target/mips/clz.c: New test.
* gcc.target/mips/clo.c: New test.
* gcc.target/mips/mips.exp: New option HAS_CLZ.

Signed-off-by: Junxian Zhu <zhujunxian@oss.cipunited.com>
16 months agoHazard barrier return support
Junxian Zhu [Fri, 17 Feb 2023 08:24:55 +0000 (16:24 +0800)]
Hazard barrier return support

This patch allows a function to request clearing of all instruction and execution
hazards upon normal return via __attribute__ ((use_hazard_barrier_return)).

2017-04-25  Prachi Godbole  <prachi.godbole@imgtec.com>

gcc/ChangeLog:

* config/mips/mips.h (machine_function): New variable
use_hazard_barrier_return_p.
* config/mips/mips.md (UNSPEC_JRHB): New unspec.
(mips_hb_return_internal): New insn pattern.
* config/mips/mips.cc (mips_attribute_table): Add attribute
use_hazard_barrier_return.
(mips_use_hazard_barrier_return_p): New static function.
(mips_function_attr_inlinable_p): Likewise.
(mips_compute_frame_info): Set use_hazard_barrier_return_p.
Emit error for unsupported architecture choice.
(mips_function_ok_for_sibcall, mips_can_use_return_insn):
Return false for use_hazard_barrier_return.
(mips_expand_epilogue): Emit hazard barrier return.
* doc/extend.texi: Document use_hazard_barrier_return.

gcc/testsuite/ChangeLog:

* gcc.target/mips/hazard-barrier-return-attribute.c: New test.

Signed-off-by: Junxian Zhu <zhujunxian@oss.cipunited.com>
16 months agoDaily bump.
GCC Administrator [Fri, 24 Feb 2023 00:17:09 +0000 (00:17 +0000)]
Daily bump.

16 months agogcc: xtensa: update include style in xtensa-dynconfig.cc
Max Filippov [Thu, 23 Feb 2023 23:50:29 +0000 (15:50 -0800)]
gcc: xtensa: update include style in xtensa-dynconfig.cc

gcc/
* config/xtensa/xtensa-dynconfig.cc (config.h, system.h)
(coretypes.h, diagnostic.h, intl.h): Use "..." instead of <...>
for the gcc-internal headers.

16 months agogcc: xtensa: rename xtensa-dynconfig.c and update its build rule
Max Filippov [Thu, 23 Feb 2023 23:43:48 +0000 (15:43 -0800)]
gcc: xtensa: rename xtensa-dynconfig.c and update its build rule

gcc/
* config/xtensa/t-xtensa (xtensa-dynconfig.o): Use $(COMPILE)
and $(POSTCOMPILE) instead of manual dependency listing.
* config/xtensa/xtensa-dynconfig.c: Rename to ...
* config/xtensa/xtensa-dynconfig.cc: ... this.

16 months ago**/*.texi: Reorder index entries
Arsen Arsenović [Thu, 23 Feb 2023 10:27:11 +0000 (11:27 +0100)]
**/*.texi: Reorder index entries

This change is a generalization of r13-6292-gddf6fe375d9110.

Historically, makeinfo exhibited a bug, due to which a structure like:

  @item foo
  @cindex foo
  @cindex bar

... would be transformed into an item heading, with the first index
entry on it, followed by an item body, with the second index entry in
it.  This has often lead to index entries not linking to relevant items,
but rather, just below them.

This bug was exhibited in both Info and HTML documentation, and was most
glaringly obvious in the latter.

After a discussion with the Texinfo developers, it was decided that the
appropriate construct for this case is:

  @cindex foo
  @cindex bar
  @item foo

... which behaves correctly in newer versions, linking all the index
entries to the item itself.  This pattern also produces copiable
anchors in HTML output.

This commit fixes most indices to follow the pattern above, however,
omits relevant changes in the Ada manuals, as the algorithm described
below lead to many false positives and unwanted changes in that manual.

Much like the previous commit, this change is mostly mechanical, with a
simple script.  I have, however, gone over the patch myself also, to see
if there's anything that ought to be kept as-is.  Formatter:

  # GPL3+
  use v5.35;
  use strict;
  use warnings;

  my @lineq = ();
  my @itemq = ();
  my @indxq = ();
  my $lstin = 0;

  while (<>)
    {
      push (@lineq, $_);
      if (/^\@[a-zA-Z0-9]{1,2}index\W/)
        {
          $lstin = @lineq;
          push (@indxq, $_);
          next;
        }
      if (/^\@itemx?\W/)
        {
          $lstin = @lineq;
          push (@itemq, $_);
          next;
        }
      next if $lstin && /^\s*(\@c(omment)?\W.*)?$/;

      if (@indxq and @itemq)
        {
          print @indxq;
          print @itemq;
          print @lineq[$lstin..@lineq-1];
        }
      else
        {
          print @lineq;
        }
      @lineq = ();
      @itemq = ();
      @indxq = ();
      $lstin = 0;
    }

  if (@indxq and @itemq)
    {
      print @indxq;
      print @itemq;
      print @lineq[$lstin..@lineq-1];
    }
  else
    {
      print @lineq;
    }

  # Local Variables:
  # indent-tabs-mode: nil
  # End:

gcc/d/ChangeLog:

* implement-d.texi: Reorder index entries around @items.

gcc/ChangeLog:

* doc/cfg.texi: Reorder index entries around @items.
* doc/cpp.texi: Ditto.
* doc/cppenv.texi: Ditto.
* doc/cppopts.texi: Ditto.
* doc/generic.texi: Ditto.
* doc/install.texi: Ditto.
* doc/extend.texi: Ditto.
* doc/invoke.texi: Ditto.
* doc/md.texi: Ditto.
* doc/rtl.texi: Ditto.
* doc/tm.texi.in: Ditto.
* doc/trouble.texi: Ditto.
* doc/tm.texi: Regenerate.

gcc/fortran/ChangeLog:

* invoke.texi: Reorder index entries around @items.

gcc/go/ChangeLog:

* gccgo.texi: Reorder index entries around @items.

16 months agoxtensa: Eliminate unnecessary general-purpose reg-reg moves
Takayuki 'January June' Suwa [Sat, 18 Feb 2023 04:43:34 +0000 (13:43 +0900)]
xtensa: Eliminate unnecessary general-purpose reg-reg moves

Register-register move instructions that can be easily seen as
unnecessary by the human eye may remain in the compiled result.
For example:

/* example */
double test(double a, double b) {
  return __builtin_copysign(a, b);
}

test:
add.n a3, a3, a3
extui a5, a5, 31, 1
ssai 1
;; Be in the same BB
src a7, a5, a3 ;; Replacing the destination doesn't
;;   violate any constraints of the
;;   operands
;; No CALL insns in this span
;; Both A3 and A7 are irrelevant to
;;   insns in this span
mov.n a3, a7 ;; An unnecessary reg-reg move
;; A7 is not used after this
ret.n

The last two instructions above, excluding the return instruction,
could be done like this:

src a3, a5, a3

This symptom often occurs when handling DI/DFmode values with SImode
instructions.  This patch solves the above problem using peephole2
pattern.

gcc/ChangeLog:

* config/xtensa/xtensa.md: New peephole2 pattern that eliminates
the occurrence of general-purpose register used only once and for
transferring intermediate value.

gcc/testsuite/ChangeLog:

* gcc.target/xtensa/elim_GP_regmove_0.c: New test.
* gcc.target/xtensa/elim_GP_regmove_1.c: New test.

16 months agoxtensa: Eliminate the use of callee-saved register that saves and restores only once
Takayuki 'January June' Suwa [Fri, 27 Jan 2023 03:17:33 +0000 (12:17 +0900)]
xtensa: Eliminate the use of callee-saved register that saves and restores only once

In the case of the CALL0 ABI, values that must be retained before and
after function calls are placed in the callee-saved registers (A12
through A15) and referenced later.  However, it is often the case that
the save and the reference are each only once and a simple register-
register move (with two exceptions; i. the register saved to/restored
from is the stack pointer, ii. the function needs an additional stack
pointer adjustment to grow the stack).

e.g. in the following example, if there are no other occurrences of
register A14:

;; before
; prologue {
  ...
s32i.n a14, sp, 16
  ... ;; no frame pointer needed
;; no additional stack growth
; } prologue
  ...
mov.n a14, a6 ;; A6 is not SP
  ...
call0 foo
  ...
mov.n a8, a14 ;; A8 is not SP
  ...
; epilogue {
  ...
l32i.n a14, sp, 16
  ...
; } epilogue

It can be possible like this:

;; after
; prologue {
  ...
(no save needed)
  ...
; } prologue
  ...
s32i.n a6, sp, 16 ;; replaced with A14's slot
  ...
call0 foo
  ...
l32i.n a8, sp, 16 ;; through SP
  ...
; epilogue {
  ...
(no restoration needed)
  ...
; } epilogue

This patch adds the abovementioned logic to the function prologue/epilogue
RTL expander code.

gcc/ChangeLog:

* config/xtensa/xtensa.cc (machine_function): Add new member
'eliminated_callee_saved_bmp'.
(xtensa_can_eliminate_callee_saved_reg_p): New function to
determine whether the register can be eliminated or not.
(xtensa_expand_prologue): Add invoking the above function and
elimination the use of callee-saved register by using its stack
slot through the stack pointer (or the frame pointer if needed)
directly.
(xtensa_expand_prologue): Modify to not emit register restoration
insn from its stack slot if the register is already eliminated.

gcc/testsuite/ChangeLog:

* gcc.target/xtensa/elim_callee_saved.c: New.

16 months agoxtensa: Fix up fatal_error message strings in xtensa-dynconfig.c [PR108890]
Jakub Jelinek [Thu, 23 Feb 2023 22:26:43 +0000 (23:26 +0100)]
xtensa: Fix up fatal_error message strings in xtensa-dynconfig.c [PR108890]

The translation PR complains that these 4 messages from xtensa-dynconfig.c
are marked in po/gcc.pot as c-format (which doesn't allow %qs) while they
should be gcc-internal-format.

The problem is in the manual translation of the strings with _(),
that should be both unnecessary because fatal_error invokes _() on its
argument already, but also incorrect for the above reason, for
gcc-internal-format strings one should use G_("...") instead if really
needed.

The following patch drops those _("..."), tested by regenerating po/gcc.pot
to see they are now gcc-internal-format, but not really tested on xtensa
target.

2023-02-23  Jakub Jelinek  <jakub@redhat.com>

PR translation/108890
* config/xtensa/xtensa-dynconfig.c (xtensa_load_config): Drop _()s
around fatal_error format strings.

16 months agotestsuite: Fix up modules.exp [PR108899]
Jakub Jelinek [Thu, 23 Feb 2023 16:17:05 +0000 (17:17 +0100)]
testsuite: Fix up modules.exp [PR108899]

On Wed, Feb 22, 2023 at 02:33:42PM -0300, Alexandre Oliva via Gcc-patches wrote:
> When a multi-source module is found to be unsupported, we fail
> module_cmi_p and subsequent sources.  Override proc unsupported to
> mark the result in module_do, and test it to skip module_cmp_p and
> subsequent related tests.
>
> for  gcc/testsuite/ChangeLog
>
>       * g++.dg/modules/modules.exp: Override unsupported to update
>       module_do, and test it after dg-test.

This patch breaks testing with more than one set of options in
target board, like
make check-g++ RUNTESTFLAGS='--target_board=unix\{-m32,-m64\} modules.exp'
yields:
...
                 === g++ Summary for unix/-m32 ===

 # of expected passes            7217
 # of unexpected failures        1
 # of expected failures          18
 # of unsupported tests          2
 Running target unix/-m64
...
 ERROR: tcl error sourcing /home/jakub/src/gcc/gcc/testsuite/g++.dg/modules/modules.exp.
 ERROR: tcl error code TCL OPERATION RENAME TARGET_EXISTS
 ERROR: can't rename to "saved-unsupported": command already exists
     while executing
 "rename unsupported saved-unsupported"
     (file "/home/jakub/src/gcc/gcc/testsuite/g++.dg/modules/modules.exp" line 322)
     invoked from within
 "source /home/jakub/src/gcc/gcc/testsuite/g++.dg/modules/modules.exp"
     ("uplevel" body line 1)
     invoked from within
 "uplevel #0 source /home/jakub/src/gcc/gcc/testsuite/g++.dg/modules/modules.exp"
     invoked from within
 "catch "uplevel #0 source $test_file_name" msg"

In other spots where we in *.exp files rename some routine, we guard that
and the following patch does that for modules.exp too.

Tested with running
make check-g++ RUNTESTFLAGS='--target_board=unix\{-m32,-m64\} modules.exp'
again which now works properly again.

2023-02-23  Jakub Jelinek  <jakub@redhat.com>

PR testsuite/108899
* g++.dg/modules/modules.exp: Only override unsupported if it
exists and saved-unsupported doesn't.

16 months agoFix memory leak in PTA
Richard Biener [Thu, 23 Feb 2023 13:09:04 +0000 (14:09 +0100)]
Fix memory leak in PTA

When handle_lhs_call calls .create on the passed in vector it leaks
any previous allocated storage.  Avoid doing that and instead rely
on the caller for memory management, just truncate the vector.

* tree-ssa-structalias.cc (handle_lhs_call): Do not
re-create rhsc, only truncate it.

16 months agoc++: Fix up -fcontracts option description [PR108890]
Jakub Jelinek [Thu, 23 Feb 2023 14:27:31 +0000 (15:27 +0100)]
c++: Fix up -fcontracts option description [PR108890]

This translation PR mentioned the description is a little bit weird.

2023-02-23  Jakub Jelinek  <jakub@redhat.com>

PR translation/108890
* c.opt (fcontracts): Fix description.

16 months agoipa-prop: Fix another case of missing BUILT_IN_UNREACHABLE_TRAP handling [PR106258]
Jakub Jelinek [Thu, 23 Feb 2023 14:24:43 +0000 (15:24 +0100)]
ipa-prop: Fix another case of missing BUILT_IN_UNREACHABLE_TRAP handling [PR106258]

There is another spot that handles in IPA just BUILT_IN_UNREACHABLE and
not BUILT_IN_UNREACHABLE_TRAP.

This patch fixes that.

2023-02-23  Jakub Jelinek  <jakub@redhat.com>

PR middle-end/106258
* ipa-prop.cc (try_make_edge_direct_virtual_call): Handle
BUILT_IN_UNREACHABLE_TRAP like BUILT_IN_UNREACHABLE.

16 months agolibstdc++: Test that integral simd reductions are precise
Matthias Kretz [Tue, 21 Feb 2023 09:43:13 +0000 (10:43 +0100)]
libstdc++: Test that integral simd reductions are precise

Signed-off-by: Matthias Kretz <m.kretz@gsi.de>
libstdc++-v3/ChangeLog:

* testsuite/experimental/simd/tests/reductions.cc: Introduce
max_distance as the type-dependent max error.

16 months agolibstdc++: Fix -Wsign-compare issue
Matthias Kretz [Tue, 21 Feb 2023 09:31:55 +0000 (10:31 +0100)]
libstdc++: Fix -Wsign-compare issue

Signed-off-by: Matthias Kretz <m.kretz@gsi.de>
libstdc++-v3/ChangeLog:

* include/experimental/bits/simd_builtin.h (_S_set): Compare as
int. The actual range of these indexes is very small.

16 months agolibstdc++: Add missing constexpr on simd shift implementation
Matthias Kretz [Mon, 20 Feb 2023 16:35:59 +0000 (17:35 +0100)]
libstdc++: Add missing constexpr on simd shift implementation

Resolves -Wtautological-compare warnings about `if
(__builtin_is_constant_evaluated())` in the implementations of these
functions.

Signed-off-by: Matthias Kretz <m.kretz@gsi.de>
libstdc++-v3/ChangeLog:

* include/experimental/bits/simd_x86.h (_S_bit_shift_left)
(_S_bit_shift_right): Declare constexpr. The implementation was
already expecting constexpr evaluation.

16 months agolibstdc++: Fix simd build failure on clang
Matthias Kretz [Mon, 20 Feb 2023 10:13:44 +0000 (11:13 +0100)]
libstdc++: Fix simd build failure on clang

Clang does not support __attribute__ on lambdas. Therefore, only set
_GLIBCXX_SIMD_ALWAYS_INLINE_LAMBDA if __clang__ is not defined.

Signed-off-by: Matthias Kretz <m.kretz@gsi.de>
libstdc++-v3/ChangeLog:

PR libstdc++/108030
* include/experimental/bits/simd_detail.h
(_GLIBCXX_SIMD_ALWAYS_INLINE_LAMBDA): Define as empty for
__clang__.

16 months agolibstdc++: Simplify three helper functions into one
Matthias Kretz [Sat, 14 Jan 2023 22:32:38 +0000 (23:32 +0100)]
libstdc++: Simplify three helper functions into one

Broadcast is a very common function. This should reduce compile-time
effort.

Signed-off-by: Matthias Kretz <m.kretz@gsi.de>
libstdc++-v3/ChangeLog:

PR libstdc++/108030
* include/experimental/bits/simd.h (__vector_broadcast):
Implement via __vector_broadcast_impl instead of
__call_with_n_evaluations + 2 lambdas.
(__vector_broadcast_impl): New.

16 months agoFix memory leak in if-conversion
Richard Biener [Thu, 23 Feb 2023 10:05:47 +0000 (11:05 +0100)]
Fix memory leak in if-conversion

The following fixes if-conversion failing to release data-references
and the data-reference vector.

* tree-if-conv.cc (tree_if_conversion): Properly manage
memory of refs and the contained data references.

16 months agotree-optimization/108888 - call if-conversion
Richard Biener [Thu, 23 Feb 2023 10:03:03 +0000 (11:03 +0100)]
tree-optimization/108888 - call if-conversion

The following makes sure to only predicate calls necessary.

PR tree-optimization/108888
* tree-if-conv.cc (if_convertible_stmt_p): Set PLF_2 on
calls to predicate.
(predicate_statements): Only predicate calls with PLF_2.

* g++.dg/torture/pr108888.C: New testcase.

16 months agoxtensa: Fix missing mode warnings in machine description
Takayuki 'January June' Suwa [Thu, 23 Feb 2023 03:42:32 +0000 (12:42 +0900)]
xtensa: Fix missing mode warnings in machine description

gcc/ChangeLog:

* config/xtensa/xtensa.md
(zero_cost_loop_start, zero_cost_loop_end, loop_end):
Add missing "SI:" to PLUS RTXes.

16 months agoxtensa: fix PR target/108876
Max Filippov [Thu, 23 Feb 2023 06:08:21 +0000 (22:08 -0800)]
xtensa: fix PR target/108876

In commit b2ef02e8cbbaf95fee98be255f697f47193960ec, the sibling call
insn included (use (reg:SI A0_REG)) to fix the problem, which added
a USE chain unconditionally to the data flow of register A0 during
the sibling call.

As a result, df_regs_ever_live_p (A0_REG) returns true, so even if
register A0 is not used outside of the sibling call insn, saves and
restores to stack slots are emitted in pro/epilogue, and finally
code size increases.
(This is why I never included (use A0) in sibling calls)

    /* example */
    extern int foo(int);
    int test(int a) {
      return foo(a * 3 + 1);
    }

;; before
    test:
addi sp, sp, -16 ;; unneeded stack frame allocation (induced)
s32i.n a0, sp, 12 ;; unneeded saving of register A0
l32i.n a0, sp, 12 ;; unneeded restoration of register A0
addx2 a2, a2, a2
addi.n a2, a2, 1
addi sp, sp, 16 ;; unneeded stack frame freeing (induced)
j.l foo, a9 ;; sibling call (truly needs register A0)

The essential cause is that we emit (use A0) *before* the insns that
does the stack pointer adjustment during epilogue expansion, so the
liveness of register A0 ends early, so register A0 is reused afterwards.

This patch fixes the problem and avoids such regression by doing the
emit of (use A0) in the sibling call epilogue expansion at the end.

;; after
test:
addx2 a2, a2, a2
addi.n a2, a2, 1
j.l foo, a9

>From RTL-pass "315r.rnreg" by
"gfortran -O3 -funroll-loops -mabi=call0 -S -da gcc-gnu/gcc/testsuite/gfortran.dg/allocate_with_source_5.f90":

    ;; Function selector_init (__selectors_MOD_selector_init, funcdef_no=2, decl_uid=987, cgraph_uid=3, symbol_order=4)
    ...
    (insn 3807 3806 3808 121 (set (reg:SI 15 a15)
            (mem/c:SI (plus:SI (reg/f:SI 1 sp)
                    (const_int 268 [0x10c])) [31  S4 A32])) "gcc-gnu/gcc/testsuite/gfortran.dg/allocate_with_source_5.f90":35:30 53 {movsi_internal}
         (nil))
    (insn 3808 3807 3809 121 (set (reg:SI 7 a7)
            (const_int 288 [0x120])) "gcc-gnu/gcc/testsuite/gfortran.dg/allocate_with_source_5.f90":35:30 53 {movsi_internal}
         (nil))
    (insn 3809 3808 3810 121 (set (reg/f:SI 1 sp)
            (plus:SI (reg/f:SI 1 sp)
                (reg:SI 7 a7))) "gcc-gnu/gcc/testsuite/gfortran.dg/allocate_with_source_5.f90":35:30 1 {addsi3}
         (expr_list:REG_DEAD (reg:SI 9 a9)
            (nil)))
    (insn 3810 3809 721 121 (use (reg:SI 0 a0)) "gcc-gnu/gcc/testsuite/gfortran.dg/allocate_with_source_5.f90":35:30 -1
         (expr_list:REG_DEAD (reg:SI 0 a0)
            (nil)))
    (call_insn/j 721 3810 722 121 (call (mem:SI (symbol_ref:SI ("free") [flags 0x41]  <function_decl 0x7f7c885f6000 __builtin_free>) [0 __builtin_free S4 A32])
            (const_int 0 [0])) "gcc-gnu/gcc/testsuite/gfortran.dg/allocate_with_source_5.f90":35:30 discrim 1 106 {sibcall_internal}
         (expr_list:REG_DEAD (reg:SI 2 a2)
            (expr_list:REG_CALL_DECL (symbol_ref:SI ("free") [flags 0x41]  <function_decl 0x7f7c885f6000 __builtin_free>)
                (expr_list:REG_EH_REGION (const_int 0 [0])
                    (nil))))
        (expr_list:SI (use (reg:SI 2 a2))
            (nil)))

(IMHO the "rnreg" pass doesn't take REG_ALLOC_ORDER into account;
it just seems to allocate registers in fixed_regs index order,
which may have hurt register A0 that became allocatable in the recent
patch)

gcc/ChangeLog:
PR target/108876

* config/xtensa/xtensa.cc (xtensa_expand_epilogue):
Emit (use (reg:SI A0_REG)) at the end in the sibling call
(i.e. the same place as (return) in the normal call).

16 months agoRevert "gcc: xtensa: fix PR target/108876"
Max Filippov [Thu, 23 Feb 2023 06:07:58 +0000 (22:07 -0800)]
Revert "gcc: xtensa: fix PR target/108876"

This reverts commit b2ef02e8cbbaf95fee98be255f697f47193960ec.

16 months agodocs: Reorder @opindex before corresponding options
Arsen Arsenović [Thu, 23 Feb 2023 01:06:49 +0000 (02:06 +0100)]
docs: Reorder @opindex before corresponding options

gcc/d/ChangeLog:

* gdc.texi: Reorder @opindex commands to precede @items they
relate to.

gcc/ChangeLog:

* doc/cppdiropts.texi: Reorder @opindex commands to precede
@items they relate to.
* doc/cppopts.texi: Ditto.
* doc/cppwarnopts.texi: Ditto.
* doc/invoke.texi: Ditto.
* doc/lto.texi: Ditto.

gcc/fortran/ChangeLog:

* invoke.texi: Reorder @opindex commands to precede @items they
relate to.

16 months agoDaily bump.
GCC Administrator [Thu, 23 Feb 2023 00:17:57 +0000 (00:17 +0000)]
Daily bump.

16 months agoc-family: avoid compile-time-hog in c_genericize [PR108880]
Marek Polacek [Wed, 22 Feb 2023 20:17:03 +0000 (15:17 -0500)]
c-family: avoid compile-time-hog in c_genericize [PR108880]

This fixes a compile-time hog with UBSan.  This only happened in cc1 but
not cc1plus.  The problem is ultimately that c_genericize_control_stmt/
STATEMENT_LIST -> walk_tree_1 doesn't use a hash_set to remember visited
nodes, so it kept on recursing for a long time.  We should be able to
use the pset that c_genericize created.  We just need to use walk_tree
instead of walk_tree_w_d so that the pset is explicit.

PR c/108880

gcc/c-family/ChangeLog:

* c-gimplify.cc (c_genericize_control_stmt) <case STATEMENT_LIST>: Pass
pset to walk_tree_1.
(c_genericize): Call walk_tree with an explicit pset.

gcc/testsuite/ChangeLog:

* c-c++-common/ubsan/pr108880.c: New test.

16 months agoFortran: reject invalid CHARACTER length of derived type components [PR96024]
Harald Anlauf [Tue, 21 Feb 2023 21:06:33 +0000 (22:06 +0100)]
Fortran: reject invalid CHARACTER length of derived type components [PR96024]

gcc/fortran/ChangeLog:

PR fortran/96024
* resolve.cc (resolve_component): The type of a CHARACTER length
expression must be INTEGER.

gcc/testsuite/ChangeLog:

PR fortran/96024
* gfortran.dg/pr96024.f90: New test.

16 months agotestsuite: Skip module_cmi_p and related unsupported module test
Alexandre Oliva [Wed, 22 Feb 2023 17:35:36 +0000 (14:35 -0300)]
testsuite: Skip module_cmi_p and related unsupported module test

When a multi-source module is found to be unsupported, we fail
module_cmi_p and subsequent sources.  Override proc unsupported to
mark the result in module_do, and test it to skip module_cmp_p and
subsequent related tests.

for  gcc/testsuite/ChangeLog

* g++.dg/modules/modules.exp: Override unsupported to update
module_do, and test it after dg-test.

16 months ago[arm] avoid aes-1742098 mitigation in combine tests
Alexandre Oliva [Wed, 22 Feb 2023 17:35:34 +0000 (14:35 -0300)]
[arm] avoid aes-1742098 mitigation in combine tests

The expected asm output for aes-fuse-[12].c does not correspond to
that which is generated when -mfix-cortex-a57-aes-1742098 is enabled.
The mitigation was introduced after the test, and enabled by default
for the selected processor, a72.  Select a53 instead, where the
migitation is not enabled by default, and all the expected fusions can
take place.

for  gcc/testsuite/ChangeLog

* gcc.target/arm/aes-fuse-1.c: Switch to -mcpu=cortex-a53.
* gcc.target/arm/aes-fuse-2.c: Likewise.

16 months agoDrop need for constant I in ctf test
Alexandre Oliva [Wed, 22 Feb 2023 17:35:31 +0000 (14:35 -0300)]
Drop need for constant I in ctf test

Though I is supposed to be a constant expression, this is not the case
on vxworks, but this is not what this debug information format test is
testing for, so use real constants to initialize complex variables.

for  gcc/testsuite/ChangeLog

* gcc.dg/debug/ctf/ctf-complex-1.c: Do not test whether I is
usable in initializers.

16 months agoxfail fp-uint64-convert-double-* on all arm targets
Alexandre Oliva [Wed, 22 Feb 2023 17:35:27 +0000 (14:35 -0300)]
xfail fp-uint64-convert-double-* on all arm targets

It wasn't long ago that I xfailed these tests on arm-*-eabi, but the
fail is expected on all other arm targets: even when hard float is
available, conversions between 64-bit integers and double are always
emulated on ARM, and the emulation disregards rounding modes.  So,
bump the xfail to all of arm-*-*.

for  gcc/testsuite/ChangeLog

* gcc.dg/torture/fp-uint64-convert-double-1.c: XFAIL on all of
arm-*-*.
* gcc.dg/torture/fp-uint64-convert-double-2.c: Likewise.

16 months ago[arm] [testsuite] asm-flag-4.c: match quotes in expected message
Alexandre Oliva [Wed, 22 Feb 2023 17:35:22 +0000 (14:35 -0300)]
[arm] [testsuite] asm-flag-4.c: match quotes in expected message

Quotes were added around the "asm" keyword in the message expected by
the test, so the test needs adjusting.

for  gcc/testsuite/ChangeLog

* gcc.target/arm/asm-flag-4.c: Match quotes around "asm" in
message.

16 months agotestsuite: Accept pmf-vbit-in-delta extra warning
Alexandre Oliva [Wed, 22 Feb 2023 17:35:20 +0000 (14:35 -0300)]
testsuite: Accept pmf-vbit-in-delta extra warning

cp_build_binary_op, that issues -Waddress warnings, issues an extra
warning on arm targets, that g++.dg/warn/Waddress-5.C does not expect
when comparing a pointer-to-member-function literal with null.

The reason for the extra warning is that, on arm targets,
TARGET_PTRMEMFUNC_VBIT_LOCATION == ptrmemfunc_vbit_in_delta, which
causes a different path to be taken, that extracts the
pointer-to-function and the delta fields (minus the vbit) and compares
each one with zero.  It's when comparing this pointer-to-function with
zero, in a recursive cp_build_binary_op, that another warning is
issued.

I suppose there should be a way to skip the warning in this recursive
call, without disabling other warnings that might be issued there, but
this patch only arranges for the test to tolerate the extra warning.

for  gcc/testsuite/ChangeLog

* g++.dg/warn/Waddress-5.C: Tolerate extra -Waddress warning.

16 months ago[libstdc++] do not destruct mutex_pool mutexes
Alexandre Oliva [Wed, 22 Feb 2023 17:35:18 +0000 (14:35 -0300)]
[libstdc++] do not destruct mutex_pool mutexes

On vxworks, after destroying the semaphore used to implement a mutex,
__gthread_mutex_lock fails and __gnu_cxx::__mutex::lock calls
__throw_concurrence_lock_error.  Nothing ensures the mutex_pool
mutexes survive init-once objects containing _Safe_sequence_base.  If
such an object completes construction before mutex_pool
initialization, it will be registered for atexit destruction after the
mutex_pool mutexes, so the _M_detach_all() call in the
_Safe_sequence_base dtor will use already-destructed mutexes, and
basic_string/requirements/citerators_cc fails calling terminate.

This patch fixes this problem by ensuring the mutex pool mutexes are
constructed on demand, on a statically-allocated buffer, but never
destructed.

for  libstdc++-v3/ChangeLog

* src/c++11/shared_ptr.cc (__gnu_internal::get_mutex):
Avoid destruction of the mutex pool.

16 months ago[libstdc++] xfail noreplace tests on vxworks
Alexandre Oliva [Wed, 22 Feb 2023 17:35:15 +0000 (14:35 -0300)]
[libstdc++] xfail noreplace tests on vxworks

vxworks ignores O_EXCL in open, so noreplace open succeeds when it is
expected to fail.  xfail the tests.

for  libstdc++-v3/ChangeLog

* testsuite/27_io/basic_ofstream/open/char/noreplace.cc: xfail
on vxworks.
* testsuite/27_io/basic_ofstream/open/wchar_t/noreplace.cc:
Likewise.

16 months ago[libstdc++] [testsuite] intro/names.cc: undef func on vxw7krn
Alexandre Oliva [Wed, 22 Feb 2023 17:35:13 +0000 (14:35 -0300)]
[libstdc++] [testsuite] intro/names.cc: undef func on vxw7krn

The '#define func' added in 2021, to test that system headers don't
violate the user namespace, exposes such a bug in the vxworks sysLib.h
header, so add yet another such annotated workaround.

for  libstdc++-v3/ChangeLog

* testsuite/17_intro/names.cc: Undef func on vxworks >= 7 in
kernel mode.

16 months agoRust: In 'type_for_mode' langhook also consider all 'int_n' modes/types
Thomas Schwinge [Wed, 22 Feb 2023 10:42:43 +0000 (11:42 +0100)]
Rust: In 'type_for_mode' langhook also consider all 'int_n' modes/types

As reported in "Rust related issues" at the end of
<https://inbox.sourceware.org/gcc-patches/20221219212344.ewtuzd2jtztm77x2@lug-owl.de>
"Modula-2 / Rust: Many targets failing",
<https://github.com/Rust-GCC/gccrs/issues/1713>
"Test failure on msp430-elfbare target", for '--target=msp430-elfbar' we ICE:

    <built-in>: internal compiler error: Segmentation fault
    0xf2efbf crash_signal
          ../../gcc/gcc/toplev.cc:314
    0x120c8c7 build_function_type(tree_node*, tree_node*, bool)
          ../../gcc/gcc/tree.cc:7360
    0x120cc20 build_function_type_list(tree_node*, ...)
          ../../gcc/gcc/tree.cc:7442
    0x120d16b build_common_builtin_nodes()
          ../../gcc/gcc/tree.cc:9883
    0x8449b4 grs_langhook_init
          ../../gcc/gcc/rust/rust-lang.cc:132
    [...]

This is due to 'tmp == NULL' for 'gcc/tree.cc:build_common_builtin_nodes':

    tmp = lang_hooks.types.type_for_mode (targetm.eh_return_filter_mode (), 0);

..., were 'targetm.eh_return_filter_mode' (that is,
'gcc/targhooks.cc:default_eh_return_filter_mode',
via calling 'targetm.unwind_word_mode':
'gcc/config/msp430/msp430.cc:msp430_unwind_word_mode') returns 'PSImode',
and 'lang_hooks.types.type_for_mode' (that is,
'gcc/rust/rust-lang.cc:grs_langhook_type_for_mode') returns 'NULL' for
'PSImode'.

As, for example, discussed in <https://gcc.gnu.org/PR46805>
"ICE: SIGSEGV in optab_for_tree_code (optabs.c:407) with -O -fno-tree-scev-cprop -ftree-vectorize",
we have to support "random" modes/types in the 'type_for_mode' langhook.

gcc/rust/
* rust-lang.cc (grs_langhook_type_for_mode): Also consider all
'int_n' modes/types.

16 months agovect: inbranch SIMD clones
Andrew Stubbs [Thu, 28 Jul 2022 15:07:22 +0000 (16:07 +0100)]
vect: inbranch SIMD clones

There has been support for generating "inbranch" SIMD clones for a long time,
but nothing actually uses them (as far as I can see).

This patch add supports for a sub-set of possible cases (those using
mask_mode == VOIDmode).  The other cases fail to vectorize, just as before,
so there should be no regressions.

The sub-set of support should cover all cases needed by amdgcn, at present.

gcc/ChangeLog:

* internal-fn.cc (expand_MASK_CALL): New.
* internal-fn.def (MASK_CALL): New.
* internal-fn.h (expand_MASK_CALL): New prototype.
* omp-simd-clone.cc (simd_clone_adjust_argument_types): Set vector_type
for mask arguments also.
* tree-if-conv.cc: Include cgraph.h.
(if_convertible_stmt_p): Do if conversions for calls to SIMD calls.
(predicate_statements): Convert functions to IFN_MASK_CALL.
* tree-vect-loop.cc (vect_get_datarefs_in_loop): Recognise
IFN_MASK_CALL as a SIMD function call.
* tree-vect-stmts.cc (vectorizable_simd_clone_call): Handle
IFN_MASK_CALL as an inbranch SIMD function call.
Generate the mask vector arguments.

gcc/testsuite/ChangeLog:

* gcc.dg/vect/vect-simd-clone-16.c: New test.
* gcc.dg/vect/vect-simd-clone-16b.c: New test.
* gcc.dg/vect/vect-simd-clone-16c.c: New test.
* gcc.dg/vect/vect-simd-clone-16d.c: New test.
* gcc.dg/vect/vect-simd-clone-16e.c: New test.
* gcc.dg/vect/vect-simd-clone-16f.c: New test.
* gcc.dg/vect/vect-simd-clone-17.c: New test.
* gcc.dg/vect/vect-simd-clone-17b.c: New test.
* gcc.dg/vect/vect-simd-clone-17c.c: New test.
* gcc.dg/vect/vect-simd-clone-17d.c: New test.
* gcc.dg/vect/vect-simd-clone-17e.c: New test.
* gcc.dg/vect/vect-simd-clone-17f.c: New test.
* gcc.dg/vect/vect-simd-clone-18.c: New test.
* gcc.dg/vect/vect-simd-clone-18b.c: New test.
* gcc.dg/vect/vect-simd-clone-18c.c: New test.
* gcc.dg/vect/vect-simd-clone-18d.c: New test.
* gcc.dg/vect/vect-simd-clone-18e.c: New test.
* gcc.dg/vect/vect-simd-clone-18f.c: New test.

16 months agoRISC-V: Add RVV reduction C/C++ intrinsics support
Ju-Zhe Zhong [Mon, 20 Feb 2023 06:54:45 +0000 (14:54 +0800)]
RISC-V: Add RVV reduction C/C++ intrinsics support

gcc/ChangeLog:

* config/riscv/riscv-vector-builtins-bases.cc (class reducop): New class.
(class widen_reducop): Ditto.
(class freducop): Ditto.
(class widen_freducop): Ditto.
(BASE): Ditto.
* config/riscv/riscv-vector-builtins-bases.h: Ditto.
* config/riscv/riscv-vector-builtins-functions.def (vredsum): Add reduction support.
(vredmaxu): Ditto.
(vredmax): Ditto.
(vredminu): Ditto.
(vredmin): Ditto.
(vredand): Ditto.
(vredor): Ditto.
(vredxor): Ditto.
(vwredsum): Ditto.
(vwredsumu): Ditto.
(vfredusum): Ditto.
(vfredosum): Ditto.
(vfredmax): Ditto.
(vfredmin): Ditto.
(vfwredosum): Ditto.
(vfwredusum): Ditto.
* config/riscv/riscv-vector-builtins-shapes.cc (struct reduc_alu_def): Ditto.
(SHAPE): Ditto.
* config/riscv/riscv-vector-builtins-shapes.h: Ditto.
* config/riscv/riscv-vector-builtins-types.def (DEF_RVV_WI_OPS): New macro.
(DEF_RVV_WU_OPS): Ditto.
(DEF_RVV_WF_OPS): Ditto.
(vint8mf8_t): Ditto.
(vint8mf4_t): Ditto.
(vint8mf2_t): Ditto.
(vint8m1_t): Ditto.
(vint8m2_t): Ditto.
(vint8m4_t): Ditto.
(vint8m8_t): Ditto.
(vint16mf4_t): Ditto.
(vint16mf2_t): Ditto.
(vint16m1_t): Ditto.
(vint16m2_t): Ditto.
(vint16m4_t): Ditto.
(vint16m8_t): Ditto.
(vint32mf2_t): Ditto.
(vint32m1_t): Ditto.
(vint32m2_t): Ditto.
(vint32m4_t): Ditto.
(vint32m8_t): Ditto.
(vuint8mf8_t): Ditto.
(vuint8mf4_t): Ditto.
(vuint8mf2_t): Ditto.
(vuint8m1_t): Ditto.
(vuint8m2_t): Ditto.
(vuint8m4_t): Ditto.
(vuint8m8_t): Ditto.
(vuint16mf4_t): Ditto.
(vuint16mf2_t): Ditto.
(vuint16m1_t): Ditto.
(vuint16m2_t): Ditto.
(vuint16m4_t): Ditto.
(vuint16m8_t): Ditto.
(vuint32mf2_t): Ditto.
(vuint32m1_t): Ditto.
(vuint32m2_t): Ditto.
(vuint32m4_t): Ditto.
(vuint32m8_t): Ditto.
(vfloat32mf2_t): Ditto.
(vfloat32m1_t): Ditto.
(vfloat32m2_t): Ditto.
(vfloat32m4_t): Ditto.
(vfloat32m8_t): Ditto.
* config/riscv/riscv-vector-builtins.cc (DEF_RVV_WI_OPS): Ditto.
(DEF_RVV_WU_OPS): Ditto.
(DEF_RVV_WF_OPS): Ditto.
(required_extensions_p): Add reduction support.
(rvv_arg_type_info::get_base_vector_type): Ditto.
(rvv_arg_type_info::get_tree_type): Ditto.
* config/riscv/riscv-vector-builtins.h (enum rvv_base_type): Ditto.
* config/riscv/riscv.md: Ditto.
* config/riscv/vector-iterators.md (minu): Ditto.
* config/riscv/vector.md (@pred_reduc_<reduc><mode><vlmul1>): New patern.
(@pred_reduc_<reduc><mode><vlmul1_zve32>): Ditto.
(@pred_widen_reduc_plus<v_su><mode><vwlmul1>): Ditto.
(@pred_widen_reduc_plus<v_su><mode><vwlmul1_zve32>):Ditto.
(@pred_reduc_plus<order><mode><vlmul1>): Ditto.
(@pred_reduc_plus<order><mode><vlmul1_zve32>): Ditto.
(@pred_widen_reduc_plus<order><mode><vwlmul1>): Ditto.