]> gcc.gnu.org Git - gcc.git/log
gcc.git
21 months ago[RFA] Minor improvement to coremark, avoid unconditional jump to return
Jeff Law [Sun, 25 Sep 2022 16:23:59 +0000 (12:23 -0400)]
[RFA] Minor improvement to coremark, avoid unconditional jump to return

gcc/
* cfgcleanup.cc (bb_is_just_return): No longer static.
* cfgcleanup.h (bb_is_just_return): Add prototype.
* cfgrtl.cc (fixup_reorder_chain): Do not create an
unconditional jump to a return block.  Conditionally
remove unreachable blocks.

gcc/testsuite/

* gcc.target/riscv/ret-1.c: New test.

21 months agofix assert in __deregister_frame_info_bases
Thomas Neumann [Fri, 23 Sep 2022 13:57:13 +0000 (15:57 +0200)]
fix assert in __deregister_frame_info_bases

When using the atomic fast path deregistering can fail during
program shutdown if the lookup structures are already destroyed.
The assert in __deregister_frame_info_bases takes that into
account. In the non-fast-path case however is not aware of
program shutdown, which caused a compiler error on such platforms.
We fix that by introducing a constant for in_shutdown in
non-fast-path builds.
We also drop the destructor priority, as it is not supported on
all platforms and we no longer rely upon the priority anyway.

libgcc/ChangeLog:
* unwind-dw2-fde.c: Introduce a constant for in_shutdown
for the non-fast-path case. Drop destructor priority.

21 months agolibstdc++: Add #if around non-C++03 code in std::bitset [PR107037]
Jonathan Wakely [Mon, 26 Sep 2022 10:11:35 +0000 (11:11 +0100)]
libstdc++: Add #if around non-C++03 code in std::bitset [PR107037]

libstdc++-v3/ChangeLog:

PR libstdc++/107037
* include/std/bitset (_Base_bitset::_M_do_reset): Use
preprocessor conditional around non-C++03 code.
* testsuite/20_util/bitset/107037.cc: New test.

21 months agoOpenACC: Fix reduction tree-sharing issue [PR106982]
Tobias Burnus [Mon, 26 Sep 2022 10:45:28 +0000 (12:45 +0200)]
OpenACC: Fix reduction tree-sharing issue [PR106982]

The tree for var == incoming == outgound was
'MEM <double[5]> [(double *)&reduced]' which caused the ICE
"incorrect sharing of tree nodes".

PR middle-end/106982

gcc/ChangeLog:

* omp-low.cc (lower_oacc_reductions): Add some unshare_expr.

gcc/testsuite/ChangeLog:

* c-c++-common/goacc/reduction-7.c: New test.
* c-c++-common/goacc/reduction-8.c: New test.

21 months agos390: fix wrong refactoring
Martin Liska [Mon, 26 Sep 2022 10:06:48 +0000 (12:06 +0200)]
s390: fix wrong refactoring

Since r13-2251-g1930c5d05ceff2, the refactoring is not 1:1 and we end
up with a wrong rtx type.

gcc/ChangeLog:

* config/s390/s390.cc (s390_rtx_costs): Remove dest variable
and use only dst.

21 months agoaarch64: Add -march support for Armv9.1-A, Armv9.2-A, Armv9.3-A
Kyrylo Tkachov [Mon, 26 Sep 2022 09:10:25 +0000 (10:10 +0100)]
aarch64: Add -march support for Armv9.1-A, Armv9.2-A, Armv9.3-A

This is a straightforward patch that allows targeting the architecture revisions mentioned in the subject
through -march. These are already supported in binutils.

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

gcc/ChangeLog:

* config/aarch64/aarch64-arches.def (armv9.1-a): Define.
(armv9.2-a): Likewise.
(armv9.3-a): Likewise.
* config/aarch64/aarch64.h (AARCH64_FL_V9_1): Likewise.
(AARCH64_FL_V9_2): Likewise.
(AARCH64_FL_V9_3): Likewise.
(AARCH64_FL_FOR_ARCH9_1): Likewise.
(AARCH64_FL_FOR_ARCH9_2): Likewise.
(AARCH64_FL_FOR_ARCH9_3): Likewise.
(AARCH64_ISA_V9_1): Likewise.
(AARCH64_ISA_V9_2): Likewise.
(AARCH64_ISA_V9_3): Likewise.
* doc/invoke.texi (AArch64 Options): Document armv9.1-a, armv9.2-a,
armv9.3-a values to -march.

21 months agoada: Doc: rename Valid_Image to Valid_Value
Ghjuvan Lacambre [Fri, 9 Sep 2022 12:44:03 +0000 (14:44 +0200)]
ada: Doc: rename Valid_Image to Valid_Value

This renaming happened some time ago in the code, but the documentation
was not updated.

gcc/ada/

* doc/gnat_rm/implementation_defined_attributes.rst: Rename Valid_Image.
* gnat_rm.texi: Regenerate.
* gnat_ugn.texi: Regenerate.

21 months agoada: Fix location of pragmas coming from aspects in top-level instances
Piotr Trojanek [Wed, 14 Sep 2022 19:59:05 +0000 (21:59 +0200)]
ada: Fix location of pragmas coming from aspects in top-level instances

This patch fixes an AST anomaly where pragmas that correspond to aspects
of a generic package declaration appeared as the auxiliary declarations
of the compilation unit for the instantiated package body.

In particular, this anomaly happened for aspect Annotate and affected
GNATprove, which didn't pick pragma corresponding to this aspect.

gcc/ada/

* sem_ch12.adb (Build_Instance_Compilation_Unit_Nodes): Relocate
auxiliary declarations from the original compilation unit to the
newly created compilation unit for the spec.

21 months agoada: Remove unreferenced Rtsfind entries
Piotr Trojanek [Fri, 9 Sep 2022 21:32:00 +0000 (23:32 +0200)]
ada: Remove unreferenced Rtsfind entries

Remove unreferenced entries for finding runtime units and runtime
entities by the compiler. Code cleanup using basic grep scripting.

gcc/ada/

* rtsfind.ads
(RTU_Id): Remove unreferenced packages; fix whitespace.
(RE_Id): Remove unreferenced entities; add comment about entity
that is only used by GNATprove and not by GNAT.

21 months agoada: Remove unreferenced C macro from OS constants template
Piotr Trojanek [Sat, 10 Sep 2022 09:22:55 +0000 (11:22 +0200)]
ada: Remove unreferenced C macro from OS constants template

The STR/STR1 macros in OS constants template has been unreferenced since
2005, so we can safely remove them.

gcc/ada/

* s-oscons-tmplt.c (STR, STR1): Remove.

21 months agoada: Document Long_Long_Long_Size parameter for -gnateT
Eric Botcazou [Tue, 13 Sep 2022 17:48:02 +0000 (19:48 +0200)]
ada: Document Long_Long_Long_Size parameter for -gnateT

This was overlooked when the new parameter was created.

gcc/ada/

* doc/gnat_ugn/building_executable_programs_with_gnat.rst
(-gnateT): Document new parameter Long_Long_Long_Size.
* gnat_ugn.texi: Regenerate.

21 months agoada: Improve CUDA host-side and device-side binder support
Steve Baird [Mon, 12 Sep 2022 22:31:19 +0000 (15:31 -0700)]
ada: Improve CUDA host-side and device-side binder support

Binder-generated code is not allowed to use Ada2012 syntax. In order to
specify an aspect, a pragma must be used.

gcc/ada/

* bindgen.adb: When the binder is invoked for the device, specify
the CUDA_Global aspect for the adainit and adafinal procedures via
a pragma instead of via an aspect_specification.

21 months agoada: Document support for the mold linker
Kévin Le Gouguec [Mon, 4 Jul 2022 09:12:47 +0000 (11:12 +0200)]
ada: Document support for the mold linker

gcc/ada/

* doc/gnat_ugn/building_executable_programs_with_gnat.rst
(Linker Switches): Document support for mold along with gold; add some
advice regarding OpenSSL in the Pro version.
* gnat_ugn.texi: Regenerate.

21 months agoada: Make Original_Aspect_Pragma_Name more precise
Tucker Taft [Tue, 13 Sep 2022 13:28:42 +0000 (15:28 +0200)]
ada: Make Original_Aspect_Pragma_Name more precise

This commit makes Original_Aspect_Pragma_Name more precise in cases
where there is a second level of indirection caused by pragmas being
turned into Check pragmas.

gcc/ada/

* sem_util.adb (Original_Aspect_Pragma_Name): Check for Check
pragmas.

21 months agoada: Delay expansion of iterator specification in preanalysis
Piotr Trojanek [Mon, 12 Sep 2022 16:10:59 +0000 (18:10 +0200)]
ada: Delay expansion of iterator specification in preanalysis

When preanalysing spec expression (e.g. expression of an expression
function), the name of iterator specification should not be expanded.

This patch simplifies a complicated condition for delaying expansion
within quantified expressions and iterated component associations.

gcc/ada/

* sem_ch5.adb (Analyze_Iterator_Specification): Delay expansion
based on Full_Analysis flag.

21 months agoada: Delay expansion of iterated component association
Piotr Trojanek [Mon, 12 Sep 2022 13:33:15 +0000 (15:33 +0200)]
ada: Delay expansion of iterated component association

When preanalysing spec expression (e.g. expression of an expression
function), the name of iterator specification within an iterated
component association should not be expanded, especially in GNATprove
mode.

gcc/ada/

* sem_ch5.adb (Analyze_Iterator_Specification): Delay expansion of
for iterated component association just like it is done within
quantified expression.

21 months agoada: Only reject volatile ghost objects when SPARK_Mode is On
Piotr Trojanek [Thu, 8 Sep 2022 12:58:24 +0000 (14:58 +0200)]
ada: Only reject volatile ghost objects when SPARK_Mode is On

SPARK rule that forbids ghost volatile objects is only affecting proof
and not generation of object code. It is now only applied where SPARK_Mode
is On. This flexibility is needed to compile code automatically instrumented
by GNATcoverage.

gcc/ada/

* contracts.adb (Analyze_Object_Contract): Check SPARK_Mode before
applying SPARK rule.

