]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
23 months agoUpdate ChangeLog and version files for release releases/gcc-12.1.0
Jakub Jelinek [Fri, 6 May 2022 07:07:53 +0000 (07:07 +0000)] 
Update ChangeLog and version files for release

23 months agoUpdate gennews for GCC 12.
Jakub Jelinek [Fri, 6 May 2022 06:44:43 +0000 (08:44 +0200)] 
Update gennews for GCC 12.

2022-05-06  Jakub Jelinek  <jakub@redhat.com>

* gennews (files): Add files for GCC 12.

(cherry picked from commit 8025f29fbd8f87e27354b69d0bc9eb8d1aeae94c)

23 months agoDaily bump.
GCC Administrator [Fri, 6 May 2022 00:19:11 +0000 (00:19 +0000)] 
Daily bump.

23 months agod: Merge upstream dmd 88de5e369.
Iain Buclaw [Thu, 5 May 2022 19:00:36 +0000 (21:00 +0200)] 
d: Merge upstream dmd 88de5e369.

D front-end changes:

    - Merge regression fixes in v2.100.0 branch.

gcc/d/ChangeLog:

* dmd/MERGE: Merge upstream dmd 88de5e369.

23 months agoRegenerate gcc.pot
Joseph Myers [Thu, 5 May 2022 17:03:54 +0000 (17:03 +0000)] 
Regenerate gcc.pot

* gcc.pot: Regenerate.

23 months agoDaily bump.
GCC Administrator [Thu, 5 May 2022 00:18:48 +0000 (00:18 +0000)] 
Daily bump.

23 months agoUpdate cpplib es.po
Joseph Myers [Wed, 4 May 2022 16:34:26 +0000 (16:34 +0000)] 
Update cpplib es.po

* es.po: Update.

23 months agoDaily bump.
GCC Administrator [Wed, 4 May 2022 00:19:12 +0000 (00:19 +0000)] 
Daily bump.

23 months agoUpdate gcc sv.po
Joseph Myers [Tue, 3 May 2022 22:17:18 +0000 (22:17 +0000)] 
Update gcc sv.po

* sv.po: Update.

23 months agod: Merge upstream dmd 081d61e15, druntime 9c0d4f91, phobos dba1bbe27.
Iain Buclaw [Tue, 3 May 2022 15:53:08 +0000 (17:53 +0200)] 
d: Merge upstream dmd 081d61e15, druntime 9c0d4f91, phobos dba1bbe27.

D front-end changes:

    - Import dmd v2.100.0-rc.1.

D runtime changes:

    - Import druntime v2.100.0-rc.1.

Phobos changes:

    - Import v2.100.0-rc.1.

gcc/d/ChangeLog:

* dmd/MERGE: Merge upstream dmd 081d61e15.
* dmd/VERSION: Update version to v2.100.0-rc.1.

libphobos/ChangeLog:

* libdruntime/MERGE: Merge upstream druntime 9c0d4f91.
* src/MERGE: Merge upstream phobos dba1bbe27.

23 months agotestsuite: vect: update unaligned message
Alexandre Oliva [Tue, 3 May 2022 07:23:54 +0000 (04:23 -0300)] 
testsuite: vect: update unaligned message

gcc.dg/vect/costmodel/ppc/costmodel-vect-31a.c covers ppc variants
that accept and reject misaligned accesses.  The message that it
expects for rejection was removed in the gcc-11 development cycle by
commit r11-1969.  The patch adjusted multiple tests to use the message
introduced in r11-1945, but missed this one.

for  gcc/testsuite/ChangeLog

* gcc.dg/vect/costmodel/ppc/costmodel-vect-31a.c: Update
the expected message for the case in which unaligned accesses
are not allowed.

(cherry picked from commit 404edfce683cb1801b052ee7c8d45d603c392e08)

23 months agoDaily bump.
GCC Administrator [Tue, 3 May 2022 00:18:44 +0000 (00:18 +0000)] 
Daily bump.

23 months agolibstdc++: case-sensitivity in hexfloat std::from_chars [PR105441]
Patrick Palka [Mon, 2 May 2022 11:00:48 +0000 (07:00 -0400)] 
libstdc++: case-sensitivity in hexfloat std::from_chars [PR105441]

The hexfloat parser for binary32/64 added in r12-6645-gcc3bf3404e4b1c
overlooked that the exponent part can also begin with an uppercase 'P'.

PR libstdc++/105441

libstdc++-v3/ChangeLog:

* src/c++17/floating_from_chars.cc (__floating_from_chars_hex):
Also accept 'P' as the start of the exponent.
* testsuite/20_util/from_chars/7.cc: Add corresponding testcase.

(cherry picked from commit 576f975cabb0fd9843de152a2d247d486a967b08)

23 months agoFix exchanged period and letter in gfortan.texi.
Thomas Koenig [Fri, 29 Apr 2022 17:57:05 +0000 (19:57 +0200)] 
Fix exchanged period and letter in gfortan.texi.

gcc/fortran/ChangeLog:

* gfortran.texi: Fix exchanged period and letter.

(cherry picked from commit 4a8b45e8bc8246bd141dad65f571a3e0cc499c6b)

23 months agosystem.h: Include <initializer_list> in system.h unconditionally
Jakub Jelinek [Mon, 2 May 2022 05:10:14 +0000 (07:10 +0200)] 
system.h: Include <initializer_list> in system.h unconditionally

On Sun, May 01, 2022 at 07:06:53PM +0100, Jonathan Wakely wrote:
> > >> the reason is that "gcc/analyzer/region-model.cc” uses initializer_lists, and it seems that <initializer_list>
> > >> is not transitively included by any used headers for _LIBCPP_VERSION < 4000.  I fixed that locally by
> > >> adding initializer_list into system.h (and adding INCLUDE_INITIALIZER_LIST to the top of gcc/analyzer/region-model.cc)
> > >> - with that change those versions do bootstrap and test OK***
> > >
> > > From what I can see, with libstdc++ it works because <utility> which is
> > > included by system.h includes <initializer_list>.
> > > If I rename initializer_list in analyzer/region-model.ii to initializer_listx, I
> > > also get:
> > > ../../gcc/analyzer/region-model.cc: In function ‘void ana::selftest::test_binop_svalue_folding()’:
> > > ../../gcc/analyzer/region-model.cc:4966:48: error: deducing from brace-enclosed initializer list requires ‘#include <initializer_list>’
> > > 4508 |
> > >  +++ |+#include <initializer_list>
> > > 4509 | static void
> > > ......
> > > 4966 |     for (auto op : {BIT_IOR_EXPR, TRUTH_OR_EXPR})
> > >      |                                                ^
> > > ../../gcc/analyzer/region-model.cc:4978:49: error: deducing from brace-enclosed initializer list requires ‘#include <initializer_list>’
> > > 4978 |     for (auto op : {BIT_AND_EXPR, TRUTH_AND_EXPR})
> > >      |                                                 ^
> > >
> > > I think we have 2 options, one is do what you wrote above,
> > > INCLUDE_INITIALIZER_LIST defined before system.h to get #include <initializer_list>.
> > > The other option is just to include that unconditionally, it is a very small
> > > header.  For libstdc++ it will make no difference as it is included anyway
> > > and the header is really small there, libc++ includes <cstddef> which isn't
> > > normally included and system.h includes <stddef.h> instead.
> >
> > I’d say unconditionally would be OK. I suppose the chance that any host
> > C++ is good enough to build GCC as-is but fails to provide
> > <initializer_list> is zero?
> >
>
> Yes, definitely.
>
> > I’d be OK to do this change without a new RC even.

2022-05-02  Jakub Jelinek  <jakub@redhat.com>

* system.h: Include initializer_list.

(cherry picked from commit 4a0e89b10f6bdc1e285e0b9e6a435a0062f8936c)

23 months agoDaily bump.
GCC Administrator [Mon, 2 May 2022 00:18:59 +0000 (00:18 +0000)] 
Daily bump.

2 years agoDaily bump.
GCC Administrator [Sun, 1 May 2022 00:18:44 +0000 (00:18 +0000)] 
Daily bump.

2 years agoDaily bump.
GCC Administrator [Sat, 30 Apr 2022 00:19:19 +0000 (00:19 +0000)] 
Daily bump.

2 years agolibstdc++: Add missing exports for ppc64le --with-long-double-format=ibm [PR105417]
Jonathan Wakely [Fri, 29 Apr 2022 11:17:13 +0000 (12:17 +0100)] 
libstdc++: Add missing exports for ppc64le --with-long-double-format=ibm [PR105417]

The --with-long-double-abi=ibm build is missing some exports that are
present in the --with-long-double-abi=ieee build. Those symbols never
should have been exported at all, but now that they have been, they
should be exported consistently by both ibm and ieee.

This simply defines them as aliases for equivalent symbols that are
already present. The abi-tag on num_get::_M_extract_int isn't really
needed, because it only uses a std::string as a local variable, not in
the return type or function parameters, so it's safe to define the
_M_extract_int[abi:cxx11] symbols as aliases for the corresponding
function without the abi-tag.

This causes some new symbols to be added to the GLIBCXX_3.4.29 version
for the ibm long double build mode, but there is no advantage to adding
them to 3.4.30 for that build. That would just create more
inconsistencies.

libstdc++-v3/ChangeLog:

PR libstdc++/105417
* config/abi/post/powerpc64-linux-gnu/baseline_symbols.txt:
Regenerate.
* src/c++11/compatibility-ldbl-alt128.cc [_GLIBCXX_USE_DUAL_ABI]:
Define __gnu_ieee128::num_get<C>::_M_extract_int[abi:cxx11]<I>
symbols as aliases for corresponding symbols without abi-tag.

(cherry picked from commit bb7cf39b05a216431a431499d0c36a6034f6acc4)

2 years agolibstdc++: Update Solaris baselines for GCC 12.1
Rainer Orth [Fri, 29 Apr 2022 11:56:09 +0000 (13:56 +0200)] 
libstdc++: Update Solaris baselines for GCC 12.1

The following patch updates the Solaris baselines for GCC 12.1.

Tested on i386-pc-solaris2.11 and sparc-sun-solaris2.11 (Solaris 11.3
and 11.4 in each case).

The only (expected) difference between the 11.3 and 11.4 versions is