21 months agoada: Improve accessibility check generation
Justin Squirek [Tue, 6 Sep 2022 15:59:59 +0000 (15:59 +0000)]
ada: Improve accessibility check generation

Improve accessibility check generation by more precisely identifying cases in
which an Original_Node call is needed.

Instead of grabbing the Original_Node of a prefix in all cases (since this
can cause issues where unanalyzed instance names get referenced) we only
obtain the original node when said prefix comes as a result of expanding
function calls.

gcc/ada/

* sem_util.adb
(Accessibility_Level): Modify indexed and selected components case
by reducing the scope where Original_Node gets used.

21 months agoada: Remove GNATmetric's documentation from GNAT's documentation
Boris Yakobowski [Wed, 7 Sep 2022 17:37:03 +0000 (19:37 +0200)]
ada: Remove GNATmetric's documentation from GNAT's documentation

gcc/ada/

* doc/gnat_ugn/gnat_utility_programs.rst: Remove documentation for
gnatmetric.

21 months agoada: Remove socket definitions for ancient MinGW
Piotr Trojanek [Mon, 5 Sep 2022 11:29:38 +0000 (13:29 +0200)]
ada: Remove socket definitions for ancient MinGW

Modern MinGW defines _WIN32_WINNT as 0xa00, so there is no need go guard
against it being lower than 0x0600 or setting it to 0x0501.

gcc/ada/

* gsocket.h: Remove redefinition of _WIN32_WINNT.
* mingw32.h: Remove conditional definition of _WIN32_WINNT.

21 months agoada: Remove definition of MAXPATHLEN for ancient MinGW
Piotr Trojanek [Mon, 5 Sep 2022 11:17:15 +0000 (13:17 +0200)]
ada: Remove definition of MAXPATHLEN for ancient MinGW

Modern MinGW defines MAXPATHLEN in sys/param.h, so better to use it
directly.

gcc/ada/

* mingw32.h: Remove condition definition of MAXPATHLEN; the include
directive for stdlib.h was most likely intended to provide the
MAX_PATH.

21 months agoada: Deconstruct build support for ancient MinGW
Piotr Trojanek [Mon, 5 Sep 2022 09:40:50 +0000 (11:40 +0200)]
ada: Deconstruct build support for ancient MinGW

Remove conditional C code for building GNAT with MinGW earlier than 2.0,
which was released in 2007.

gcc/ada/

* adaint.c: Remove conditional #include directives for old MinGW.
* cal.c: Always include winsock.h, since it is part of modern
MinGW.
* cstreams.c: Remove workaround for old MinGW.
* expect.c: Remove conditional #include directive for old MinGW.
* mingw32.h: Remove STD_MINGW and OLD_MINGW declarations.
* sysdep.c: Remove conditional #include directive for old MinGW.

21 months agoada: Tune comment of routine for detecting junk names
Piotr Trojanek [Wed, 7 Sep 2022 17:11:06 +0000 (19:11 +0200)]
ada: Tune comment of routine for detecting junk names

Reword comment to avoid repetition between spec and body.

gcc/ada/

* sem_warn.ads (Has_Junk_Name): Reword comment.

21 months agoSmall tweaks.
Eric Botcazou [Mon, 26 Sep 2022 08:41:21 +0000 (10:41 +0200)]
Small tweaks.

21 months agoranger: remove unused function
Martin Liska [Mon, 26 Sep 2022 07:30:44 +0000 (09:30 +0200)]
ranger: remove unused function

gcc/ChangeLog:

* value-range.cc (tree_compare): Remove unused function.

21 months agors6000: Fix the condition with frame_pointer_needed_indeed [PR96072]
Kewen Lin [Mon, 26 Sep 2022 05:33:18 +0000 (00:33 -0500)]
rs6000: Fix the condition with frame_pointer_needed_indeed [PR96072]

As PR96072 shows, the code adding REG_CFA_DEF_CFA reg note
makes one assumption that we have emitted one insn which
restores the frame pointer previously.  That part of code
was guarded with flag frame_pointer_needed before, it was
consistent, but it was replaced with flag
frame_pointer_needed_indeed since commit r10-7981.  It
caused ICE due to unexpected NULL insn.

PR target/96072

gcc/ChangeLog:

* config/rs6000/rs6000-logue.cc (rs6000_emit_epilogue): Update the
condition for adding REG_CFA_DEF_CFA reg note with
frame_pointer_needed_indeed.

gcc/testsuite/ChangeLog:

* gcc.target/powerpc/pr96072.c: New test.

21 months agotestsuite: Fix up avx256-unaligned-store-3.c test.
Hu, Lin1 [Mon, 26 Sep 2022 02:15:08 +0000 (10:15 +0800)]
testsuite: Fix up avx256-unaligned-store-3.c test.

gcc/testsuite/ChangeLog:

PR target/94962
* gcc.target/i386/avx256-unaligned-store-3.c: Add -mno-avx512f

21 months agors6000: Fix condition of define_expand vec_shr_<mode> [PR100645]
Kewen Lin [Mon, 26 Sep 2022 03:01:50 +0000 (22:01 -0500)]
rs6000: Fix condition of define_expand vec_shr_<mode> [PR100645]

PR100645 exposes one latent bug in define_expand vec_shr_<mode>
that the current condition TARGET_ALTIVEC is too loose.  The
mode iterator VEC_L contains a few modes, they are not always
supported as vector mode, VECTOR_UNIT_ALTIVEC_OR_VSX_P should
be used like some other VEC_L usages.

PR target/100645

gcc/ChangeLog:

* config/rs6000/vector.md (vec_shr_<mode>): Replace condition
TARGET_ALTIVEC with VECTOR_UNIT_ALTIVEC_OR_VSX_P.

gcc/testsuite/ChangeLog:

* gcc.target/powerpc/pr100645.c: New test.

21 months agoSupport 2-instruction vector shuffle for V4SI/V4SF in ix86_expand_vec_perm_const_1.
liuhongt [Wed, 21 Sep 2022 06:56:08 +0000 (14:56 +0800)]
Support 2-instruction vector shuffle for V4SI/V4SF in ix86_expand_vec_perm_const_1.

2022-09-23  Hongtao Liu  <hongtao.liu@intel.com>
    Liwei Xu  <liwei.xu@intel.com>

gcc/ChangeLog:

PR target/53346
* config/i386/i386-expand.cc (expand_vec_perm_shufps_shufps):
New function.
(ix86_expand_vec_perm_const_1): Insert
expand_vec_perm_shufps_shufps at the end of 2-instruction
expand sequence.

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr53346-1.c: New test.
* gcc.target/i386/pr53346-2.c: New test.
* gcc.target/i386/pr53346-3.c: New test.
* gcc.target/i386/pr53346-4.c: New test.

21 months agoDaily bump.
GCC Administrator [Mon, 26 Sep 2022 00:18:09 +0000 (00:18 +0000)]
Daily bump.

21 months agofortran: Support clobbering of derived types [PR41453]
Mikael Morin [Thu, 1 Sep 2022 10:35:07 +0000 (12:35 +0200)]
fortran: Support clobbering of derived types [PR41453]

This adds support for clobbering of non-polymorphic derived type
variables, when they are passed as actual argument whose associated
dummy has the INTENT(OUT) attribute.

We avoid to play with non-constant type sizes or class descriptors by
requiring that the types are derived (not class) and strictly matching,
and by excluding parameterized derived types.

Types that are used in the callee are also excluded: they are types with
allocatable components (the components will be deallocated), and
finalizable types or types with finalizable components (they will be
passed to finalization routines).

PR fortran/41453

gcc/fortran/ChangeLog:

* trans-expr.cc (gfc_conv_procedure_call): Allow strictly
matching derived types.

gcc/testsuite/ChangeLog:

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

21 months agofortran: Support clobbering of allocatables and pointers [PR41453]
Mikael Morin [Thu, 1 Sep 2022 09:27:36 +0000 (11:27 +0200)]
fortran: Support clobbering of allocatables and pointers [PR41453]

This adds support for clobbering of allocatable and pointer scalar
variables passed as actual argument to a subroutine when the associated
dummy has the INTENT(OUT) attribute.
Support was explicitly disabled (since the beginning for pointers, since
r11-7315-g2df374b337a5f6cf5528e91718e4e12e4006b7ae for allocatables),
but the clobber generation code seems to support it well, as
demonstrated by the newly added testcase.

PR fortran/41453
PR fortran/99169

gcc/fortran/ChangeLog:

* trans-expr.cc (gfc_conv_procedure_call): Remove conditions
on ALLOCATABLE and POINTER attributes guarding clobber
generation.

gcc/testsuite/ChangeLog:

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

21 months agofortran: Support clobbering of ASSOCIATE variables [PR41453]
Mikael Morin [Wed, 31 Aug 2022 09:58:08 +0000 (11:58 +0200)]
fortran: Support clobbering of ASSOCIATE variables [PR41453]

This is in spirit a revert of:
r9-3051-gc109362313623d83fe0a5194bceaf994cf0c6ce0

That commit added a condition to avoid generating ICE with clobbers
of ASSOCIATE variables.
The test added at that point continues to pass if we remove that
condition now.

PR fortran/41453
PR fortran/87401

gcc/fortran/ChangeLog:

* trans-expr.cc (gfc_conv_procedure_call): Remove condition
disabling clobber generation for ASSOCIATE variables.

gcc/testsuite/ChangeLog:

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

21 months agofortran: Support clobbering of SAVE variables [PR41453]
Mikael Morin [Wed, 31 Aug 2022 09:54:47 +0000 (11:54 +0200)]
fortran: Support clobbering of SAVE variables [PR41453]

This removes a condition added in:
r9-3032-gee7fb0588c6361b4d77337ab0f7527be64fcdde2.

That commit added a condition to avoid generating ICE with clobbers
of variables with the SAVE attribute.
The test added at that point continues to pass if we remove that
condition now.

PR fortran/41453
PR fortran/87395

gcc/fortran/ChangeLog:

* trans-expr.cc (gfc_conv_procedure_call): Remove condition
on SAVE attribute guarding clobber generation.

gcc/testsuite/ChangeLog:

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

21 months agofortran: Support clobbering of reference variables [PR41453]
Mikael Morin [Mon, 29 Aug 2022 11:27:02 +0000 (13:27 +0200)]
fortran: Support clobbering of reference variables [PR41453]