--- baseline_symbols.txt.s113s 2022-04-28 10:37:11.464068450 +0000
+++ baseline_symbols.txt.s114s 2022-04-27 16:54:31.995636805 +0000
@@ -4070,3 +4070,3 @@
-FUNC:_ZSt10from_charsPKcS0_RdSt12chars_format@@GLIBCXX_3.4.30
-FUNC:_ZSt10from_charsPKcS0_ReSt12chars_format@@GLIBCXX_3.4.30
-FUNC:_ZSt10from_charsPKcS0_RfSt12chars_format@@GLIBCXX_3.4.30
+FUNC:_ZSt10from_charsPKcS0_RdSt12chars_format@@GLIBCXX_3.4.29
+FUNC:_ZSt10from_charsPKcS0_ReSt12chars_format@@GLIBCXX_3.4.29
+FUNC:_ZSt10from_charsPKcS0_RfSt12chars_format@@GLIBCXX_3.4.29

which is handled by the fix for PR libstdc++/103407.  I'm using the 11.4
version here.

2022-04-27  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

libstdc++-v3:
* config/abi/post/i386-solaris/baseline_symbols.txt: Regenerate.
* config/abi/post/i386-solaris/amd64/baseline_symbols.txt:
Likewise.
* config/abi/post/sparc-solaris/baseline_symbols.txt: Likewise.
* config/abi/post/sparc-solaris/sparcv9/baseline_symbols.txt:
Likewise.

2 years agoc++, coroutines: Partial reversion of r12-8308-g15a176a833f23e [PR105426].
Iain Sandoe [Thu, 28 Apr 2022 19:06:29 +0000 (20:06 +0100)] 
c++, coroutines: Partial reversion of r12-8308-g15a176a833f23e [PR105426].

The changes to fix PR 105287 included a tightening of the constraints on which
variables are promoted to frame copies.  This has exposed that we are failing
to name some variables that should be promoted.

We avoid the use of DECL_UID to build anonymous symbols since that might not
be stable for -fcompare-debug.

The long-term fix is to address the cases where the naming has been missed,
but for the short-term (and for the GCC-12 branch) backing out the additional
constraint is proposed.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
PR c++/105426

gcc/cp/ChangeLog:

* coroutines.cc (register_local_var_uses): Allow promotion of unnamed
temporaries to coroutine frame copies.

(cherry picked from commit 3d8d093e820b10a4b4b2af8949a368377c0888cb)

2 years agoDaily bump.
GCC Administrator [Fri, 29 Apr 2022 00:19:02 +0000 (00:19 +0000)] 
Daily bump.

2 years agoc++: partial ordering and dependent operator expr [PR105425]
Patrick Palka [Thu, 28 Apr 2022 17:10:56 +0000 (13:10 -0400)] 
c++: partial ordering and dependent operator expr [PR105425]

Here ever since r12-6022-gbb2a7f80a98de3 we stopped deeming the partial
specialization #2 to be more specialized than #1 ultimately because
dependent operator expressions now have a DEPENDENT_OPERATOR_TYPE type
instead of an empty type, and this made unify stop deducing T(2) == 1
for K during partial ordering for #1 and #2.

This minimal patch fixes this by making the relevant logic in unify
treat DEPENDENT_OPERATOR_TYPE like an empty type.

PR c++/105425

gcc/cp/ChangeLog:

* pt.cc (unify) <case TEMPLATE_PARM_INDEX>: Treat
DEPENDENT_OPERATOR_TYPE like an empty type.

gcc/testsuite/ChangeLog:

* g++.dg/template/partial-specialization13.C: New test.

(cherry picked from commit 509fd16da8528444dccc98cef57a18a295c3f1b4)

2 years agolibstdc++: Update docs for release branch
Jonathan Wakely [Thu, 28 Apr 2022 17:24:10 +0000 (18:24 +0100)] 
libstdc++: Update docs for release branch

libstdc++-v3/ChangeLog:

* doc/xml/manual/status_cxx1998.xml: Refer to GCC 12 not
mainline.
* doc/xml/manual/status_cxx2011.xml: Likewise.
* doc/xml/manual/status_cxx2014.xml: Likewise.
* doc/xml/manual/status_cxx2017.xml: Likewise.
* doc/xml/manual/status_cxx2020.xml: Likewise.
* doc/xml/manual/status_cxxtr1.xml: Likewise.
* doc/xml/manual/status_cxxtr24733.xml: Likewise.
* doc/html/manual/status.html: Regenerate.

2 years agoDocument changes to CONVERT for -mabi-ieeelongdouble for POWER.
Thomas Koenig [Thu, 28 Apr 2022 16:23:16 +0000 (18:23 +0200)] 
Document changes to CONVERT for -mabi-ieeelongdouble for POWER.

gcc/fortran/ChangeLog:

* gfortran.texi: Mention r16_ieee and r16_ibm.
* invoke.texi: Likewise.

(cherry picked from commit 1a5ae012ff3303a8232a03ac9a0925c709775076)

2 years ago[committed] Fix more problems with new linker warnings
Jeff Law [Thu, 28 Apr 2022 16:03:52 +0000 (12:03 -0400)] 
[committed] Fix more problems with new linker warnings

gcc/testsuite
* gcc.dg/lto/pr94157_0.c: Revert last change.
* lib/prune.exp (prune_gcc_output): Prune new linker warning.

2 years agoSet DEV-PHASE to prerelease.
Jakub Jelinek [Thu, 28 Apr 2022 13:59:21 +0000 (15:59 +0200)] 
Set DEV-PHASE to prerelease.

2022-04-28  Jakub Jelinek  <jakub@redhat.com>

* DEV-PHASE: Set to prerelease.

2 years agocgraph: Don't verify semantic_interposition flag for aliases [PR105399]
Jakub Jelinek [Thu, 28 Apr 2022 13:45:33 +0000 (15:45 +0200)] 
cgraph: Don't verify semantic_interposition flag for aliases [PR105399]

The following testcase ICEs, because the ctors during cc1plus all have
!opt_for_fn (decl, flag_semantic_interposition) - they have NULL
DECL_FUNCTION_SPECIFIC_OPTIMIZATION (decl) and optimization_default_node
is for -Ofast and so has flag_semantic_interposition cleared.
During free lang data, we set DECL_FUNCTION_SPECIFIC_OPTIMIZATION (decl)
for the ctor which has body (or for thunks), but don't touch it for
aliases.
During lto1 optimization_default_node reflects the lto1 flags which
are -O2 rather than -Ofast and so has flag_semantic_interposition
set, for the ctor which has body that makes no difference, but as the
alias doesn't still have DECL_FUNCTION_SPECIFIC_OPTIMIZATION (decl) set,
we now trigger this verification check.

The following patch just doesn't verify it for aliases during lto1.
Another possibility would be to set DECL_FUNCTION_SPECIFIC_OPTIMIZATION (decl)
during free lang data even for aliases.

2022-04-28  Jakub Jelinek  <jakub@redhat.com>

PR lto/105399
* cgraph.cc (cgraph_node::verify_node): Don't verify
semantic_interposition flag against
opt_for_fn (decl, flag_semantic_interposition) for aliases in lto1.

* g++.dg/lto/pr105399_0.C: New test.

2 years agoFix up 'libgomp.oacc-fortran/print-1.f90' GCN offloading compilation [PR104717]
Thomas Schwinge [Tue, 26 Apr 2022 16:41:23 +0000 (18:41 +0200)] 
Fix up 'libgomp.oacc-fortran/print-1.f90' GCN offloading compilation [PR104717]

That got broken by recent commit b2202431910e30d8505c94d1cb9341cac7080d10
"fortran: Fix up gfc_trans_oacc_construct [PR104717]".

PR fortran/104717
libgomp/
* testsuite/libgomp.oacc-fortran/print-1.f90: Add OpenACC
privatization scanning.  For GCN offloading compilation, raise
'-mgang-private-size'.

2 years agoc++, coroutines: Improve check for throwing final await [PR104051].
Iain Sandoe [Mon, 18 Apr 2022 15:23:30 +0000 (16:23 +0100)] 
c++, coroutines: Improve check for throwing final await [PR104051].

We check that the final_suspend () method returns a sane type (i.e. a class
or structure) but, unfortunately, that check has to be later than the one
for a throwing case.  If the use returns some nonsensical type from the
method, we need to handle that in the checking for noexcept.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
PR c++/104051

gcc/cp/ChangeLog:

* coroutines.cc (coro_diagnose_throwing_final_aw_expr): Handle
non-target expression inputs.

gcc/testsuite/ChangeLog:

* g++.dg/coroutines/pr104051.C: New test.

2 years agoc++, coroutines: Account for overloaded promise return_value() [PR105301].
Iain Sandoe [Mon, 18 Apr 2022 08:21:52 +0000 (09:21 +0100)] 
c++, coroutines: Account for overloaded promise return_value() [PR105301].

Whether it was intended or not, it is possible to define a coroutine promise
with multiple return_value() methods [which need not even have the same type].

We were not accounting for this possibility in the check to see whether both
return_value and return_void are specifier (which is prohibited by the
standard).  Fixed thus and provided an adjusted diagnostic for the case that
multiple return_value() methods are present.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
PR c++/105301

gcc/cp/ChangeLog:

* coroutines.cc (coro_promise_type_found_p): Account for possible
mutliple overloads of the promise return_value() method.

gcc/testsuite/ChangeLog:

* g++.dg/coroutines/pr105301.C: New test.

2 years agoc++, coroutines: Make sure our temporaries are in a bind expr [PR105287]
Iain Sandoe [Sun, 17 Apr 2022 19:58:28 +0000 (20:58 +0100)] 
c++, coroutines: Make sure our temporaries are in a bind expr [PR105287]

There are a few cases where we can generate a temporary that does not need
to be added to the coroutine frame (i.e. these are genuinely ephemeral).  The
intent was that unnamed temporaries should not be 'promoted' to coroutine
frame entries.  However there was a thinko and these were not actually ever
added to the bind expressions being generated for the expanded awaits.  This
meant that they were showing in the global namspace, leading to an empty
DECL_CONTEXT and the ICE reported.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
PR c++/105287

gcc/cp/ChangeLog:

* coroutines.cc (maybe_promote_temps): Ensure generated temporaries
are added to the bind expr.
(add_var_to_bind): Fix local var naming to use portable punctuation.
(register_local_var_uses): Do not add synthetic names to unnamed
temporaries.

gcc/testsuite/ChangeLog:

* g++.dg/coroutines/pr105287.C: New test.

2 years agoc++, coroutines: Avoid expanding within templates [PR103868]
Nathan Sidwell [Sun, 3 Apr 2022 10:35:03 +0000 (11:35 +0100)] 
c++, coroutines: Avoid expanding within templates [PR103868]

This is a forward-port of a patch by Nathan (against 10.x) which fixes an open
PR.

We are ICEing because we ended up tsubst_copying something that had already
been tsubst, leading to an assert failure (mostly such repeated tsubsting is
harmless).

We had a non-dependent co_await in a non-dependent-type template fn, so we
processed it at definition time, and then reprocessed at instantiation time.
We fix this here by deferring substitution while processing templates.

Additional observations (for a better future fix, in the GCC13 timescale):

Exprs only have dependent type if at least one operand is dependent which was
what the current code was intending to do.  Coroutines have the additional
wrinkle, that the current fn's type is an implicit operand.

So, if the coroutine function's type is not dependent, and the operand is not
dependent, we should determine the type of the co_await expression using the
DEPENDENT_EXPR wrapper machinery.  That allows us to determine the
subexpression type, but leave its operand unchanged and then instantiate it
later.

PR c++/103868

gcc/cp/ChangeLog:

* coroutines.cc (finish_co_await_expr): Do not process non-dependent
coroutine expressions at template definition time.
(finish_co_yield_expr): Likewise.
(finish_co_return_stmt): Likewise.

gcc/testsuite/ChangeLog:

* g++.dg/coroutines/pr103868.C: New test.

Co-Authored-by: Iain Sandoe <iain@sandoe.co.uk>
2 years agotestsuite,X86: Fix missing USER_LABEL_PREFIX cases.
Iain Sandoe [Fri, 15 Apr 2022 14:51:22 +0000 (15:51 +0100)] 
testsuite,X86: Fix missing USER_LABEL_PREFIX cases.

Yet another set of testcases that do not account for targets that
use __USER_LABEL_PREFIX__.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
gcc/testsuite/ChangeLog:

* gcc.target/i386/memcpy-strategy-10.c: Account for
__USER_LABEL_PREFIX__.
* gcc.target/i386/memcpy-strategy-5.c: Likewise.
* gcc.target/i386/memset-strategy-5.c: Likewise.
* gcc.target/i386/memset-strategy-7.c: Likewise.

2 years agotestsuite: Add target requires for ifuncs to mv31.C.
Iain Sandoe [Thu, 28 Apr 2022 07:51:48 +0000 (08:51 +0100)] 
testsuite: Add target requires for ifuncs to mv31.C.

g++.target/i386/mv31.C fails on targets without ifuncs support so add
the necessary target supports guard.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
gcc/testsuite/ChangeLog:

* g++.target/i386/mv31.C: Add target supports guard for ifuncs.

2 years agoc++: global-namespace-qualified var after class def [PR90107]
Marek Polacek [Wed, 27 Apr 2022 22:17:54 +0000 (18:17 -0400)] 
c++: global-namespace-qualified var after class def [PR90107]

Here we wrongly reject the definition of "::N::a"

  struct A;
  namespace N { extern A a; }
  struct A {} ::N::a;

because our code to diagnose a missing ; after a class definition doesn't
realize that :: can follow a class definition.

PR c++/90107

gcc/cp/ChangeLog:

* parser.cc (cp_parser_class_specifier_1): Accept :: after a class
definition.

gcc/testsuite/ChangeLog:

* g++.dg/parse/qualified6.C: New test.

2 years agolibstdc++: Fix error reporting in filesystem::copy [PR99290]
Jonathan Wakely [Thu, 28 Apr 2022 12:06:31 +0000 (13:06 +0100)] 
libstdc++: Fix error reporting in filesystem::copy [PR99290]

The recursive calls to filesystem::copy should stop if any of them
reports an error.

libstdc++-v3/ChangeLog:

PR libstdc++/99290
* src/c++17/fs_ops.cc (fs::copy): Pass error_code to
directory_iterator constructor, and check on each iteration.
* src/filesystem/ops.cc (fs::copy): Likewise.
* testsuite/27_io/filesystem/operations/copy.cc: Check for
errors during recursion.
* testsuite/experimental/filesystem/operations/copy.cc:
Likewise.

2 years agod: Merge upstream dmd 313d28b3d, druntime e361d200.
Iain Buclaw [Thu, 28 Apr 2022 10:40:59 +0000 (12:40 +0200)] 
d: Merge upstream dmd 313d28b3d, druntime e361d200.

D front-end changes:

    - Import latest bug fixes from the 2.100 release branch.
    - Fix signatures of extern C++ functions that have size_t
      parameters.

gcc/d/ChangeLog:

* dmd/MERGE: Merge upstream dmd 313d28b3d.
* d-port.cc (Port::memicmp): Use d_size_t instead of size_t.
(Port::valcpy): Likewise.

libphobos/ChangeLog:

* libdruntime/MERGE: Merge upstream druntime e361d200.

2 years agoi386: Fix up ix86_gimplify_va_arg [PR105331]
Jakub Jelinek [Thu, 28 Apr 2022 10:33:59 +0000 (12:33 +0200)] 
i386: Fix up ix86_gimplify_va_arg [PR105331]

On the following testcase we emit a bogus
'va_arg_tmp.5' may be used uninitialized
warning.  The reason is that when gimplifying the addr = &temp;
statement, the va_arg_tmp temporary var for which we emit ADDR_EXPR
is not TREE_ADDRESSABLE, prepare_gimple_addressable emits some extra
code to initialize the newly addressable var from its previous value,
but it is a new variable which hasn't been initialized yet and will
be later, so we end up initializing it with uninitialized SSA_NAME:
  va_arg_tmp.6 = va_arg_tmp.5_14(D);
  addr.2_16 = &va_arg_tmp.6;
  _17 = MEM[(double *)sse_addr.4_13];
  MEM[(double * {ref-all})addr.2_16] = _17;
and with -O1 we actually don't DSE it before the warning is emitted.
If we make the temp TREE_ADDRESSABLE before the gimplification, then
this prepare_gimple_addressable path isn't taken and we effectively
omit the first statement above and so the bogus warning is gone.

I went through other backends and didn't find another instance of this
problem.

2022-04-28  Jakub Jelinek  <jakub@redhat.com>

PR target/105331
* config/i386/i386.cc (ix86_gimplify_va_arg): Mark va_arg_tmp
temporary TREE_ADDRESSABLE before trying to gimplify ADDR_EXPR
of it.

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

2 years agodoc: Remove misleading text about multilibs for IEEE long double
Jonathan Wakely [Thu, 28 Apr 2022 09:30:58 +0000 (10:30 +0100)] 
doc: Remove misleading text about multilibs for IEEE long double

The choice of ieee or ibm long double format is orthogonal to multilibs,
as the two sets of symbols co-exist and don't need a separate multilib.

gcc/ChangeLog:

* doc/install.texi (Configuration): Remove misleading text
around LE PowerPC Linux multilibs.

2 years agolibstdc++: Remove redundant line in versioned namespace linker script
François Dumont [Thu, 28 Apr 2022 09:01:14 +0000 (10:01 +0100)] 
libstdc++: Remove redundant line in versioned namespace linker script

This doesn't match anything.

libstdc++-v3/ChangeLog:

* config/abi/pre/gnu-versioned-namespace.ver: Remove
std::random_device::* pattern.

2 years agodoc: Document Solaris D bootstrap requirements [PR 103528]
Rainer Orth [Thu, 28 Apr 2022 08:27:32 +0000 (10:27 +0200)] 
doc: Document Solaris D bootstrap requirements [PR 103528]

This patch documents the Solaris-specific D bootstrap requirements.

Tested by building and inspecting gccinstall.{pdf,info}.

2022-03-16  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

gcc:
PR d/103528
* doc/install.texi (Tools/packages necessary for building GCC)
(GDC): Document libphobos requirement.
(Host/target specific installation notes for GCC, *-*-solaris2*):
Document libphobos and GDC specifics.

2 years agotree-optimization/105219 - bogus max iters for vectorized epilogue
Richard Biener [Wed, 27 Apr 2022 12:06:12 +0000 (14:06 +0200)] 
tree-optimization/105219 - bogus max iters for vectorized epilogue

The following makes sure to take into account prologue peeling
when trying to narrow down the maximum number of iterations
computed for the vectorized epilogue.  A similar issue exists when
peeling for gaps.

2022-04-27  Richard Biener  <rguenther@suse.de>

PR tree-optimization/105219
* tree-vect-loop.cc (vect_transform_loop): Disable
special code narrowing the vectorized epilogue max
iterations when peeling for alignment or gaps was in effect.

* gcc.dg/vect/pr105219.c: New testcase.

2 years agotestsuite: Add test case for pack/unpack bifs at soft-float [PR105334]
Kewen Lin [Thu, 28 Apr 2022 03:34:27 +0000 (22:34 -0500)] 
testsuite: Add test case for pack/unpack bifs at soft-float [PR105334]

This patch is to add the test coverage for the two recent fixes
r12-8091 and r12-8226 from Segher, aix is skipped since it takes
soft-float and long-double-128 incompatible.

PR target/105334

gcc/testsuite/ChangeLog:

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

2 years agotestsuite: Skip target not support -pthread [PR104676].
Jia-Wei Chen [Tue, 19 Apr 2022 03:11:24 +0000 (11:11 +0800)] 
testsuite: Skip target not support -pthread [PR104676].

The "ftree-parallelize-loops=" imply -pthread option in gcc/gcc.cc,
some target are not support pthread like elf target use newlib,
and will get an error:

"*-*-elf-gcc: error: unrecognized command-line option '-pthread'"

so we add an additional condition "{target pthread}" to make sure the
dg-additional-options runs on support targets.

gcc/testsuite/ChangeLog

PR target/104676
* gcc.dg/torture/pr104676.c: Add "{target pthread}" check.

2 years agoloongarch: ignore zero-size fields in calling convention
Xi Ruoyao [Wed, 27 Apr 2022 11:45:59 +0000 (19:45 +0800)] 
loongarch: ignore zero-size fields in calling convention