This adds support for clobbering of variables passed by reference,
when the reference is forwarded to a subroutine as actual argument
whose associated dummy has the INTENT(OUT) attribute.
This was explicitly disabled by a condition added with
r9-3032-gee7fb0588c6361b4d77337ab0f7527be64fcdde2 and removing that
condition seems to work, as demonstrated by the new testcase.

PR fortran/41453
PR fortran/87395

gcc/fortran/ChangeLog:

* trans-expr.cc (gfc_conv_procedure_call): Remove condition
disabling clobber generation for dummy variables.  Remove
obsolete comment.

gcc/testsuite/ChangeLog:

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

21 months agofortran: Support clobbering with implicit interfaces [PR105012]
Harald Anlauf [Wed, 31 Aug 2022 09:50:35 +0000 (11:50 +0200)]
fortran: Support clobbering with implicit interfaces [PR105012]

Before procedure calls, we clobber actual arguments whose associated
dummy is INTENT(OUT).  This only applies to procedures with explicit
interfaces, as the knowledge of the interface is necessary to know
whether an argument has the INTENT(OUT) attribute.

This change also enables clobber generation for procedure calls without
explicit interface, when the procedure has been defined in the same
file because we can use the dummy arguments' characteristics from the
procedure definition in that case.

The knowledge of the dummy characteristics is directly available through
gfc_actual_arglist’s associated_dummy pointers which have been populated
as a side effect of calling gfc_check_externals.

PR fortran/105012

gcc/fortran/ChangeLog:

* trans-expr.cc (gfc_conv_procedure_call): Use dummy
information from associated_dummy if there is no information
from the procedure interface.

gcc/testsuite/ChangeLog:

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

Co-Authored-By: Mikael Morin <mikael@gcc.gnu.org>
21 months agofortran: Move clobbers after evaluation of all arguments [PR106817]
Mikael Morin [Sat, 3 Sep 2022 09:58:47 +0000 (11:58 +0200)]
fortran: Move clobbers after evaluation of all arguments [PR106817]

For actual arguments whose dummy is INTENT(OUT), we used to generate
clobbers on them at the same time we generated the argument reference
for the function call.  This was wrong if for an argument coming
later, the value expression was depending on the value of the just-
clobbered argument, and we passed an undefined value in that case.

With this change, clobbers are collected separatedly and appended
to the procedure call preliminary code after all the arguments have been
evaluated.

PR fortran/106817

gcc/fortran/ChangeLog:

* trans-expr.cc (gfc_conv_procedure_call): Collect all clobbers
to their own separate block.  Append the block of clobbers to
the procedure preliminary block after the argument evaluation
codes for all the arguments.

gcc/testsuite/ChangeLog:

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

21 months agofortran: Fix invalid function decl clobber ICE [PR105012]
Mikael Morin [Mon, 29 Aug 2022 09:19:29 +0000 (11:19 +0200)]
fortran: Fix invalid function decl clobber ICE [PR105012]

The fortran frontend, as result symbol for a function without
declared result symbol, uses the function symbol itself.  This caused
an invalid clobber of a function decl to be emitted, leading to an
ICE, whereas the intended behaviour was to clobber the function result
variable.  This change fixes the problem by getting the decl from the
just-retrieved variable reference after the call to
gfc_conv_expr_reference, instead of copying it from the frontend symbol.

PR fortran/105012

gcc/fortran/ChangeLog:

* trans-expr.cc (gfc_conv_procedure_call): Retrieve variable
from the just calculated variable reference.

gcc/testsuite/ChangeLog:

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

21 months agofortran: Move the clobber generation code
Mikael Morin [Wed, 31 Aug 2022 09:00:45 +0000 (11:00 +0200)]
fortran: Move the clobber generation code

This change inlines the clobber generation code from
gfc_conv_expr_reference to the single caller from where the add_clobber
flag can be true, and removes the add_clobber argument.

What motivates this is the standard making the procedure call a cause
for a variable to become undefined, which translates to a clobber
generation, so clobber generation should be closely related to procedure
call generation, whereas it is rather orthogonal to variable reference
generation.  Thus the generation of the clobber feels more appropriate
in gfc_conv_procedure_call than in gfc_conv_expr_reference.

Behaviour remains unchanged.

gcc/fortran/ChangeLog:

* trans.h (gfc_conv_expr_reference): Remove add_clobber
argument.
* trans-expr.cc (gfc_conv_expr_reference): Ditto. Inline code
depending on add_clobber and conditions controlling it ...
(gfc_conv_procedure_call): ... to here.

21 months agoFix typo in chapter level for RISC-V attributes
Torbjörn SVENSSON [Fri, 23 Sep 2022 18:38:45 +0000 (20:38 +0200)]
Fix typo in chapter level for RISC-V attributes

The "RISC-V specific attributes" section should be at the same level
as "PowerPC-specific attributes".

gcc/ChangeLog:

* doc/sourcebuild.texi: Fix chapter level.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
21 months agoDaily bump.
GCC Administrator [Sun, 25 Sep 2022 00:18:01 +0000 (00:18 +0000)]
Daily bump.

21 months agolibstdc++: Simplify detection idiom using concepts
Jonathan Wakely [Fri, 23 Sep 2022 22:16:30 +0000 (23:16 +0100)]
libstdc++: Simplify detection idiom using concepts

Add a simpler definition of std::__detected_or using concepts.  This
also replaces the __detector::value_t member which should have been using
a reserved name.

Use __detected_or in pointer_traits.

libstdc++-v3/ChangeLog:

* include/bits/alloc_traits.h (allocator_traits::is_always_equal):
Only instantiate is_empty if needed.
* include/bits/ptr_traits.h (__ptr_traits_impl::difference_type)
(__ptr_traits_impl::rebind): Use __detected_or.
* include/experimental/type_traits (is_same_v): Add a partial
specialization instead of instantiating the std::is_same class
template.
(detected_t): Redefine in terms of detected_or_t.
(is_detected, is_detected_v): Redefine in terms of detected_t.
* include/std/type_traits [__cpp_concepts] (__detected_or): Add
new definition using concepts.
(__detector::value_t): Rename to __is_detected.
* testsuite/17_intro/names.cc: Check value_t isn't used.

21 months agoopenmp: Fix ICE with taskgroup at -O0 -fexceptions [PR107001]
Jakub Jelinek [Sat, 24 Sep 2022 07:24:26 +0000 (09:24 +0200)]
openmp: Fix ICE with taskgroup at -O0 -fexceptions [PR107001]

The following testcase ICEs because with -O0 -fexceptions GOMP_taskgroup_end
call isn't directly followed by GOMP_RETURN statement, but there are some
conditionals to handle exceptions and we fail to find the correct GOMP_RETURN.

The fix is to treat taskgroup similarly to target data, both of these constructs
emit a try { body } finally { end_call } around the construct's body during
gimplification and we need to see proper construct nesting during gimplification
and omp lowering (including nesting of regions checks), but during omp expansion
we don't really need their nesting anymore, all we need is emit something at
the start of the region and the end of the region is the end API call we've
already emitted during gimplification.  For target data, we weren't adding
GOMP_RETURN statement during omp lowering, so after that pass it is treated
merely like stand-alone omp directives.  This patch does the same for
taskgroup too.

2022-09-24  Jakub Jelinek  <jakub@redhat.com>

PR c/107001
* omp-low.cc (lower_omp_taskgroup): Don't add GOMP_RETURN statement
at the end.
* omp-expand.cc (build_omp_regions_1): Clarify GF_OMP_TARGET_KIND_DATA
is not stand-alone directive.  For GIMPLE_OMP_TASKGROUP, also don't
update parent.
(omp_make_gimple_edges) <case GIMPLE_OMP_TASKGROUP>: Reset
cur_region back after new_omp_region.

* c-c++-common/gomp/pr107001.c: New test.

21 months agoopenmp, c: Tighten up c_tree_equal [PR106981]
Jakub Jelinek [Sat, 24 Sep 2022 07:19:26 +0000 (09:19 +0200)]
openmp, c: Tighten up c_tree_equal [PR106981]

This patch changes c_tree_equal to work more like cp_tree_equal, be
more strict in what it accepts.  The ICE on the first testcase was
due to INTEGER_CST wi::wide (t1) == wi::wide (t2) comparison which
ICEs if the two constants have different precision, but as the second
testcase shows, being too lenient in it can also lead to miscompilation
of valid OpenMP programs where we think certain expression is the same
even when it isn't and can be guaranteed at runtime to represent different
memory location.  So, the patch looks through only NON_LVALUE_EXPRs
and for constants as well as casts requires that the types match before
actually comparing the constant values or recursing on the cast operands.

2022-09-24  Jakub Jelinek  <jakub@redhat.com>

PR c/106981
gcc/c/
* c-typeck.cc (c_tree_equal): Only strip NON_LVALUE_EXPRs at the
start.  For CONSTANT_CLASS_P or CASE_CONVERT: return false if t1 and
t2 have different types.
gcc/testsuite/
* c-c++-common/gomp/pr106981.c: New test.
libgomp/
* testsuite/libgomp.c-c++-common/pr106981.c: New test.

21 months agoDaily bump.
GCC Administrator [Sat, 24 Sep 2022 00:16:37 +0000 (00:16 +0000)]
Daily bump.

21 months agolibstdc++: Add test for type traits not having friend access
Jonathan Wakely [Fri, 23 Sep 2022 21:04:24 +0000 (22:04 +0100)]
libstdc++: Add test for type traits not having friend access

This ensures that the std::is_assignable and std::is_assignable_v
traits are evaluated "in a context unrelated" to the argument types.

libstdc++-v3/ChangeLog:

* testsuite/20_util/is_assignable/requirements/access.cc:
New test.

21 months agolibstdc++: Fix std::is_nothrow_invocable_r for uncopyable prvalues [PR91456]
Jonathan Wakely [Fri, 23 Sep 2022 12:28:37 +0000 (13:28 +0100)]
libstdc++: Fix std::is_nothrow_invocable_r for uncopyable prvalues [PR91456]

This is the last missing piece of PR 91456.