gcc/

* config/loongarch/loongarch.cc
(loongarch_flatten_aggregate_field): Ignore empty fields for
RECORD_TYPE.

gcc/testsuite/

* gcc.target/loongarch/zero-size-field-pass.c: New test.
* gcc.target/loongarch/zero-size-field-ret.c: New test.

2 years agoDaily bump.
GCC Administrator [Thu, 28 Apr 2022 00:16:52 +0000 (00:16 +0000)] 
Daily bump.

2 years agoc++: add comments
Jason Merrill [Wed, 27 Apr 2022 20:09:35 +0000 (16:09 -0400)] 
c++: add comments

gcc/cp/ChangeLog:

* tree.cc (strip_typedefs): Add default argument comments.

2 years agoFix oversight from previous commit to pr70673.
Thomas Koenig [Wed, 27 Apr 2022 20:40:49 +0000 (22:40 +0200)] 
Fix oversight from previous commit to pr70673.

gcc/testsuite/ChangeLog:

* gfortran.dg/pr70673.f90: Removed second invalid
line.

2 years agoc++: enum in generic lambda at global scope [PR105398]
Marek Polacek [Tue, 26 Apr 2022 20:12:58 +0000 (16:12 -0400)] 
c++: enum in generic lambda at global scope [PR105398]

We crash compiling this test since r11-7993 which changed
lookup_template_class_1 so that we only call tsubst_enum when

  !uses_template_parms (current_nonlambda_scope ())

But here current_nonlambda_scope () is the global NAMESPACE_DECL ::, which
doesn't have a type, therefore is considered type-dependent.  So we don't
call tsubst_enum, and crash in tsubst_copy/CONST_DECL because we didn't
find the e1 enumerator.

I don't think any namespace can depend on any template parameter, so
this patch tweaks uses_template_parms.

PR c++/105398

gcc/cp/ChangeLog:

* pt.cc (uses_template_parms): Return false for any NAMESPACE_DECL.

gcc/testsuite/ChangeLog:

* g++.dg/cpp1y/lambda-generic-enum2.C: New test.

2 years agotestsuite: Add testcase for dangling pointer equality bogus warning [PR104492]
Jakub Jelinek [Wed, 27 Apr 2022 16:47:10 +0000 (18:47 +0200)] 
testsuite: Add testcase for dangling pointer equality bogus warning [PR104492]

On Wed, Apr 27, 2022 at 12:02:33PM +0200, Richard Biener wrote:
> I did that but the reduction result did not resemble the same failure
> mode.  I've failed to manually construct a testcase as well.  Possibly
> a testcase using libstdc++ but less Qt internals might be possible.

Here is a testcase that I've managed to reduce, FAILs with:
FAIL: g++.dg/warn/pr104492.C  -std=gnu++14  (test for bogus messages, line 111)
FAIL: g++.dg/warn/pr104492.C  -std=gnu++17  (test for bogus messages, line 111)
FAIL: g++.dg/warn/pr104492.C  -std=gnu++20  (test for bogus messages, line 111)
on both x86_64-linux and i686-linux without your commit and passes with it.

2022-04-27  Jakub Jelinek  <jakub@redhat.com>

PR middle-end/104492
* g++.dg/warn/pr104492.C: New test.

2 years agoSplit test to remove failing run time test and add check for ICE.
Thomas Koenig [Wed, 27 Apr 2022 16:40:18 +0000 (18:40 +0200)] 
Split test to remove failing run time test and add check for ICE.

gcc/testsuite/ChangeLog:

PR fortran/70673
PR fortran/78054
* gfortran.dg/pr70673.f90: Remove invalid statement.
* gfortran.dg/pr70673_2.f90: New test to check that
ICE does not re-appear.

2 years agolibstdc++: Update {x86_64,i?86,aarch64,s390x,ppc{,64,64le}} baseline_symbols.txt
Jakub Jelinek [Wed, 27 Apr 2022 15:30:09 +0000 (17:30 +0200)] 
libstdc++: Update {x86_64,i?86,aarch64,s390x,ppc{,64,64le}} baseline_symbols.txt

The following patch updates baseline_symbols.txt on arches where I have
latest libstdc++ builds (my ws + Fedora package builds).
I've manually excluded:
+FUNC:_ZNKSt17__gnu_cxx_ieee1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intB5cxx11IjEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_@@GLIBCXX_IEEE128_3.4.29
+FUNC:_ZNKSt17__gnu_cxx_ieee1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intB5cxx11IlEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_@@GLIBCXX_IEEE128_3.4.29
+FUNC:_ZNKSt17__gnu_cxx_ieee1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intB5cxx11ImEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_@@GLIBCXX_IEEE128_3.4.29
+FUNC:_ZNKSt17__gnu_cxx_ieee1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intB5cxx11ItEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_@@GLIBCXX_IEEE128_3.4.29
+FUNC:_ZNKSt17__gnu_cxx_ieee1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intB5cxx11IxEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_@@GLIBCXX_IEEE128_3.4.29
+FUNC:_ZNKSt17__gnu_cxx_ieee1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intB5cxx11IyEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_@@GLIBCXX_IEEE128_3.4.29
+FUNC:_ZNKSt17__gnu_cxx_ieee1287num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intB5cxx11IjEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_@@GLIBCXX_IEEE128_3.4.29
+FUNC:_ZNKSt17__gnu_cxx_ieee1287num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intB5cxx11IlEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_@@GLIBCXX_IEEE128_3.4.29
+FUNC:_ZNKSt17__gnu_cxx_ieee1287num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intB5cxx11ImEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_@@GLIBCXX_IEEE128_3.4.29
+FUNC:_ZNKSt17__gnu_cxx_ieee1287num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intB5cxx11ItEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_@@GLIBCXX_IEEE128_3.4.29
+FUNC:_ZNKSt17__gnu_cxx_ieee1287num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intB5cxx11IxEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_@@GLIBCXX_IEEE128_3.4.29
+FUNC:_ZNKSt17__gnu_cxx_ieee1287num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intB5cxx11IyEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_@@GLIBCXX_IEEE128_3.4.29
additions on ppc64le as those look unexpected.
Those symbols didn't show up in Fedora 11.3.1 build with recent glibc,
while other GLIBCXX_IEEE128_3.4.29 symbols are in 11.x already.

What this patch includes are only @@GLIBCXX_3.4.30 symbol additions, same
symbols on all files, except that powerpc64 adds also
_ZNSt17__gnu_cxx_ieee12816__convert_from_vERKP15__locale_structPciPKcz@@GLIBCXX_IEEE128_3.4.30
so everything included in the patch looks right to me.

2022-04-27  Jakub Jelinek  <jakub@redhat.com>

* config/abi/post/x86_64-linux-gnu/baseline_symbols.txt: Update.
* config/abi/post/x86_64-linux-gnu/32/baseline_symbols.txt: Update.
* config/abi/post/i486-linux-gnu/baseline_symbols.txt: Update.
* config/abi/post/aarch64-linux-gnu/baseline_symbols.txt: Update.
* config/abi/post/s390x-linux-gnu/baseline_symbols.txt: Update.
* config/abi/post/powerpc-linux-gnu/baseline_symbols.txt: Update.
* config/abi/post/powerpc64-linux-gnu/baseline_symbols.txt: Update.
* config/abi/post/powerpc64-linux-gnu/32/baseline_symbols.txt: Update.

2 years agolibstdc++: Add pretty printer for std::atomic
Jonathan Wakely [Wed, 27 Apr 2022 13:29:34 +0000 (14:29 +0100)] 
libstdc++: Add pretty printer for std::atomic

For the atomic specializations for shared_ptr and weak_ptr we can reuse
the existing SharedPointerPrinter, with a small tweak.

libstdc++-v3/ChangeLog:

* python/libstdcxx/v6/printers.py (SharedPointerPrinter): Add
support for atomic<shared_ptr<T>> and atomic<weak_ptr<T>>.
(StdAtomicPrinter): New printer.
(build_libstdcxx_dictionary): Register new printer.
* testsuite/libstdc++-prettyprinters/cxx11.cc: Test std::atomic.
* testsuite/libstdc++-prettyprinters/cxx20.cc: Test atomic smart
pointers.

2 years agoada: Fix build for RTEMS
Sebastian Huber [Wed, 27 Apr 2022 11:54:22 +0000 (13:54 +0200)] 
ada: Fix build for RTEMS

Commit 621cccba3f8b0cd2757feda171e66e3820b55c2c broke the Ada build for all
RTEMS targets except aarch64.

gcc/ada/

* tracebak.c: Add support for ARM RTEMS. Add support for RTEMS to PPC
ELF.  Add support for RTEMS to SPARC.  Merge aarch64 support of Linux
and RTEMS.

2 years agoLoongArch: Add fdiv define_expand template.
Lulu Cheng [Wed, 27 Apr 2022 07:07:05 +0000 (15:07 +0800)] 
LoongArch: Add fdiv define_expand template.

gcc/ChangeLog:

* config/loongarch/loongarch.md: Add fdiv define_expand template,
then generate floating-point division and floating-point reciprocal
instructions.

2 years agoLoongArch: Add '(clobber (mem:BLK (scratch)))' to PLV instruction templates.
Lulu Cheng [Mon, 25 Apr 2022 01:18:39 +0000 (09:18 +0800)] 
LoongArch: Add '(clobber (mem:BLK (scratch)))' to PLV instruction templates.

gcc/ChangeLog:

* config/loongarch/loongarch.md: Add '(clobber (mem:BLK (scratch)))'
to PLV instruction templates.

2 years agomiddle-end/104492 - avoid all equality compare dangling pointer diags
Richard Biener [Mon, 25 Apr 2022 08:46:16 +0000 (10:46 +0200)] 
middle-end/104492 - avoid all equality compare dangling pointer diags

The following extends the equality compare dangling pointer diagnostics
suppression for uses following free or realloc to also cover those
following invalidation of auto variables via CLOBBERs.  That avoids
diagnosing idioms like

  return std::find(std::begin(candidates), std::end(candidates), s)
           != std::end(candidates);

for auto candidates which are prone to forwarding of the final
comparison across the storage invalidation as then seen by the
late run access warning pass.

2022-04-25  Richard Biener  <rguenther@suse.de>

PR middle-end/104492
* gimple-ssa-warn-access.cc
(pass_waccess::warn_invalid_pointer): Exclude equality compare
diagnostics for all kind of invalidations.
(pass_waccess::check_dangling_uses): Fix post-dominator query.
(pass_waccess::check_pointer_uses): Likewise.

2 years agofortran: Compare non-constant bound expressions. [PR105379]
Mikael Morin [Wed, 27 Apr 2022 09:36:16 +0000 (11:36 +0200)] 
fortran: Compare non-constant bound expressions. [PR105379]

Starting with r12-8235-gfa5cd7102da676dcb1757b1288421f5f3439ae0e,
class descriptor types are compared to detect duplicate declarations.

This caused ICEs as the comparison of array spec supported only constant
explicit bounds, but dummy class variable descriptor types can have a
_data field with non-constant array spec bounds.

This change adds support for non-constant bounds.  For that,
gfc_dep_compare_expr is used.  It does probably more than strictly
necessary, but using it avoids rewriting a specific comparison function,
making mistakes and forgetting cases.

PR fortran/103662
PR fortran/105379

gcc/fortran/ChangeLog:

* array.cc (compare_bounds): Use bool as return type.
Support non-constant expressions.
(gfc_compare_array_spec): Update call to compare_bounds.

gcc/testsuite/ChangeLog:

* gfortran.dg/class_dummy_8.f90: New test.
* gfortran.dg/class_dummy_9.f90: New test.

2 years agofortran: Avoid infinite self-recursion [PR105381]
Mikael Morin [Wed, 27 Apr 2022 09:36:00 +0000 (11:36 +0200)] 
fortran: Avoid infinite self-recursion [PR105381]

Dummy array decls are local decls different from the argument decl
accessible through GFC_DECL_SAVED_DESCRIPTOR.  If the argument decl has
a DECL_LANG_SPECIFIC set, it is copied over to the local decl at the
time the latter is created, so that the DECL_LANG_SPECIFIC object is
shared between local dummy decl and argument decl, and thus the
GFC_DECL_SAVED_DESCRIPTOR of the argument decl is the argument decl
itself.

The r12-8230-g7964ab6c364c410c34efe7ca2eba797d36525349 change introduced
the non_negative_strides_array_p predicate which recurses through
GFC_DECL_SAVED_DESCRIPTOR to avoid seeing dummy decls as purely local
decls.  As the GFC_DECL_SAVED_DESCRIPTOR of the argument decl is itself,
this can cause infinite recursion.

This change adds a check to avoid infinite recursion.

PR fortran/102043
PR fortran/105381

gcc/fortran/ChangeLog:

* trans-array.cc (non_negative_strides_array_p): Inline variable
orig_decl and merge nested if conditions.  Add condition to not
recurse if the next argument is the same as the current.

gcc/testsuite/ChangeLog:

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

2 years agotestsuite: Add arm testcase for PR105374
Christophe Lyon [Tue, 26 Apr 2022 14:57:02 +0000 (15:57 +0100)] 
testsuite: Add arm testcase for PR105374

As discussed in the PR, here is the testcase with the appropriate dg-*
directives.

Tested on arm-none-eabi with
1 -mcpu=cortex-a7/-mfloat-abi=soft/-march=armv7ve+simd
2 -mcpu=cortex-a7/-mfloat-abi=hard/-march=armv7ve+simd
3 -mthumb/-mcpu=cortex-a7/-mfloat-abi=hard/-march=armv7ve+simd
4 -mthumb/-mfloat-abi=soft/-march=armv6s-m
5 -mthumb/-mfloat-abi=soft/-march=armv7-m
6 -mthumb/-mfloat-abi=hard/-march=armv7e-m+fp
7 -mthumb/-mfloat-abi=hard/-march=armv7e-m+fp.dp
8 -mthumb/-mfloat-abi=hard/-march=armv8-m.main+fp+dsp
9 -mthumb/-mfloat-abi=hard/-march=armv8.1-m.main+mve.fp+fp.dp
10 -mthumb/-mfloat-abi=hard/-march=armv8.1-m.main+mve

The test is UNSUPPORTED with the first three ones (because of
-mcpu=cortex-a7), ignored with armv6s-m, and PASSes with all the other
ones, while it used crash without Jakub's fix (r12-8263), ie. FAIL
with options 5,6,7,8,10. The test passed without Jakub's fix with
option 9 because the problem happens only with an integer-only MVE.

2022-04-26  Christophe Lyon  <christophe.lyon@arm.com>

gcc/testsuite/

PR tree-optimization/105374
* gcc.target/arm/simd/pr105374.C: New.

2 years ago[Ada] Revert r12-6599 (Fix up handling of ghost units [PR104027])
Pierre-Marie de Rodat [Tue, 26 Apr 2022 09:51:47 +0000 (09:51 +0000)] 
[Ada] Revert r12-6599 (Fix up handling of ghost units [PR104027])

gcc/ada/

PR ada/104027
* gnat1drv.adb: Remove the goto End_Of_Program.

2 years agoPR102024 - IBM Z: Add psabi diagnostics
Andreas Krebbel [Wed, 27 Apr 2022 07:20:41 +0000 (09:20 +0200)] 
PR102024 - IBM Z: Add psabi diagnostics

For IBM Z in particular there is a problem with structs like:

struct A { float a; int :0; };

Our ABI document allows passing a struct in an FPR only if it has
exactly one member. On the other hand it says that structs of 1,2,4,8
bytes are passed in a GPR. So this struct is expected to be passed in
a GPR. Since we don't return structs in registers (regardless of the
number of members) it is always returned in memory.

Situation is as follows:

All compiler versions tested return it in memory - as expected.

gcc 11, gcc 12, g++ 12, and clang 13 pass it in a GPR - as expected.

g++ 11 as well as clang++ 13 pass in an FPR

For IBM Z we stick to the current GCC 12 behavior, i.e. zero-width
bitfields are NOT ignored.  A struct as above will be passed in a
GPR. Rational behind this is that not affecting the C ABI is more
important here.

A patch for clang is in progress: https://reviews.llvm.org/D122388

In addition to the usual regression test I ran the compat and
struct-layout-1 testsuites comparing the compiler before and after the
patch.

gcc/ChangeLog:
PR target/102024
* config/s390/s390-protos.h (s390_function_arg_vector): Remove
prototype.
* config/s390/s390.cc (s390_single_field_struct_p): New function.
(s390_function_arg_vector): Invoke s390_single_field_struct_p.
(s390_function_arg_float): Likewise.

gcc/testsuite/ChangeLog:
PR target/102024
* g++.target/s390/pr102024-1.C: New test.
* g++.target/s390/pr102024-2.C: New test.
* g++.target/s390/pr102024-3.C: New test.
* g++.target/s390/pr102024-4.C: New test.
* g++.target/s390/pr102024-5.C: New test.
* g++.target/s390/pr102024-6.C: New test.

2 years agoasan: Fix up asan_redzone_buffer::emit_redzone_byte [PR105396]
Jakub Jelinek [Wed, 27 Apr 2022 06:34:18 +0000 (08:34 +0200)] 
asan: Fix up asan_redzone_buffer::emit_redzone_byte [PR105396]

On the following testcase, we have in main's frame 3 variables,
some red zone padding, 4 byte d, followed by 12 bytes of red zone padding, then
8 byte b followed by 24 bytes of red zone padding, then 40 bytes c followed
by some red zone padding.
The intended content of shadow memory for that is (note, each byte describes
8 bytes of memory):
f1 f1 f1 f1 04 f2 00 f2 f2 f2 00 00 00 00 00 f3 f3 f3 f3 f3
left red    d  mr b  middle r c              right red zone

f1 is left red zone magic
f2 is middle red zone magic
f3 is right red zone magic
00 when all 8 bytes are accessible
01-07 when only 1 to 7 bytes are accessible followed by inaccessible bytes

The -fdump-rtl-expand-details dump makes it clear that it misbehaves:
Flushing rzbuffer at offset -160 with: f1 f1 f1 f1
Flushing rzbuffer at offset -128 with: 04 f2 00 00
Flushing rzbuffer at offset -128 with: 00 00 00 f2
Flushing rzbuffer at offset -96 with: f2 f2 00 00
Flushing rzbuffer at offset -64 with: 00 00 00 f3
Flushing rzbuffer at offset -32 with: f3 f3 f3 f3
In the end we end up with
f1 f1 f1 f1 00 00 00 f2 f2 f2 00 00 00 00 00 f3 f3 f3 f3 f3
shadow bytes because at offset -128 there are 2 overlapping stores
as asan_redzone_buffer::emit_redzone_byte has flushed the temporary 4 byte
buffer in the middle.