This also removes the only use of the C++11 version of
std::is_nothrow_invocable, which was just renamed to
__is_nothrow_invocable_lib. We can remove that now.

libstdc++-v3/ChangeLog:

PR libstdc++/91456
* include/std/type_traits (__is_nothrow_invocable_lib): Remove.
(__is_invocable_impl::__nothrow_type): New member type which
checks if the conversion can throw.
(__is_nt_invocable_impl): Replace class template with alias
template to __is_nt_invocable_impl::__nothrow_type.
* testsuite/20_util/is_nothrow_invocable/91456.cc: New test.
* testsuite/20_util/is_nothrow_convertible/value.cc: Remove
macro used by value_ext.cc test.
* testsuite/20_util/is_nothrow_convertible/value_ext.cc: Remove
test for non-standard __is_nothrow_invocable_lib trait.

21 months agotestsuite: Add more C2x tests
Joseph Myers [Fri, 23 Sep 2022 21:23:01 +0000 (21:23 +0000)]
testsuite: Add more C2x tests

There are some new requirements in C2x where GCC already behaves as
required (for all standard versions), where previous standard versions
either had weaker requirements permitting the GCC behavior, or were
arguably defective in what they said in that area.  Add tests that
specifically verify GCC behaves as expected for C2x.  (There may be
further such tests to be added in future for already-supported C2x
features.)

* Compound literals in function parameter lists have automatic storage
  duration.  (This is a case where strictly this wasn't specified by
  previous standard versions, but it seems to make more sense to treat
  this as a defect in those versions than to implement something
  different conditionally for those versions.)

* Concatenation of string literals with different prefixes is a
  constraint violation (previously it was implementation-defined
  whether it was permitted, and GCC did not permit it).

* UCNs above 0x10ffff are a constraint violation; previously they were
  implicitly undefined behavior by virtue of wording about "designates
  the character" referring to code points outside the ISO/IEC 10646
  range; GCC diagnosed such UCNs since commit
  0900e29cdbc533fecf2a311447bbde17f101bbd6 (Sep 2019).  The test I
  added also has more detailed coverage of what lower-valued UCNs are
  accepted.

Tested for x86_64-pc-linux-gnu.

* gcc.dg/c2x-complit-1.c, gcc.dg/c2x-concat-1.c,
gcc.dg/cpp/c2x-ucn-1.c: New tests.

21 months agotestsuite: Skip intrinsics test if arm
Torbjörn SVENSSON [Mon, 19 Sep 2022 16:08:46 +0000 (18:08 +0200)]
testsuite: Skip intrinsics test if arm

In the test cases, it's clearly written that intrinsics is not
implemented on arm*. A simple xfail does not help since there are
link error and that would cause an UNRESOLVED testcase rather than
XFAIL.
By changing to dg-skip-if, the entire test case is omitted.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/advsimd-intrinsics/vld1x2.c: Replace
dg-xfail-if with dg-skip-if.
* gcc.target/aarch64/advsimd-intrinsics/vld1x3.c: Likewise.
* gcc.target/aarch64/advsimd-intrinsics/vld1x4.c: Likewise.

Co-Authored-By: Yvan ROUX <yvan.roux@foss.st.com>
Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
21 months agoc++: Implement __is_{nothrow_,}convertible [PR106784]
Marek Polacek [Tue, 20 Sep 2022 19:48:52 +0000 (15:48 -0400)]
c++: Implement __is_{nothrow_,}convertible [PR106784]

To improve compile times, the C++ library could use compiler built-ins
rather than implementing std::is_convertible (and _nothrow) as class
templates.  This patch adds the built-ins.  We already have
__is_constructible and __is_assignable, and the nothrow forms of those.

Microsoft (and clang, for compatibility) also provide an alias called
__is_convertible_to.  I did not add it, but it would be trivial to do
so.

I noticed that our __is_assignable doesn't implement the "Access checks
are performed as if from a context unrelated to either type" requirement,
therefore std::is_assignable / __is_assignable give two different results
here:

  class S {
    operator int();
    friend void g(); // #1
  };

  void
  g ()
  {
    // #1 doesn't matter
    static_assert(std::is_assignable<int&, S>::value, "");
    static_assert(__is_assignable(int&, S), "");
  }

This is not a problem if __is_assignable is not meant to be used by
the users.

This patch doesn't make libstdc++ use the new built-ins, but I had to
rename a class otherwise its name would clash with the new built-in.

PR c++/106784

gcc/c-family/ChangeLog:

* c-common.cc (c_common_reswords): Add __is_convertible and
__is_nothrow_convertible.
* c-common.h (enum rid): Add RID_IS_CONVERTIBLE and
RID_IS_NOTHROW_CONVERTIBLE.

gcc/cp/ChangeLog:

* constraint.cc (diagnose_trait_expr): Handle CPTK_IS_CONVERTIBLE
and CPTK_IS_NOTHROW_CONVERTIBLE.
* cp-objcp-common.cc (names_builtin_p): Handle RID_IS_CONVERTIBLE
RID_IS_NOTHROW_CONVERTIBLE.
* cp-tree.h (enum cp_trait_kind): Add CPTK_IS_CONVERTIBLE and
CPTK_IS_NOTHROW_CONVERTIBLE.
(is_convertible): Declare.
(is_nothrow_convertible): Likewise.
* cxx-pretty-print.cc (pp_cxx_trait_expression): Handle
CPTK_IS_CONVERTIBLE and CPTK_IS_NOTHROW_CONVERTIBLE.
* method.cc (is_convertible): New.
(is_nothrow_convertible): Likewise.
* parser.cc (cp_parser_primary_expression): Handle RID_IS_CONVERTIBLE
and RID_IS_NOTHROW_CONVERTIBLE.
(cp_parser_trait_expr): Likewise.
* semantics.cc (trait_expr_value): Handle CPTK_IS_CONVERTIBLE and
CPTK_IS_NOTHROW_CONVERTIBLE.
(finish_trait_expr): Likewise.

libstdc++-v3/ChangeLog:

* include/std/type_traits: Rename __is_nothrow_convertible to
__is_nothrow_convertible_lib.
* testsuite/20_util/is_nothrow_convertible/value_ext.cc: Likewise.

gcc/testsuite/ChangeLog:

* g++.dg/ext/has-builtin-1.C: Enhance to test __is_convertible and
__is_nothrow_convertible.
* g++.dg/ext/is_convertible1.C: New test.
* g++.dg/ext/is_convertible2.C: New test.
* g++.dg/ext/is_nothrow_convertible1.C: New test.
* g++.dg/ext/is_nothrow_convertible2.C: New test.

21 months agoRISC-V: make USE_LOAD_ADDRESS_MACRO easier to understand
Vineet Gupta [Fri, 2 Sep 2022 23:08:20 +0000 (16:08 -0700)]
RISC-V: make USE_LOAD_ADDRESS_MACRO easier to understand

The current macro has several && and || making it really hard to understand
the first time.

Signed-off-by: Vineet Gupta <vineetg@rivosinc.com>
gcc/ChangeLog:

* config/riscv/riscv.h (LOCAL_SYM_P): New.
(USE_LOAD_ADDRESS_MACRO): Simplify by calling LOCAL_SYM_P.

21 months agoRISC-V: Add RVV machine modes.
zhongjuzhe [Thu, 15 Sep 2022 11:39:43 +0000 (19:39 +0800)]
RISC-V: Add RVV machine modes.

gcc/ChangeLog:

* config/riscv/riscv-modes.def (VECTOR_BOOL_MODE): Add RVV mask modes.
(ADJUST_NUNITS): Adjust nunits using riscv_vector_chunks.
(ADJUST_ALIGNMENT): Adjust alignment.
(ADJUST_BYTESIZE): Adjust bytesize using riscv_vector_chunks.
(RVV_MODES): New macro.
(VECTOR_MODE_WITH_PREFIX): Add RVV vector modes.
(VECTOR_MODES_WITH_PREFIX): Add RVV vector modes.

21 months agoRISC-V: Support poly move manipulation and selftests.
zhongjuzhe [Thu, 15 Sep 2022 08:28:53 +0000 (16:28 +0800)]
RISC-V: Support poly move manipulation and selftests.

gcc/ChangeLog:

* common/config/riscv/riscv-common.cc: Change "static void" to "void".
* config.gcc: Add riscv-selftests.o
* config/riscv/predicates.md: Allow const_poly_int.
* config/riscv/riscv-protos.h (riscv_reinit): New function.
(riscv_parse_arch_string): change as exten function.
(riscv_run_selftests): New function.
* config/riscv/riscv.cc (riscv_cannot_force_const_mem): Don't allow poly
into const pool.
(riscv_report_v_required): New function.
(riscv_expand_op): New function.
(riscv_expand_mult_with_const_int): New function.
(riscv_legitimize_poly_move): Ditto.
(riscv_legitimize_move): New function.
(riscv_hard_regno_mode_ok): Add VL/VTYPE register allocation and fix
vector RA.
(riscv_convert_vector_bits): Fix riscv_vector_chunks configuration for
-marh no 'v'.
(riscv_reinit): New function.
(TARGET_RUN_TARGET_SELFTESTS): New target hook support.
* config/riscv/t-riscv: Add riscv-selftests.o.
* config/riscv/riscv-selftests.cc: New file.

gcc/testsuite/ChangeLog:

* selftests/riscv/empty-func.rtl: New test.

21 months agolibstdc++: Micro-optimizaion for std::bitset stream extraction
Jonathan Wakely [Fri, 23 Sep 2022 12:39:31 +0000 (13:39 +0100)]
libstdc++: Micro-optimizaion for std::bitset stream extraction

Don't bother trying to copy any characters for bitset<0>.

libstdc++-v3/ChangeLog:

* include/std/bitset (operator>>): Do not copy for N==0.
* testsuite/20_util/bitset/io/input.cc: Add comment.

21 months agotree-optimization/106922 - extend same-val clobber FRE
Richard Biener [Fri, 23 Sep 2022 12:28:52 +0000 (14:28 +0200)]
tree-optimization/106922 - extend same-val clobber FRE

The following extends the skipping of same valued stores to
handle an arbitrary number of them as long as they are from the
same value (which we now record).  That's an obvious extension
which allows to optimize the m_engaged member of std::optional
more reliably.