The function is called with an offset and value.  If the passed offset is
consecutive with the prev_offset + buffer size (off == offset), then
we handle it correctly, similarly if the new offset is far enough from the
old one (we then flush whatever was in the buffer and if needed add up to 3
bytes of 00 before actually pushing value.

But what isn't handled correctly is when the offset isn't consecutive to
what has been added last time, but it is in the same 4 byte word of shadow
memory (32 bytes of actual memory), like the above case where
we have consecutive 04 f2 and then skip one shadow memory byte (aka 8 bytes
of real memory) and then want to emit f2.  Emitting that as a store
of little-endian 0x0000f204 followed by a store of 0xf2000000 to the same
address doesn't work, we want to emit 0xf200f204.

The following patch does that by pushing 1 or 2 00 bytes.
Additionally, as a small cleanup, instead of using
      m_shadow_bytes.safe_push (value);
      flush_if_full ();
in all of if, else if and else bodies it sinks those 2 stmts to the end
of function as all do the same thing.

2022-04-27  Jakub Jelinek  <jakub@redhat.com>

PR sanitizer/105396
* asan.cc (asan_redzone_buffer::emit_redzone_byte): Handle the case
where offset is bigger than off but smaller than m_prev_offset + 32
bits by pushing one or more 0 bytes.  Sink the
m_shadow_bytes.safe_push (value); flush_if_full (); statements from
all cases to the end of the function.

* gcc.dg/asan/pr105396.c: New test.

2 years agors6000: Move V2DI vec_neg under power8-vector [PR105271]
Kewen Lin [Tue, 26 Apr 2022 11:34:24 +0000 (06:34 -0500)] 
rs6000: Move V2DI vec_neg under power8-vector [PR105271]

As PR105271 shows, __builtin_altivec_neg_v2di requires option
-mpower8-vector as its pattern expansion relies on subv2di which
has guard VECTOR_UNIT_P8_VECTOR_P (V2DImode).  This fix is to move
the related lines for __builtin_altivec_neg_v2di to the section
of stanza power8-vector.

PR target/105271

gcc/ChangeLog:

* config/rs6000/rs6000-builtins.def (NEG_V2DI): Move to [power8-vector]
stanza.

gcc/testsuite/ChangeLog:

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

2 years agoDaily bump.
GCC Administrator [Wed, 27 Apr 2022 00:16:46 +0000 (00:16 +0000)] 
Daily bump.

2 years agoc++: pack init-capture of unresolved overload [PR102629]
Jason Merrill [Tue, 26 Apr 2022 04:19:40 +0000 (00:19 -0400)] 
c++: pack init-capture of unresolved overload [PR102629]

Here we were failing to diagnose that the initializer for the capture pack
is an unresolved overload.  It turns out that the reason we didn't recognize
the deduction failure in do_auto_deduction was that the individual 'auto' in
the expansion of the capture pack was still marked as a parameter pack, so
we were deducing it to an empty pack instead of failing.

PR c++/102629

gcc/cp/ChangeLog:

* pt.cc (gen_elem_of_pack_expansion_instantiation): Clear
TEMPLATE_TYPE_PARAMETER_PACK on auto.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/lambda-pack-init7.C: New test.

2 years agoGCN: Make "gang-private data-share memory exhausted" error more verbose
Thomas Schwinge [Tue, 26 Apr 2022 11:05:19 +0000 (13:05 +0200)] 
GCN: Make "gang-private data-share memory exhausted" error more verbose

    [...]: error: 512 bytes of gang-private data-share memory exhausted (increase with ‘-mgang-private-size=560’, for example)

gcc/
* config/gcn/gcn.cc (gcn_print_lds_decl): Make "gang-private
data-share memory exhausted" error more verbose.

2 years agoUpdate gcc sv.po
Joseph Myers [Tue, 26 Apr 2022 18:58:10 +0000 (18:58 +0000)] 
Update gcc sv.po

* sv.po: Update.

2 years agoc++: decltype of non-dependent call of class type [PR105386]
Patrick Palka [Tue, 26 Apr 2022 14:53:38 +0000 (10:53 -0400)] 
c++: decltype of non-dependent call of class type [PR105386]

We need to pass tf_decltype when instantiating a non-dependent decltype
operand, like tsubst does in the dependent case, so that we don't force
completion of a prvalue operand's class type.

PR c++/105386

gcc/cp/ChangeLog:

* semantics.cc (finish_decltype_type): Pass tf_decltype to
instantiate_non_dependent_expr_sfinae.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/decltype81.C: New test.

2 years agolto: use diagnostics_context in print_lto_docs_link
Martin Liska [Tue, 26 Apr 2022 07:56:37 +0000 (09:56 +0200)] 
lto: use diagnostics_context in print_lto_docs_link

Properly parse OPT_fdiagnostics_urls_ and then initialize both urls
and colors for global_dc. Doing that we would follow the configure
option --with-documentation-root-url, -fdiagnostics-urls is respected.
Plus we'll print colored warning and note messages.

PR lto/105364

gcc/ChangeLog:

* lto-wrapper.cc (print_lto_docs_link): Use global_dc.
(run_gcc): Parse OPT_fdiagnostics_urls_.
(main): Initialize global_dc.

2 years agolibphobos: Don't call free on the TLS array in the emutls destroy function.
Iain Buclaw [Tue, 26 Apr 2022 13:10:09 +0000 (14:10 +0100)] 
libphobos: Don't call free on the TLS array in the emutls destroy function.

Fixes a segfault seen on Darwin when a GC scan is ran after a thread has
been destroyed.  As the global emutlsArrays hash still has a reference
to the array itself, and tries to iterate all elements.

Setting the length to zero frees all allocated elements in the array,
and ensures that it is skipped when the _d_emutls_scan is called.

libphobos/ChangeLog:

* libdruntime/gcc/emutls.d (emutlsDestroyThread): Clear the per-thread
TLS array, don't call free().

2 years agolibstdc++: Add std::atomic<shared_ptr>(nullptr_t) constructor (LWG 3661)
Jonathan Wakely [Mon, 25 Apr 2022 17:25:07 +0000 (18:25 +0100)] 
libstdc++: Add std::atomic<shared_ptr>(nullptr_t) constructor (LWG 3661)

This DR was approved at the February 2022 plenary.

libstdc++-v3/ChangeLog:

* include/bits/shared_ptr_atomic.h (atomic<shared_ptr>): Add
constructor for constant initialization from nullptr_t.
* testsuite/20_util/shared_ptr/atomic/atomic_shared_ptr.cc:
Check for new constructor.

2 years agolibstdc++: Define std::hash<std::filesystem::path> (LWG 3657)
Jonathan Wakely [Mon, 25 Apr 2022 17:21:57 +0000 (18:21 +0100)] 
libstdc++: Define std::hash<std::filesystem::path> (LWG 3657)

This DR was approved at the February 2022 plenary.

libstdc++-v3/ChangeLog:

* include/bits/fs_path.h (hash<filesystem::path>): Define.
* testsuite/27_io/filesystem/path/nonmember/hash_value.cc:
Check std::hash specialization.

2 years agors6000: Make the has_arch target selectors actually work
Segher Boessenkool [Tue, 26 Apr 2022 11:26:09 +0000 (11:26 +0000)] 
rs6000: Make the has_arch target selectors actually work

2022-04-26  Segher Boessenkoool  <segher@kernel.crashing.org>

gcc/testsuite/
PR target/105349
* lib/target-supports.exp (check_effective_target_has_arch_pwr5): Use
the specified dg-options.
(check_effective_target_has_arch_pwr6): Ditto.
(check_effective_target_has_arch_pwr7): Ditto.
(check_effective_target_has_arch_pwr8): Ditto.
(check_effective_target_has_arch_pwr9): Ditto.
(check_effective_target_has_arch_pwr10): Ditto.
(check_effective_target_has_arch_ppc64): Ditto.

2 years agoifcvt: Improve noce_try_store_flag_mask [PR105314]
Jakub Jelinek [Tue, 26 Apr 2022 08:11:58 +0000 (10:11 +0200)] 
ifcvt: Improve noce_try_store_flag_mask [PR105314]

The following testcase regressed on riscv due to the splitting of critical
edges in the sink pass, similarly to x86_64 compared to GCC 11 we now swap
the edges, whether true or false edge goes to an empty forwarded bb.
From GIMPLE POV, those 2 forms are equivalent, but as can be seen here, for
some ifcvt opts it matters one way or another.

On this testcase, noce_try_store_flag_mask used to trigger and transformed
if (pseudo2) pseudo1 = 0;
into
pseudo1 &= -(pseudo2 == 0);
But with the swapped edges ifcvt actually sees
if (!pseudo2) pseudo3 = pseudo1; else pseudo3 = 0;
and noce_try_store_flag_mask punts.  IMHO there is no reason why it
should punt those, it is equivalent to
pseudo3 = pseudo1 & -(pseudo2 == 0);
and especially if the target has 3 operand AND, it shouldn't be any more
costly (and even with 2 operand AND, it might very well happen that RA
can make it happen without any extra moves).

Initially I've just removed the rtx_equal_p calls from the conditions
and didn't add anything there, but that broke aarch64 bootstrap and
regressed some testcases on x86_64, where if_info->a or if_info->b could be
some larger expression that we can't force into a register.
Furthermore, the case where both if_info->a and if_info->b are constants is
better handled by other ifcvt optimizations like noce_try_store_flag
or noce_try_inverse_constants or noce_try_store_flag_constants.
So, I've restricted it to just a REG (perhaps SUBREG of REG might be ok too)
next to what has been handled previously.

2022-04-26  Jakub Jelinek  <jakub@redhat.com>

PR rtl-optimization/105314
* ifcvt.cc (noce_try_store_flag_mask): Don't require that the non-zero
operand is equal to if_info->x, instead use the non-zero operand
as one of the operands of AND with if_info->x as target.

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

2 years agoreassoc: Don't call fold_convert if !fold_convertible_p [PR105374]
Jakub Jelinek [Tue, 26 Apr 2022 07:57:34 +0000 (09:57 +0200)] 
reassoc: Don't call fold_convert if !fold_convertible_p [PR105374]

As mentioned in the PR, we ICE because maybe_fold_*_comparisons returns
an expression with V4SImode type and we try to fold_convert it to
V4BImode, which isn't allowed.

IMHO no matter whether we change maybe_fold_*_comparisons we should
play safe on the reassoc side and punt if we can't convert like
we punt for many other reasons.  This fixes the testcase on ARM.

Testcase not included, not exactly sure where and what directives it
should have in gcc.target/arm/ testsuite.  Christophe, do you think you
could handle that incrementally?

2022-04-26  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/105374
* tree-ssa-reassoc.cc (eliminate_redundant_comparison): Punt if
!fold_convertible_p rather than assuming fold_convert must succeed.

2 years agotestsuite: Fix up g++.target/i386/vec-tmpl1.C testcase [PR65211]
Jakub Jelinek [Tue, 26 Apr 2022 07:52:22 +0000 (09:52 +0200)] 
testsuite: Fix up g++.target/i386/vec-tmpl1.C testcase [PR65211]

This test fails on i686-linux:
Excess errors:
.../gcc/testsuite/g++.target/i386/vec-tmpl1.C:13:27: warning: SSE vector return without SSE enabled changes the ABI [-Wpsabi]

2022-04-26  Jakub Jelinek  <jakub@redhat.com>

PR c++/65211
* g++.target/i386/vec-tmpl1.C: Add -Wno-psabi as
dg-additional-options.

2 years agoi386: Fix up ICE with -mveclibabi={acml,svml} [PR105367]
Jakub Jelinek [Tue, 26 Apr 2022 07:40:03 +0000 (09:40 +0200)] 
i386: Fix up ICE with -mveclibabi={acml,svml} [PR105367]

The following testcase ICEs, because conversion between scalar float types
which have the same mode are useless in GIMPLE, but for mathfn_built_in the
exact type matters (it treats say double and _Float64 or float and _Float32
differently, using different suffixes and for the _Float* sometimes
returning NULL when float/double do have a builtin).

In ix86_veclibabi_{svml,acml} we are using mathfn_built_in just so that
we don't have to translate the combined_fn and SFmode vs. DFmode into
strings ourselfs, and we already earlier punt on anything but SFmode and
DFmode.  So, this patch just uses the double or float types depending
on the modes, rather than the types we actually got and which might be
_Float64 or _Float32 etc.

2022-04-26  Jakub Jelinek  <jakub@redhat.com>

PR target/105367
* config/i386/i386.cc (ix86_veclibabi_svml, ix86_veclibabi_acml): Pass
el_mode == DFmode ? double_type_node : float_type_node instead of
TREE_TYPE (type_in) as first arguments to mathfn_built_in.

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

2 years agotestsuite: Improve unlimited_polymorphic_3.f03 [PR103662]
Jakub Jelinek [Tue, 26 Apr 2022 07:17:32 +0000 (09:17 +0200)] 
testsuite: Improve unlimited_polymorphic_3.f03 [PR103662]

On Mon, Apr 25, 2022 at 01:38:25PM +0200, Mikael Morin wrote:
> I have just pushed the attached fix for two UNRESOLVED checks at -O0 that I
> hadn’t seen.

I don't like forcing of DSE in -O0 compilation, wouldn't it be better
to just not check the dse dump at -O0 like in the following patch?

Even better would be to check that the z._data = stores are both present
in *.optimized dump, but that doesn't really work at -O2 or above because
we inline the functions and optimize it completely away (both the stores
and corresponding reads).

The first hunk is needed so that __OPTIMIZE__ effective target works in
Fortran testsuite, otherwise one gets a pedantic error and __OPTIMIZE__
is considered not to match at all.

2022-04-26  Jakub Jelinek  <jakub@redhat.com>

PR fortran/103662
* lib/target-supports.exp (check_effective_target___OPTIMIZE__): Add
a var definition to avoid pedwarn about empty translation unit.
* gfortran.dg/unlimited_polymorphic_3.f03: Remove -ftree-dse from
dg-additional-options, guard scan-tree-dump-not directives on
__OPTIMIZE__ target.

2 years agolibgomp: Fix up two non-GOMP_USE_ALIGNED_WORK_SHARES related issues [PR105358]
Jakub Jelinek [Tue, 26 Apr 2022 06:57:17 +0000 (08:57 +0200)] 
libgomp: Fix up two non-GOMP_USE_ALIGNED_WORK_SHARES related issues [PR105358]

Last fall I've changed struct gomp_work_share, so that it doesn't have
__attribute__((aligned (64))) lock member in the middle unless the target has
non-emulated aligned allocator, otherwise it just makes sure the first and
second halves are 64 bytes appart for cache line reasons, but doesn't make
the struct 64-byte aligned itself and so we can use normal allocators for it.

When the struct isn't 64-byte aligned, the amount of tail padding significantly
decreases, to 0 or 4 bytes or so.  The library uses that tail padding when
the ordered_teams_ids array (array of uints) and/or the memory for lastprivate
conditional temporaries (the latter wants to guarantee long long alignment).
The problem with it on ia32 darwin9 is that while the struct contains
long long members, long long is just 4 byte aligned while __alignof__(long long)
is 8.  That causes problems in gomp_init_work_share, where we currently rely on
if offsetof (struct gomp_work_share, inline_ordered_team_ids) is long long
aligned, then that tail array will be aligned at runtime and so no extra
memory for dynamic realignment will be needed (that is false when the whole
struct doesn't have long long alignment).  And also in the remaining hunks
causes another problem, where we compute INLINE_ORDERED_TEAM_IDS_OFF
as the above offsetof aligned up to long long boundary and subtract
sizeof (struct gomp_work_share) and INLINE_ORDERED_TEAM_IDS_OFF.
When unlucky, the former isn't multiple of 8 and the latter is 4 bigger
than that and as the subtraction is done in size_t, we end up with (size_t) -4,
so the comparison doesn't really work.

The fixes add additional conditions to make it work properly, but all of them
should be evaluated at compile time when optimizing and so shouldn't slow
anything.

2022-04-26  Jakub Jelinek  <jakub@redhat.com>

PR libgomp/105358
* work.c (gomp_init_work_share): Don't mask of adjustment for
dynamic long long realignment if struct gomp_work_share has smaller
alignof than long long.
* loop.c (GOMP_loop_start): Don't use inline_ordered_team_ids if
struct gomp_work_share has smaller alignof than long long or if
sizeof (struct gomp_work_share) is smaller than
INLINE_ORDERED_TEAM_IDS_OFF.
* loop_ull.c (GOMP_loop_ull_start): Likewise.
* sections.c (GOMP_sections2_start): Likewise.

2 years agoc++: generic lambda fn parm pack [PR104624]
Jason Merrill [Thu, 21 Apr 2022 21:24:07 +0000 (17:24 -0400)] 
c++: generic lambda fn parm pack [PR104624]

Parameter packs from the enclosing context can be used unexpanded in a
lambda that is itself part of a pack expansion, but not packs that are part
of the lambda itself.  We already check for capture packs; we also need to
check for function parameter packs of the lambda call operator.

PR c++/104624

gcc/cp/ChangeLog:

* pt.cc (check_for_bare_parameter_packs): Check for lambda
function parameter pack.

gcc/testsuite/ChangeLog:

* g++.dg/cpp1y/lambda-generic-variadic22.C: New test.

2 years agoc++: ICE with requires-expr and -Wsequence-point [PR105304]
Patrick Palka [Tue, 26 Apr 2022 01:49:00 +0000 (21:49 -0400)] 
c++: ICE with requires-expr and -Wsequence-point [PR105304]

Here we're crashing from verify_sequence_points for this requires-expr
condition because it contains a templated CAST_EXPR with empty operand,
and verify_tree doesn't ignore this empty operand only because the
manual tail recursion that it performs for unary expression trees skips
the NULL test.

PR c++/105304

gcc/c-family/ChangeLog:

* c-common.cc (verify_tree) [restart]: Move up to before the
NULL test.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/concepts-requires30.C: New test.

2 years agoc++: partial ordering with dependent NTTP type [PR105289]
Patrick Palka [Tue, 26 Apr 2022 01:46:56 +0000 (21:46 -0400)] 
c++: partial ordering with dependent NTTP type [PR105289]

Here ever since r11-6483-ge2e2f3f2c9400f we're rejecting and crashing
on (respectively) two testcases that we used to accept in C++17 mode
since r8-1437-g3da557ec145823.  Both testcases declare a partial
specialization of a primary template that has an NTTP with dependent
type, and the validity of these partial specializations is unclear and
the subject of PR86193 / CWG 455.

So for now, this minimal patch just aims to fix the crash in the second
testcase.  During deduction, when checking whether the type of an NTTP
uses still-undeduced parameters, we were incorrectly substituting into
the previously substituted type instead of into its original type.

In passing this patch also downgrades the "not more specialized"
diagnostic from a permerror to a pedwarn.

PR c++/105289
PR c++/86193

gcc/cp/ChangeLog:

* pt.cc (process_partial_specialization): Downgrade "partial
specialization isn't more specialized" diagnostic from permerror
to an on-by-default pedwarn.
(unify) <case TEMPLATE_PARM_INDEX>: When substituting into the
NTTP type a second time, use the original type not the
substituted type.

gcc/testsuite/ChangeLog:

* g++.dg/template/partial-specialization11.C: New test.
* g++.dg/template/partial-specialization12.C: New test.

2 years agoDaily bump.
GCC Administrator [Tue, 26 Apr 2022 00:16:51 +0000 (00:16 +0000)] 
Daily bump.

2 years agoanalyzer: fix ICEs on complex constants [PR105365,105366]
David Malcolm [Mon, 25 Apr 2022 23:36:37 +0000 (19:36 -0400)] 
analyzer: fix ICEs on complex constants [PR105365,105366]

gcc/analyzer/ChangeLog:
PR analyzer/105365
PR analyzer/105366
* svalue.cc
(cmp_cst): Rename to...
(cmp_csts_same_type): ...this.  Convert all recursive calls to
calls to...
(cmp_csts_and_types): ....this new function.
(svalue::cmp_ptr): Update for renaming of cmp_cst

gcc/testsuite/ChangeLog:
PR analyzer/105365
PR analyzer/105366
* gcc.dg/analyzer/pr105365.c: New test.
* gcc.dg/analyzer/pr105366.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2 years agogimple-fold: fix further missing stmt locations [PR104308]
David Malcolm [Mon, 25 Apr 2022 23:34:33 +0000 (19:34 -0400)] 
gimple-fold: fix further missing stmt locations [PR104308]

PR analyzer/104308 initially reported about a
-Wanalyzer-use-of-uninitialized-value diagnostic using UNKNOWN_LOCATION
when complaining about certain memmove operations where the source
is uninitialized.

In r12-7856-g875342766d4298 I fixed the missing location for
a stmt generated by gimple_fold_builtin_memory_op, but the reporter
then found another way to generate such a stmt with UNKNOWN_LOCATION.

I've now gone through gimple_fold_builtin_memory_op looking at all
statement creation, and found three places in which a new statement
doesn't have a location set on it (either directly via
gimple_set_location, or indirectly via gsi_replace), one of which is
the new reproducer.

This patch adds a gimple_set_location to these three cases, and adds
test coverage for one of them (the third hunk within the patch), fixing
the new reproducer for PR analyzer/104308.

gcc/ChangeLog:
PR analyzer/104308
* gimple-fold.cc (gimple_fold_builtin_memory_op): Explicitly set
the location of new_stmt in all places that don't already set it,
whether explicitly, or via a call to gsi_replace.

gcc/testsuite/ChangeLog:
PR analyzer/104308
* gcc.dg/analyzer/pr104308.c: Add test coverage.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2 years agofortran: Fix up gfc_trans_oacc_construct [PR104717]
Jakub Jelinek [Wed, 20 Apr 2022 17:06:17 +0000 (19:06 +0200)] 
fortran: Fix up gfc_trans_oacc_construct [PR104717]

So that move_sese_region_to_fn works properly, OpenMP/OpenACC constructs
for which that function is invoked need an extra artificial BIND_EXPR
around their body so that we move all variables of the bodies.

The C/C++ FEs do that both for OpenMP constructs like OMP_PARALLEL, OMP_TASK
or OMP_TARGET and for OpenACC constructs that behave similarly to
OMP_TARGET, but the Fortran FE only does that for OpenMP constructs.

The following patch does that for OpenACC constructs too.

PR fortran/104717
gcc/fortran/
* trans-openmp.cc (gfc_trans_oacc_construct): Wrap construct body
in an extra BIND_EXPR.
gcc/testsuite/
* gfortran.dg/goacc/pr104717.f90: New test.
* gfortran.dg/goacc/privatization-1-compute-loop.f90: Adjust.
libgomp/
* testsuite/libgomp.oacc-fortran/privatized-ref-2.f90: Adjust.

Co-authored-by: Thomas Schwinge <thomas@codesourcery.com>
2 years agocontrib: filter out a new Clang warning
Martin Liska [Mon, 25 Apr 2022 20:26:27 +0000 (22:26 +0200)] 
contrib: filter out a new Clang warning

Filter out:
libcpp/lex.cc:1289:7: warning: use of the 'likely' attribute is a C++20 extension [-Wc++20-attribute-extensions]

contrib/ChangeLog:

* filter-clang-warnings.py: Filter out
-Wc++20-attribute-extensions in lex.cc.

2 years agolibstdc++: Implement constexpr std::unique_ptr for C++23 (P2273R3)
Jonathan Wakely [Mon, 25 Apr 2022 13:24:48 +0000 (14:24 +0100)] 
libstdc++: Implement constexpr std::unique_ptr for C++23 (P2273R3)

libstdc++-v3/ChangeLog:

* include/bits/ptr_traits.h (__cpp_lib_constexpr_memory): Define
conditionally.
* include/bits/unique_ptr.h (__cpp_lib_constexpr_memory):
Define for C++23.
(default_delete, default_delete<T[]>, __uniq_ptr_impl)
(unique_ptr, unique_ptr<T[], D>): Add constexpr to all member
functions.
* include/std/version (__cpp_lib_constexpr_memory): Define new
value for C++23.
* testsuite/20_util/unique_ptr/assign/constexpr.cc: New test.
* testsuite/20_util/unique_ptr/comparison/constexpr.cc: New test.
* testsuite/20_util/unique_ptr/cons/constexpr_c++20.cc: New test.
* testsuite/20_util/unique_ptr/creation/constexpr.cc: New test.
* testsuite/20_util/unique_ptr/modifiers/constexpr.cc: New test.
* testsuite/20_util/unique_ptr/specialized_algorithms/constexpr.cc:
New test.

2 years agolibstdc++: Add deduction guides for std::packaged_task [PR105375]
Jonathan Wakely [Mon, 25 Apr 2022 13:22:41 +0000 (14:22 +0100)] 
libstdc++: Add deduction guides for std::packaged_task [PR105375]

This change was LWG 3117.

The test is copied from 20_util/function/cons/deduction.cc

libstdc++-v3/ChangeLog:

PR libstdc++/105375
* include/std/future (packaged_task): Add deduction guides.
* testsuite/30_threads/packaged_task/cons/deduction.cc: New test.

2 years agoc++: __builtin_shufflevector with value-dep expr [PR105353]
Marek Polacek [Fri, 22 Apr 2022 23:40:27 +0000 (19:40 -0400)] 
c++: __builtin_shufflevector with value-dep expr [PR105353]

Here we issue an error from c_build_shufflevector while parsing a template
because it got a TEMPLATE_PARM_INDEX, but this function expects INTEGER_CSTs
(except the first two arguments).  It checks if any of the arguments are
type-dependent, if so, we leave the processing for later, but it should
also check value-dependency for the 3rd+ arguments, so as to avoid the
problem above.

This is not a regression -- __builtin_shufflevector was introduced in
GCC 12, but it looks safe enough.

PR c++/105353

gcc/cp/ChangeLog:

* typeck.cc (build_x_shufflevector): Use
instantiation_dependent_expression_p except for the first two
arguments.

gcc/testsuite/ChangeLog:

* g++.dg/ext/builtin-shufflevector-3.C: New test.

2 years agodocs: Fix 'modff' reference in extend.texi
Paul A. Clarke [Mon, 11 Apr 2022 16:18:28 +0000 (11:18 -0500)] 
docs: Fix 'modff' reference in extend.texi

In commit a2a919aa501e3 (2003), built-ins for modf and modff were added.
In extend.texi, section "Other Builtins", "modf" was added to the paragraph
"There are also built-in versions of the ISO C99 functions [...]" and
"modf" was also added to the paragraph "The ISO C90 functions [...]".
"modff" was not added to either paragraph.

Based on the context clues about where "modfl" and other similar function
pairs like "powf/powl" appear, I believe the reference to "modf" in the
first paragraph (C99) should instead be "modff".

2022-04-25  Paul A. Clarke  <pc@us.ibm.com>

gcc
* doc/extend.texi (Other Builtins): Correct reference to 'modff'.

2 years agoRetain existing range knowledge when prefilling statements.
Andrew MacLeod [Mon, 25 Apr 2022 13:56:35 +0000 (09:56 -0400)] 
Retain existing range knowledge when prefilling statements.

When range_of_stmt was adjusted to avoid large recursion depth, we need to
intersect the calculated range whth the any known range to avoid losing
info.  Range_of_stmt does this, but the new prefill code missed it.

PR tree-optimization/105276
gcc/
* gimple-range.cc (gimple_ranger::prefill_stmt_dependencies): Include
existing global range with calculated value.

gcc/testsuite/
* g++.dg/pr105276.C: New.

2 years agocontrib: filter out a new Clang warning
Martin Liska [Mon, 25 Apr 2022 13:42:09 +0000 (15:42 +0200)] 
contrib: filter out a new Clang warning

contrib/ChangeLog:

* filter-clang-warnings.py: Filter out
-Wbitwise-instead-of-logical.

2 years agolibstdc++: Add pretty printer for std::initializer_list
Philipp Fent [Mon, 25 Apr 2022 12:03:31 +0000 (13:03 +0100)] 
libstdc++: Add pretty printer for std::initializer_list

Re-using the std::span printer, this now shows the contents of the
initializer list instead of the pointer and length members.

Signed-off-by: Philipp Fent <fent@in.tum.de>
libstdc++-v3/ChangeLog:

* python/libstdcxx/v6/printers.py (StdSpanPrinter._iterator):
Rename as iterator.
(StdInitializerListPrinter): Define new printer.
(build_libstdcxx_dictionary): Register new printer.
* testsuite/libstdc++-prettyprinters/cxx11.cc: Check printer for
initializer_list.

2 years agotestsuite: add additional option to force DSE execution [PR103662]
Mikael Morin [Mon, 25 Apr 2022 11:14:20 +0000 (13:14 +0200)] 
testsuite: add additional option to force DSE execution [PR103662]

This fixes a dump tree match check that is UNRESOLVED with the -O0
optimization option, as the optimization pass corresponding to the
dump file is not run at -O0, and the dump is not generated.

PR fortran/103662

gcc/testsuite/ChangeLog:

* gfortran.dg/unlimited_polymorphic_3.f03: Force execution of
the DSE optimization pass.

2 years agotree-optimization/105368 - avoid overflow in powi_cost
Richard Biener [Mon, 25 Apr 2022 08:55:21 +0000 (10:55 +0200)] 
tree-optimization/105368 - avoid overflow in powi_cost

The following avoids undefined signed overflow when computing
the absolute of the exponent in powi_cost.

2022-04-25  Richard Biener  <rguenther@suse.de>

PR tree-optimization/105368
* tree-ssa-math-opts.cc (powi_cost): Use absu_hwi.

2 years agotree-optimization/100810 - avoid undefs in IVOPT rewrites
Richard Biener [Fri, 1 Apr 2022 09:30:00 +0000 (11:30 +0200)] 
tree-optimization/100810 - avoid undefs in IVOPT rewrites

The following attempts to avoid IVOPTs rewriting uses using
IV candidates that involve undefined behavior by using uninitialized
SSA names.  First we restrict the set of candidates we produce
for such IVs to the original ones and mark them as not important.
Second we try to only allow expressing uses with such IV if they
originally use them.  That is to avoid rewriting all such uses
in terms of other IVs.  Since cand->iv and use->iv seem to never
exactly match up we resort to comparing the IV bases.

The approach ends up similar to the one posted by Roger at
https://gcc.gnu.org/pipermail/gcc-patches/2021-August/578441.html
but it marks IV candidates rather than use groups and the cases
we allow in determine_group_iv_cost_generic are slightly different.

2022-01-04  Richard Biener  <rguenther@suse.de>

PR tree-optimization/100810
* tree-ssa-loop-ivopts.cc (struct iv_cand): Add involves_undefs flag.
(find_ssa_undef): New function.
(add_candidate_1): Avoid adding derived candidates with
undefined SSA names and mark the original ones.
(determine_group_iv_cost_generic): Reject rewriting
uses with a different IV when that involves undefined SSA names.

* gcc.dg/torture/pr100810.c: New testcase.
* gcc.dg/torture/pr105337.c: Likewise.

2 years agotarget/89125 - BSD and math functions
Steve Kargl [Mon, 25 Apr 2022 07:23:56 +0000 (09:23 +0200)] 
target/89125 - BSD and math functions

Back story: When GCC is configured and built on non-glibc platforms,
it seems very little to no effort is made to enumerate the available
C99 libm functions.  It is all or nothing for C99 libm.  The patch
introduces a new function, used on only FreeBSD, to inform gcc that
it has C99 libm functions (minus a few which clearly GCC does not check
nor test).

2022-04-15  Steven G. Kargl  <kargl@gcc.gnu.org>

PR target/89125
* config/freebsd.h: Define TARGET_LIBC_HAS_FUNCTION to be
bsd_libc_has_function.
* targhooks.cc (bsd_libc_has_function): New function.
Expand the supported math functions to inclue C99 libm.
* targhooks.h (bsd_libc_has_function): New Prototype.