PR tree-optimization/106922
* tree-ssa-sccvn.cc (vn_reference_lookup_3): Allow
an arbitrary number of same valued skipped stores.

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

21 months agofrange: Make the setter taking trees a wrapper.
Aldy Hernandez [Fri, 23 Sep 2022 11:05:26 +0000 (13:05 +0200)]
frange: Make the setter taking trees a wrapper.

The frange setter does all its work in trees.  This incurs a penalty
for the real_value variants because they must wrap their arguments
into a tree and pass it to the tree setter, which will then do the
opposite.  This is leftovers from the irange setter.

Even though the we still need constructors taking trees so we can
interact with the tree world, there's no sense penalizing the rest of
the implementation.

Tested on x86-64 Linux.

gcc/ChangeLog:

* value-range.cc (frange::set): Swap setters such that the one
accepting REAL_VALUE_TYPE does all the work.

21 months agolibstdc++: Enable constexpr std::bitset for debug mode
Jonathan Wakely [Fri, 23 Sep 2022 09:12:09 +0000 (10:12 +0100)]
libstdc++: Enable constexpr std::bitset for debug mode

We already disable all debug mode checks for C++11 and later, so we can
easily make everything constexpr. This fixes the FAIL results for the
new tests when using -D_GLIBCXX_DEBUG.

Also fix some other tests failing with non-default test flags.

libstdc++-v3/ChangeLog:

* include/debug/bitset (__debug::bitset): Add constexpr to all
member functions.
(operator&, operator|, operator^): Add inline and constexpr.
(operator>>, operator<<): Add inline.
* testsuite/20_util/bitset/access/constexpr.cc: Only check using
constexpr std::string for the cxx11 ABI.
* testsuite/20_util/bitset/cons/constexpr_c++23.cc: Likewise.
* testsuite/20_util/headers/bitset/synopsis.cc: Check constexpr
for C++23.

21 months agolibstdc++: Optimize std::bitset<N>::to_string
Jonathan Wakely [Thu, 22 Sep 2022 17:36:04 +0000 (18:36 +0100)]
libstdc++: Optimize std::bitset<N>::to_string

This makes to_string approximately twice as fast at any optimization
level. Instead of iterating through every bit, jump straight to the next
bit that is set, by using _Find_first and _Find_next.

libstdc++-v3/ChangeLog:

* include/std/bitset (bitset::_M_copy_to_string): Find set bits
instead of iterating over individual bits.

21 months agoaarch64: Add Arm Neoverse V2 support
Kyrylo Tkachov [Fri, 23 Sep 2022 11:12:29 +0000 (12:12 +0100)]
aarch64: Add Arm Neoverse V2 support

This patch adds -mcpu/-mtune support for the Arm Neoverse V2 core.
This updates the internal references to "demeter", but leaves "demeter" as an
accepted value to -mcpu/-mtune as it appears in the released GCC 12 series.

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

gcc/ChangeLog:

* config/aarch64/aarch64-cores.def (neoverse-v2): New entry.
(demeter): Update tunings to neoversev2.
* config/aarch64/aarch64-tune.md: Regenerate.
* config/aarch64/aarch64.cc (demeter_addrcost_table): Rename to
neoversev2_addrcost_table.
(demeter_regmove_cost): Rename to neoversev2_addrcost_table.
(demeter_advsimd_vector_cost): Rename to neoversev2_advsimd_vector_cost.
(demeter_sve_vector_cost): Rename to neoversev2_sve_vector_cost.
(demeter_scalar_issue_info): Rename to neoversev2_scalar_issue_info.
(demeter_advsimd_issue_info): Rename to neoversev2_advsimd_issue_info.
(demeter_sve_issue_info): Rename to neoversev2_sve_issue_info.
(demeter_vec_issue_info): Rename to neoversev2_vec_issue_info.
Update references to above.
(demeter_vector_cost): Rename to neoversev2_vector_cost.
(demeter_tunings): Rename to neoversev2_tunings.
(aarch64_vec_op_count::rename_cycles_per_iter): Use
neoversev2_sve_issue_info instead of demeter_sve_issue_info.
* doc/invoke.texi (AArch64 Options): Document neoverse-v2.

21 months agoMAINTAINERS: Add myself to Write After Approval
Paul-Antoine Arras [Fri, 23 Sep 2022 10:21:48 +0000 (10:21 +0000)]
MAINTAINERS: Add myself to Write After Approval

ChangeLog:

* MAINTAINERS (Write After Approval): Add myself.

21 months agotestsuite: make check-functions-body dump expected and seen cases on failure.
Tamar Christina [Fri, 23 Sep 2022 09:56:30 +0000 (10:56 +0100)]
testsuite: make check-functions-body dump expected and seen cases on failure.

Often times when a check_function_body check fails it can be quite hard to
figure out why as no additional information is provided.

This changes it so that on failures it prints out the regex expression it's
using and the text it's comparing against to the verbose log.

This makes it much easier to figure out why a test has failed.

gcc/testsuite/ChangeLog:

* lib/scanasm.exp (check_function_body): Add debug output to verbose log
on failure.

21 months agofrange: drop endpoints to min/max representable numbers for -ffinite-math-only.
Aldy Hernandez [Thu, 22 Sep 2022 16:20:39 +0000 (18:20 +0200)]
frange: drop endpoints to min/max representable numbers for -ffinite-math-only.

Similarly to how we drop NANs to UNDEFINED when -ffinite-math-only, I
think we can drop the numbers outside of the min/max representable
numbers to the representable number.

This means the endpoings to VR_VARYING for -ffinite-math-only can now
be the min/max representable, instead of -INF and +INF.

Saturating in the setter means that the upcoming implementation for
binary operators no longer have to worry about doing the right
thing for -ffinite-math-only.  If the range goes outside the limits,
it'll get chopped down.

Tested on x86-64 Linux.

gcc/ChangeLog:

* range-op-float.cc (build_le): Use vrp_val_*.
(build_lt): Same.
(build_ge): Same.
(build_gt): Same.
* value-range.cc (frange::set): Chop ranges outside of the
representable numbers for -ffinite-math-only.
(frange::normalize_kind): Use vrp_val*.
(frange::verify_range): Same.
(frange::set_nonnegative): Same.
(range_tests_floats): Remove tests that depend on -INF and +INF.
* value-range.h (real_max_representable): Add prototype.
(real_min_representable): Same.
(vrp_val_max): Set max representable number for
-ffinite-math-only.
(vrp_val_min): Same but for min.
(frange::set_varying): Use vrp_val*.

21 months agoAdd debug functions for REAL_VALUE_TYPE.
Aldy Hernandez [Thu, 22 Sep 2022 16:03:16 +0000 (18:03 +0200)]
Add debug functions for REAL_VALUE_TYPE.

We currently have no way of dumping REAL_VALUE_TYPEs when debugging.

Tested on a gdb session examining the real value 10.0:

(gdb) p min
$9 = {cl = 1, decimal = 0, sign = 0, signalling = 0, canonical = 0, uexp = 4, sig = {0, 0, 11529215046068469760}}
(gdb) p debug (min)
0x0.ap+4

gcc/ChangeLog:

* real.cc (debug): New.

21 months agofrange: dump hex values when dumping FP numbers.
Aldy Hernandez [Thu, 22 Sep 2022 16:07:03 +0000 (18:07 +0200)]
frange: dump hex values when dumping FP numbers.

It has been suggested that if we start bumping numbers by an ULP when
calculating open ranges (for example the numbers less than 3.0) that
dumping these will become increasingly harder to read, and instead we
should opt for the hex representation.  I still find the floating
point representation easier to read for most numbers, but perhaps we
could have both?

With this patch this is the representation for [15.0, 20.0]:

     [frange] float [1.5e+1 (0x0.fp+4), 2.0e+1 (0x0.ap+5)]

Would you find this useful, or should we stick to the hex
representation only?

Tested on x86-64 Linux.

gcc/ChangeLog:

* value-range-pretty-print.cc (vrange_printer::print_real_value): New.
(vrange_printer::visit): Call print_real_value.
* value-range-pretty-print.h: New print_real_value.

21 months agoopts: fix --help=common with '\t' description
Martin Liska [Thu, 22 Sep 2022 13:57:48 +0000 (15:57 +0200)]
opts: fix --help=common with '\t' description

Fixes -flto-compression option:

-  -flto-compression-level=<number> Use z Use zlib/zstd compression level <number> for IL.
+  -flto-compression-level=<0,19> Use zlib/zstd compression level <number> for IL.

gcc/ChangeLog:

* common.opt: Update -flto-compression-level documentation.
* opts.cc (print_filtered_help): Do not append range to an
  option that uses \t syntax.

21 months agotestsuite: Fix up pr106922.C test
Jakub Jelinek [Fri, 23 Sep 2022 07:46:59 +0000 (09:46 +0200)]
testsuite: Fix up pr106922.C test

On Thu, Sep 22, 2022 at 01:10:08PM +0200, Richard Biener via Gcc-patches wrote:
>       * g++.dg/tree-ssa/pr106922.C: Adjust.

> --- a/gcc/testsuite/g++.dg/tree-ssa/pr106922.C
> +++ b/gcc/testsuite/g++.dg/tree-ssa/pr106922.C
> @@ -87,5 +87,4 @@ void testfunctionfoo() {
>    }
>  }
>
> -// { dg-final { scan-tree-dump-times "Found fully redundant value" 4 "pre" { xfail { ! lp64 } } } }
> -// { dg-final { scan-tree-dump-not "m_initialized" "cddce3" { xfail { ! lp64 } } } }
> +// { dg-final { scan-tree-dump-not "m_initialized" "dce3" } }

I've noticed
+UNRESOLVED: g++.dg/tree-ssa/pr106922.C  -std=gnu++20  scan-tree-dump-not dce3 "m_initialized"
+UNRESOLVED: g++.dg/tree-ssa/pr106922.C  -std=gnu++2b  scan-tree-dump-not dce3 "m_initialized"
with this change, both on x86_64 and i686.
The dump is still cddce3, additionally as the last reference to the pre
dump is gone, not sure it is worth creating that dump.

With the following patch, there aren't FAILs nor UNRESOLVED tests with
GXX_TESTSUITE_STDS=98,11,14,17,20,2b make check-g++ RUNTESTFLAGS="--target_board=unix\{-m32,-m64\} dg.exp='pr106922.C'"

2022-09-23  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/106922
* g++.dg/tree-ssa/pr106922.C: Scan in cddce3 dump rather than
dce3.  Remove -fdump-tree-pre-details from dg-options.

21 months agoattribs: Improve diagnostics
Jakub Jelinek [Fri, 23 Sep 2022 07:10:16 +0000 (09:10 +0200)]
attribs: Improve diagnostics

When looking at the attribs code, I've noticed weird diagnostics
like
int a __attribute__((section ("foo", "bar")));
a.c:1:1: error: wrong number of arguments specified for ‘section’ attribute
    1 | int a __attribute__((section ("foo", "bar")));
      | ^~~
a.c:1:1: note: expected between 1 and 1, found 2
As roughly 50% of attributes that accept any arguments have
spec->min_length == spec->max_length, I think it is worth it to have
separate wording for such common case and just write simpler
a.c:1:1: note: expected 1, found 2

2022-09-23  Jakub Jelinek  <jakub@redhat.com>

* attribs.cc (decl_attributes): Improve diagnostics, instead of
saying expected between 1 and 1, found 2 just say expected 1, found 2.

21 months agoi386: Optimize code generation of __mm256_zextsi128_si256(__mm_set1_epi8(-1))
Hu, Lin1 [Tue, 13 Sep 2022 08:28:54 +0000 (16:28 +0800)]
i386: Optimize code generation of __mm256_zextsi128_si256(__mm_set1_epi8(-1))

gcc/ChangeLog:

PR target/94962
* config/i386/constraints.md (BH): New define_constraint.
* config/i386/i386.cc (standard_sse_constant_p): Add return
3/4 when operand matches new predicate.
(standard_sse_constant_opcode): Add new alternative branch to
return "vpcmpeqd".
* config/i386/predicates.md
(vector_all_ones_zero_extend_half_operand): New define_predicate.
(vector_all_ones_zero_extend_quarter_operand): Ditto.
* config/i386/sse.md: Add constraint to insn "mov<mode>_internal".

gcc/testsuite/ChangeLog:

PR target/94962
* gcc.target/i386/avx256-unaligned-load-1.c: Modify test.
* gcc.target/i386/avx256-unaligned-store-1.c: Ditto.
* gcc.target/i386/avx256-unaligned-store-2.c: Ditto.
* gcc.target/i386/avx256-unaligned-store-3.c: Ditto.
* gcc.target/i386/pr94962-1.c: New test.
* gcc.target/i386/pr94962-2.c: Ditto.
* gcc.target/i386/pr94962-3.c: Ditto.
* gcc.target/i386/pr94962-4.c: Ditto.

21 months agoc++: ICE-on-invalid with designated initializer [PR106983]
Marek Polacek [Tue, 20 Sep 2022 18:54:57 +0000 (14:54 -0400)]
c++: ICE-on-invalid with designated initializer [PR106983]

We ICE in the code added in r12-7117: type_build_dtor_call gets
the error_mark_node because the type of 'prev' wasn't declared.

PR c++/106983

gcc/cp/ChangeLog:

* typeck2.cc (split_nonconstant_init_1): Check TYPE_P.

gcc/testsuite/ChangeLog:

* g++.dg/other/error36.C: New test.

21 months agoDaily bump.
GCC Administrator [Fri, 23 Sep 2022 00:18:01 +0000 (00:18 +0000)]
Daily bump.

21 months agoAvoid depending on destructor order
Thomas Neumann [Mon, 19 Sep 2022 16:10:02 +0000 (18:10 +0200)]
Avoid depending on destructor order

In some scenarios (e.g., when mixing gcc and clang code), it can
happen that frames are deregistered after the lookup structure
has already been destroyed. That in itself would be fine, but
it triggers an assert in __deregister_frame_info_bases that
expects to find the frame.

To avoid that, we now remember that the btree as already been
destroyed and disable the assert in that case.

libgcc/ChangeLog:

* unwind-dw2-fde.c: (release_register_frames) Remember
when the btree has been destroyed.
(__deregister_frame_info_bases) Disable the assert when
shutting down.

21 months agoUpdate gcc fr.po
Joseph Myers [Thu, 22 Sep 2022 21:56:52 +0000 (21:56 +0000)]
Update gcc fr.po

* fr.po: Update.

21 months agoConvert CFN_BUILT_IN_PARITY to range-ops.
Andrew MacLeod [Tue, 20 Sep 2022 23:30:46 +0000 (19:30 -0400)]
Convert CFN_BUILT_IN_PARITY to range-ops.

Also, as the last builtin remaining, also remove the builtin infrastrucure
routines from fold_using_range.

* gimple-range-fold.cc (range_of_range_op): Handle no operands.
(range_of_call): Do not check for builtins.
(fold_using_range::range_of_builtin_call): Delete.
(fold_using_range::range_of_builtin_int_call): Delete.
* gimple-range-fold.h: Adjust prototypes.
* gimple-range-op.cc (class cfn_parity): New.
(gimple_range_op_handler::maybe_builtin_call): Set arguments.

21 months agoConvert CFN_BUILT_IN_GOACC_DIM_* to range-ops.
Andrew MacLeod [Tue, 20 Sep 2022 23:19:30 +0000 (19:19 -0400)]
Convert CFN_BUILT_IN_GOACC_DIM_* to range-ops.

* gimple-range-fold.cc (range_of_builtin_int_call): Remove case
for CFN_GOACC_DIM_*.
* gimple-range-op.cc (class cfn_goacc_dim): New.
(gimple_range_op_handler::maybe_builtin_call): Set arguments.

21 months agoConvert CFN_BUILT_IN_STRLEN to range-ops.
Andrew MacLeod [Tue, 20 Sep 2022 23:05:03 +0000 (19:05 -0400)]
Convert CFN_BUILT_IN_STRLEN to range-ops.

* gimple-range-fold.cc (range_of_builtin_int_call): Remove case
for CFN_BUILT_IN_STRLEN.
* gimple-range-op.cc (class cfn_strlen): New.
(gimple_range_op_handler::maybe_builtin_call): Set arguments.

21 months agoConvert CFN_BUILT_IN_UBSAN_CHECK_* to range-ops.
Andrew MacLeod [Tue, 20 Sep 2022 22:48:05 +0000 (18:48 -0400)]
Convert CFN_BUILT_IN_UBSAN_CHECK_* to range-ops.

* gimple-range-fold.cc (range_of_builtin_ubsan_call): Delete.
(range_of_builtin_int_call): Remove cases for
CFN_BUILT_IN_UBSAN_CHECK.
* gimple-range-op.cc (class cfn_ubsan): New.
(gimple_range_op_handler::maybe_builtin_call): Set arguments.

21 months agoConvert CFN_BUILT_IN_CLRSB to range-ops.
Andrew MacLeod [Tue, 20 Sep 2022 22:21:04 +0000 (18:21 -0400)]
Convert CFN_BUILT_IN_CLRSB to range-ops.

* gimple-range-fold.cc (range_of_builtin_int_call): Remove case
for CFN_BUILT_IN_CLRSB.
* gimple-range-op.cc (class cfn_clrsb): New.
(gimple_range_op_handler::maybe_builtin_call): Set arguments.

21 months agoConvert CFN_CTZ builtins to range-ops.
Andrew MacLeod [Tue, 20 Sep 2022 22:19:30 +0000 (18:19 -0400)]
Convert CFN_CTZ builtins to range-ops.

* gimple-range-fold.cc (range_of_builtin_int_call): Remove case
for CFN_CTZ.
* gimple-range-op.cc (class cfn_ctz): New.
(gimple_range_op_handler::maybe_builtin_call): Set arguments.

21 months agoConvert CFN_CLZ builtins to range-ops.
Andrew MacLeod [Tue, 20 Sep 2022 22:12:25 +0000 (18:12 -0400)]
Convert CFN_CLZ builtins to range-ops.

* gimple-range-fold.cc (range_of_builtin_int_call): Remove case
for CFN_CLZ.
* gimple-range-op.cc (class cfn_clz): New.
(gimple_range_op_handler::maybe_builtin_call): Set arguments.

21 months agoConvert CFN_BUILT_FFS and CFN_POPCOUNT to range-ops.
Andrew MacLeod [Tue, 20 Sep 2022 22:07:14 +0000 (18:07 -0400)]
Convert CFN_BUILT_FFS and CFN_POPCOUNT to range-ops.

* gimple-range-fold.cc (range_of_builtin_int_call): Remove case
for CFN_FFS and CFN_POPCOUNT.
* gimple-range-op.cc (class cfn_pocount): New.
(gimple_range_op_handler::maybe_builtin_call): Set arguments.

21 months agoConvert CFN_BUILT_IN_TOUPPER and TOLOWER to range-ops.
Andrew MacLeod [Tue, 20 Sep 2022 21:14:30 +0000 (17:14 -0400)]
Convert CFN_BUILT_IN_TOUPPER and TOLOWER to range-ops.

* gimple-range-fold.cc (get_letter_range): Move to new class.
(range_of_builtin_int_call): Remove case for CFN_BUILT_IN_TOUPPER
and CFN_BUILT_IN_TOLOWER.
* gimple-range-op.cc (class cfn_toupper_tolower): New.
(gimple_range_op_handler::maybe_builtin_call): Set arguments.

21 months agoConvert CFN_BUILT_IN_SIGNBIT to range-ops.
Andrew MacLeod [Wed, 21 Sep 2022 13:29:40 +0000 (09:29 -0400)]
Convert CFN_BUILT_IN_SIGNBIT to range-ops.

* gimple-range-fold.cc (range_of_builtin_int_call): Remove case
for CFN_BUILT_IN_SIGNBIT.
* gimple-range-op.cc (class cfn_signbit): New.
(gimple_range_op_handler::maybe_builtin_call): Set arguments.

21 months agoAdd range-ops support for builtin functions.
Andrew MacLeod [Tue, 20 Sep 2022 20:53:37 +0000 (16:53 -0400)]
Add range-ops support for builtin functions.

Convert CFN_BUILT_IN_CONSTANT_P as first POC.

* gimple-range-fold.cc
(fold_using_range::range_of_builtin_int_call): Remove case for
CFN_BUILT_IN_CONSTANT_P.
* gimple-range-op.cc (gimple_range_op_handler::supported_p):
Check if a call also creates a range-op object.
(gimple_range_op_handler): Also check builtin calls.
(class cfn_constant_float_p): New.  Float CFN_BUILT_IN_CONSTANT_P.
(class cfn_constant_p): New.  Integral CFN_BUILT_IN_CONSTANT_P.
(gimple_range_op_handler::maybe_builtin_call): Set arguments and
handler for supported built-in calls.
* gimple-range-op.h (maybe_builtin_call): New prototype.

21 months agoAlways check the return value of fold_range.
Andrew MacLeod [Wed, 21 Sep 2022 20:15:02 +0000 (16:15 -0400)]
Always check the return value of fold_range.

The fold_range routine in range-ops returns FALSE if the operation
fails.  There are a few places which assume the operation was
successful.  Fix those.

* gimple-range-fold.cc (range_of_range_op): Set result to
VARYING if the call to fold_range fails.
* tree-data-ref.cc (compute_distributive_range): Ditto.
* tree-vrp.cc (range_fold_binary_expr): Ditto.
(range_fold_unary_expr): Ditto.
* value-query.cc (range_query::get_tree_range): Ditto.

21 months agoAdd missing float fold_range prototype for floats.
Andrew MacLeod [Tue, 20 Sep 2022 16:34:08 +0000 (12:34 -0400)]
Add missing float fold_range prototype for floats.

Unary operations require op2 to be the range of the type of the LHS.
This is so the type for the LHS can be properly set.

* range-op-float.cc (range_operator_float::fold_range): New base
  method for "int = float op int".
* range-op.cc (range_op_handler::fold_range): New case.
* range-op.h: Update prototypes.

21 months agoFix calc_op1 for undefined op2_range.
Andrew MacLeod [Thu, 22 Sep 2022 14:27:17 +0000 (10:27 -0400)]
Fix calc_op1 for undefined op2_range.

Unary operations pass the type of operand 1 into op1_range.  If that
range is undefined, the routine blindly picks the type of operand 2,
which in the case of a unary op, does not exist and traps.

* gimple-range-op.cc (gimple_range_op_handler::calc_op1): Use
  operand 1 for second range if there is no operand 2.

21 months agoCreate gimple_range_op_handler in a new source file.
Andrew MacLeod [Thu, 1 Sep 2022 14:34:55 +0000 (10:34 -0400)]
Create gimple_range_op_handler in a new source file.

Range-ops is meant to be IL independent.  Some gimple processing has
be placed in range-ops, and some is located in gori.  Split it all into
a file and isolate it in a new class gimple_range_op_handler.

* Makefile.in (OBJS): Add gimple-range-op.o.
* gimple-range-edge.cc (gimple_outgoing_range_stmt_p): Use
gimple_range_op_handler.
* gimple-range-fold.cc (gimple_range_base_of_assignment): Move
to a method in gimple_range_op_handler.
(gimple_range_operand1): Ditto.
(gimple_range_operand2): Ditto.
(fold_using_range::fold_stmt): Use gimple_range_op_handler.
(fold_using_range::range_of_range_op): Ditto.
(fold_using_range::relation_fold_and_or): Ditto.
(fur_source::register_outgoing_edges): Ditto.
(gimple_range_ssa_names): Relocate to gimple-range-op.cc.
* gimple-range-fold.h: Adjust prototypes.
* gimple-range-gori.cc (gimple_range_calc_op1): Move
to a method in gimple_range_op_handler.
(gimple_range_calc_op2): Ditto.
(gori_compute::compute_operand_range): Use
gimple_range_op_handler.
(gori_compute::compute_logical_operands): Ditto.
(compute_operand1_range): Ditto.
(gori_compute::compute_operand2_range): Ditto.
(gori_compute::compute_operand1_and_operand2_range): Ditto.
* gimple-range-gori.h: Adjust protoypes.
* gimple-range-op.cc: New.  Supply gimple_range_op_handler methods.
* gimple-range-op.h: New.  Supply gimple_range_op_handler class.
* gimple-range.cc (gimple_ranger::prefill_name): Use
gimple_range_op_handler.
(gimple_ranger::prefill_stmt_dependencies): Ditto.
* gimple-range.h: Include gimple-range-op.h.
* range-op.cc (range_op_handler::range_op_handler): Adjust and
remove gimple * parameter option.
* range-op.h: Adjust prototypes.

21 months agoAdjust range_op_handler to store the handler directly.
Andrew MacLeod [Wed, 31 Aug 2022 18:07:13 +0000 (14:07 -0400)]
Adjust range_op_handler to store the handler directly.

Range_op_handler currently stores a tree code and a type.  It defers
checking to see if there is a valid handler until asked.
This change checks at constuctor time and store a pointer to
the handler if there is one.

* range-op.cc (range_op_handler::set_op_handler): Set new fields.
(ange_op_handler::range_op_handler): Likewise.
(range_op_handler::operator bool): Remove.
(range_op_handler::fold_range): Use appropriate handler.
(range_op_handler::op1_range): Likewise.
(range_op_handler::op2_range): Likewise.
(range_op_handler::lhs_op1_relation): Likewise.
(range_op_handler::lhs_op2_relation): Likewise.
(range_op_handler::op1_op2_relation): Likewise.
* range-op.h (class range_op_handler): Store handler pointers.
(range_op_handler:: operator bool): Inline.

21 months agoReplace another snippet with a call to gimple_range_ssa_names.
Andrew MacLeod [Wed, 31 Aug 2022 21:28:09 +0000 (17:28 -0400)]
Replace another snippet with a call to gimple_range_ssa_names.

When the original patch was applied, I missed a spot which could
also be rewritten to use gimple_range_ssa_names.

* tree-ssa-threadbackward.cc
  (back_threader::find_paths_to_names): Replace sequence with
  a call to gimple_range_ssa_names.

21 months agoFortran: Fix automatic reallocation inside select rank [PR100103]
José Rui Faustino de Sousa [Wed, 21 Sep 2022 20:55:02 +0000 (22:55 +0200)]
Fortran: Fix automatic reallocation inside select rank [PR100103]

gcc/fortran/ChangeLog:

PR fortran/100103
* trans-array.cc (gfc_is_reallocatable_lhs): Add select rank
temporary associate names as possible targets of automatic
reallocation.

gcc/testsuite/ChangeLog:

PR fortran/100103
* gfortran.dg/PR100103.f90: New test.

21 months agoFortran: fix ICE in generate_coarray_sym_init [PR82868]
Harald Anlauf [Wed, 21 Sep 2022 17:55:30 +0000 (19:55 +0200)]
Fortran: fix ICE in generate_coarray_sym_init [PR82868]

gcc/fortran/ChangeLog:

PR fortran/82868
* trans-decl.cc (generate_coarray_sym_init): Skip symbol
if attr.associate_var.

gcc/testsuite/ChangeLog:

PR fortran/82868
* gfortran.dg/associate_26a.f90: New test.

21 months agolibiberty: Refer to Bugzilla in README
Jonathan Wakely [Thu, 22 Sep 2022 08:33:30 +0000 (09:33 +0100)]
libiberty: Refer to Bugzilla in README

We want bugs reported to Bugzilla, not emailed to gcc-bugs.

libiberty/ChangeLog:

* README: Replace gcc-bugs email address with Bugzilla URL.

21 months agolibstdc++: Implement constexpr std::bitset for C++23 (P2417R2)
Jonathan Wakely [Thu, 22 Sep 2022 14:00:08 +0000 (15:00 +0100)]
libstdc++: Implement constexpr std::bitset for C++23 (P2417R2)

Also add _GLIBCXX_HOSTED checks to simplify making <bitset>
freestanding in the near future.

libstdc++-v3/ChangeLog:

* include/std/bitset (bitset): Add constexpr for C++23. Guard
members using std::string with _GLIBCXX_HOSTED.
* include/std/version (__cpp_lib_constexpr_bitset): Define.
* testsuite/20_util/bitset/access/constexpr.cc: New test.
* testsuite/20_util/bitset/cons/constexpr_c++23.cc: New test.
* testsuite/20_util/bitset/count/constexpr.cc: New test.
* testsuite/20_util/bitset/ext/constexpr.cc: New test.
* testsuite/20_util/bitset/operations/constexpr_c++23.cc: New test.
* testsuite/20_util/bitset/version.cc: New test.

22 months agolibstdc++: Rearrange tests for <bitset>
Jonathan Wakely [Thu, 22 Sep 2022 13:37:58 +0000 (14:37 +0100)]
libstdc++: Rearrange tests for <bitset>

In C++03 std::bitset was in the Container clause, but since C++11 it has
been in the Utilties clause. This moves the tests to the 20_util
directory, where most people probably expect to find them.

Also create 'access', 'observers', and 'io' subdirectories and group
some tests under there, rather than having one directory per function
name, and only a single test in that directory.

libstdc++-v3/ChangeLog:

* testsuite/23_containers/bitset/18604.cc: Moved to...
* testsuite/20_util/bitset/18604.cc: ...here.
* testsuite/23_containers/bitset/45713.cc: Moved to...
* testsuite/20_util/bitset/45713.cc: ...here.
* testsuite/23_containers/bitset/to_string/dr396.cc: Moved to...
* testsuite/20_util/bitset/access/dr396.cc: ...here.
* testsuite/23_containers/bitset/to_string/1.cc: Moved to...
* testsuite/20_util/bitset/access/to_string.cc: ...here.
* testsuite/23_containers/bitset/to_ullong/1.cc: Moved to...
* testsuite/20_util/bitset/access/to_ullong.cc: ...here.
* testsuite/23_containers/bitset/to_ulong/1.cc: Moved to...
* testsuite/20_util/bitset/access/to_ulong.cc: ...here.
* testsuite/23_containers/bitset/cons/1.cc: Moved to...
* testsuite/20_util/bitset/cons/1.cc: ...here.
* testsuite/23_containers/bitset/cons/16020.cc: Moved to...
* testsuite/20_util/bitset/cons/16020.cc: ...here.
* testsuite/23_containers/bitset/cons/2.cc: Moved to...
* testsuite/20_util/bitset/cons/2.cc: ...here.
* testsuite/23_containers/bitset/cons/3.cc: Moved to...
* testsuite/20_util/bitset/cons/3.cc: ...here.
* testsuite/23_containers/bitset/cons/38244.cc: Moved to...
* testsuite/20_util/bitset/cons/38244.cc: ...here.
* testsuite/23_containers/bitset/cons/50268.cc: Moved to...
* testsuite/20_util/bitset/cons/50268.cc: ...here.
* testsuite/23_containers/bitset/cons/6282.cc: Moved to...
* testsuite/20_util/bitset/cons/6282.cc: ...here.
* testsuite/23_containers/bitset/cons/constexpr.cc: Moved to...
* testsuite/20_util/bitset/cons/constexpr.cc: ...here.
* testsuite/23_containers/bitset/cons/dr1325-1.cc: Moved to...
* testsuite/20_util/bitset/cons/dr1325-1.cc: ...here.
* testsuite/23_containers/bitset/cons/dr1325-2.cc: Moved to...
* testsuite/20_util/bitset/cons/dr1325-2.cc: ...here.
* testsuite/23_containers/bitset/cons/dr396.cc: Moved to...
* testsuite/20_util/bitset/cons/dr396.cc: ...here.
* testsuite/23_containers/bitset/debug/invalidation/1.cc: Moved to...
* testsuite/20_util/bitset/debug/invalidation/1.cc: ...here.
* testsuite/23_containers/bitset/ext/15361.cc: Moved to...
* testsuite/20_util/bitset/ext/15361.cc: ...here.
* testsuite/23_containers/bitset/hash/1.cc: Moved to...
* testsuite/20_util/bitset/hash/1.cc: ...here.
* testsuite/23_containers/bitset/input/1.cc: Moved to...
* testsuite/20_util/bitset/io/input.cc: ...here.
* testsuite/23_containers/bitset/count/6124.cc: Moved to...
* testsuite/20_util/bitset/observers/6124.cc: ...here.
* testsuite/23_containers/bitset/all/1.cc: Moved to...
* testsuite/20_util/bitset/observers/all.cc: ...here.
* testsuite/23_containers/bitset/test/1.cc: Moved to...
* testsuite/20_util/bitset/observers/test.cc: ...here.
* testsuite/23_containers/bitset/operations/1.cc: Moved to...
* testsuite/20_util/bitset/operations/1.cc: ...here.
* testsuite/23_containers/bitset/operations/13838.cc: Moved to...
* testsuite/20_util/bitset/operations/13838.cc: ...here.
* testsuite/23_containers/bitset/operations/2.cc: Moved to...
* testsuite/20_util/bitset/operations/2.cc: ...here.
* testsuite/23_containers/bitset/operations/96303.cc: Moved to...
* testsuite/20_util/bitset/operations/96303.cc: ...here.
* testsuite/23_containers/bitset/operations/constexpr-2.cc: Moved to...
* testsuite/20_util/bitset/operations/constexpr-2.cc: ...here.
* testsuite/23_containers/bitset/operations/constexpr.cc: Moved to...
* testsuite/20_util/bitset/operations/constexpr.cc: ...here.
* testsuite/23_containers/bitset/requirements/constexpr_functions.cc: Moved to...
* testsuite/20_util/bitset/requirements/constexpr_functions.cc: ...here.
* testsuite/23_containers/bitset/requirements/explicit_instantiation/1.cc: Moved to...
* testsuite/20_util/bitset/requirements/explicit_instantiation/1.cc: ...here.
* testsuite/23_containers/bitset/requirements/explicit_instantiation/1_c++0x.cc: Moved to...
* testsuite/20_util/bitset/requirements/explicit_instantiation/1_c++0x.cc: ...here.
* testsuite/23_containers/headers/bitset/synopsis.cc: Moved to...
* testsuite/20_util/headers/bitset/synopsis.cc: ...here.

22 months agocmd/cgo: add and use runtime/cgo.Incomplete instead of //go:notinheap
Ian Lance Taylor [Wed, 21 Sep 2022 23:26:08 +0000 (16:26 -0700)]
cmd/cgo: add and use runtime/cgo.Incomplete instead of //go:notinheap

This ports https://go.dev/cl/421879 to libgo. This is a quick port to
update gofrontend to work with the version of cgo in gc mainline.
A more complete port will follow, changing the gc version of cmd/cgo to
choose an approach based on feature testing the gccgo in use.

Updates golang/go#46731

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/432338

22 months agotree-optimization/102801 - testcase for uninit diagnostic
Richard Biener [Thu, 22 Sep 2022 13:18:47 +0000 (15:18 +0200)]
tree-optimization/102801 - testcase for uninit diagnostic

The following testcase is fixed in GCC 12+

PR tree-optimization/102801
gcc/testsuite/
* g++.dg/warn/Wuninitialized-33.C: New testcase.

22 months agoc++ modules: partial variable template specializations [PR106826]
Patrick Palka [Thu, 22 Sep 2022 12:46:23 +0000 (08:46 -0400)]
c++ modules: partial variable template specializations [PR106826]

With partial variable template specializations, it looks like we
stream the VAR_DECL (i.e. the DECL_TEMPLATE_RESULT of the corresponding
TEMPLATE_DECL) since process_partial_specialization adds it to the
specializations table, but we end up never streaming the corresponding
TEMPLATE_DECL itself that's reachable only from the primary template's
DECL_TEMPLATE_SPECIALIZATIONS list, which leads to this list being
incomplete on stream-in.

The modules machinery already has special logic for streaming partial
specializations of class templates; this patch attempts to generalize
it to handle those of variable templates as well.

PR c++/106826

gcc/cp/ChangeLog:

* module.cc (trees_out::decl_value): Use get_template_info in
the MK_partial case to handle both VAR_DECL and TYPE_DECL.
(trees_out::key_mergeable): Likewise.
(trees_in::key_mergeable): Likewise.
(has_definition): Consider DECL_INITIAL of a partial variable
template specialization.
(depset::hash::make_dependency): Handle partial variable template
specializations too.

gcc/testsuite/ChangeLog:

* g++.dg/modules/partial-2_a.C: New test.
* g++.dg/modules/partial-2_b.C: New test.

22 months agoremove -gz=zlib-gnu option value
Martin Liska [Thu, 22 Sep 2022 11:04:57 +0000 (13:04 +0200)]
remove -gz=zlib-gnu option value

The option value is legacy and probably not used at all,
thus ignore it.

gcc/ChangeLog:

* configure: Regenerate.
* configure.ac: Simplify to gcc_cv_ld_compress_debug={0,1}
and gcc_cv_as_compress_debug={0,1}.
* doc/invoke.texi: Document the removal.
* gcc.cc (LINK_COMPRESS_DEBUG_SPEC): Simplify and ignore
  zlib-gnu.
(ASM_COMPRESS_DEBUG_SPEC): Likewise.

Co-Authored-By: Fangrui Song <i@maskray.me>
22 months agoc: fix uninitialized c_expr::m_decimal [PR106830]
David Malcolm [Thu, 22 Sep 2022 12:35:26 +0000 (08:35 -0400)]
c: fix uninitialized c_expr::m_decimal [PR106830]

I added c_expr::m_decimal in r13-2386-gbedfca647a9e9c1a as part of the
implementation of -Wxor-used-as-pow, but I missed various places where
the field needed to be initialized.

Fixed thusly.

gcc/c-family/ChangeLog:
PR c/106830
* c-warn.cc (check_for_xor_used_as_pow): Don't try checking
values that don't fit in uhwi.

gcc/c/ChangeLog:
PR c/106830
* c-parser.cc (c_parser_initelt): Initialize m_decimal.
(c_parser_cast_expression): Likewise.
(c_parser_alignof_expression): Likewise.
(c_parser_postfix_expression_after_paren_type): Likewise.
(c_parser_postfix_expression_after_primary): Likewise.
(c_parser_expression): Likewise.
(c_parser_omp_variable_list): Likewise.
(c_parser_transaction_expression): Likewise.
* c-tree.h (c_expr::set_error): Likewise.
* c-typeck.cc (c_expr_sizeof_expr): Likewise.
(parser_build_unary_op): Likewise.
(parser_build_binary_op): Likewise.
(digest_init): Likewise.
(pop_init_level): Likewise.
* gimple-parser.cc (c_parser_gimple_call_internal): Likewise.

gcc/testsuite/ChangeLog:
PR c/106830
* gcc.dg/Wxor-used-as-pow-pr106830.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
22 months agotree-optimization/106922 - missed FRE/PRE
Richard Biener [Wed, 21 Sep 2022 11:52:56 +0000 (13:52 +0200)]
tree-optimization/106922 - missed FRE/PRE

The following enhances the store-with-same-value trick in
vn_reference_lookup_3 by not only looking for

  a = val;
  *ptr = val;
  .. = a;

but also

  *ptr = val;
  other = x;
  .. = a;

where the earlier store is more than one hop away.  It does this
by queueing the actual value to compare until after the walk but
as disadvantage only allows a single such skipped store from a
constant value.

Unfortunately we cannot handle defs from non-constants this way
since we're prone to pick up values from the past loop iteration
this way and we have no good way to identify values that are
invariant in the currently iterated cycle.  That's why we keep
the single-hop lookup for those cases.  gcc.dg/tree-ssa/pr87126.c
would be a testcase that's un-XFAILed when we'd handle those
as well.

PR tree-optimization/106922
* tree-ssa-sccvn.cc (vn_walk_cb_data::same_val): New member.
(vn_walk_cb_data::finish): Perform delayed verification of
a skipped may-alias.
(vn_reference_lookup_pieces): Likewise.
(vn_reference_lookup): Likewise.
(vn_reference_lookup_3): When skipping stores of the same
value also handle constant stores that are more than a
single VDEF away by delaying the verification.

* gcc.dg/tree-ssa/ssa-fre-100.c: New testcase.
* g++.dg/tree-ssa/pr106922.C: Adjust.

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