]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
2 years agonvptx: Support global constructors/destructors via 'collect2' for offloading
Thomas Schwinge [Wed, 30 Nov 2022 21:09:35 +0000 (22:09 +0100)] 
nvptx: Support global constructors/destructors via 'collect2' for offloading

This extends "nvptx: Support global constructors/destructors via 'collect2'"
for offloading.

libgcc/
* config/nvptx/crtstuff.c ["mgomp"]
(__do_global_ctors__entry__mgomp)
(__do_global_dtors__entry__mgomp): New.
[!"mgomp"] (__do_global_ctors__entry, __do_global_dtors__entry):
New.
libgomp/
* plugin/plugin-nvptx.c (nvptx_do_global_cdtors): New.
(nvptx_close_device, GOMP_OFFLOAD_load_image)
(GOMP_OFFLOAD_unload_image): Call it.

2 years agonvptx: Support global constructors/destructors via 'collect2'
Thomas Schwinge [Sun, 13 Nov 2022 13:19:30 +0000 (14:19 +0100)] 
nvptx: Support global constructors/destructors via 'collect2'

The function attributes 'constructor', 'destructor', and 'init_priority' now
work, as do the C++ features making use of this.  Test cases with effective
target 'global_constructor' and 'init_priority' now generally work, and
'check-gcc-c++' test results greatly improve; no more "sorry, unimplemented:
global constructors not supported on this target".

This depends on <https://github.com/MentorEmbedded/nvptx-tools/pull/40> "'nm'"
generally, and for global destructors support: newlib
<https://inbox.sourceware.org/newlib/878rjqaku5.fsf@dem-tschwing-1.ger.mentorg.com/>
"nvptx: Implement '_exit' instead of 'exit'".

gcc/
* collect2.cc (write_c_file_glob): Allow for
'COLLECT2_MAIN_REFERENCE' override.
* config.gcc <case ${target} in nvptx-*>: Set 'use_collect2=yes'.
* config/nvptx/nvptx.h: Adjust.
gcc/testsuite/
* gcc.dg/no_profile_instrument_function-attr-1.c: GCC/nvptx is
'NO_DOT_IN_LABEL' but not 'NO_DOLLAR_IN_LABEL', so '$' may apper
in identifiers.
* lib/target-supports.exp
(check_effective_target_global_constructor): Enable for nvptx.
libgcc/
* config.host <case ${host} in nvptx-*>: Add 'crtbegin.o',
'crtend.o' to 'extra_parts'.
* config/nvptx/crt0.c: Invoke '__do_global_ctors',
'__do_global_dtors'.
* config/nvptx/crtstuff.c: New.
* config/nvptx/t-nvptx: Adjust.

2 years agonvptx: Prevent emitting duplicate declarations for '__nvptx_stacks', '__nvptx_uni'
Thomas Schwinge [Mon, 19 Dec 2022 16:19:19 +0000 (17:19 +0100)] 
nvptx: Prevent emitting duplicate declarations for '__nvptx_stacks', '__nvptx_uni'

As I have reported to Nvidia in 2022-12-01 'NVIDIA Incident Report (3891704):
ptxas: Duplicate declaration error: "cannot be resolved by a '.static'"',
'ptxas' has an inscrutable error mode for duplicate declarations:

    ptxas softstack-decl-1.o, line 11; error   : '.extern' variable '__nvptx_stacks' cannot be resolved by a '.static'
    ptxas fatal   : Ptx assembly aborted due to errors
    nvptx-as: ptxas returned 255 exit status

    ptxas uniform-simt-decl-1.o, line 12; error   : '.extern' variable '__nvptx_uni' cannot be resolved by a '.static'
    ptxas fatal   : Ptx assembly aborted due to errors
    nvptx-as: ptxas returned 255 exit status

This is inscrutable, because (a) what is "cannot be resolved by a '.static'"
supposed to tell me (there is no '.static' in PTX?), and (b) why arent't
repeated declaration just verified to match the first, but otherwise a no-op
(like in other programming languages)?

gcc/
* config/nvptx/nvptx.cc (nvptx_assemble_undefined_decl): Notice
'__nvptx_stacks', '__nvptx_uni' declarations.
(nvptx_file_end): Don't emit duplicate declarations for those.
gcc/testsuite/
* gcc.target/nvptx/softstack-decl-1.c: Make 'dg-do assemble',
adjust.
* gcc.target/nvptx/uniform-simt-decl-1.c: Likewise.

2 years agoAdd 'gcc.target/nvptx/softstack-decl-1.c', 'gcc.target/nvptx/uniform-simt-decl-1.c'
Thomas Schwinge [Mon, 19 Dec 2022 16:10:52 +0000 (17:10 +0100)] 
Add 'gcc.target/nvptx/softstack-decl-1.c', 'gcc.target/nvptx/uniform-simt-decl-1.c'

... to document the status quo re implicit (via 'need_softstack_decl',
'need_unisimt_decl') and explicit declarations of '__nvptx_stacks',
'__nvptx_uni'.

gcc/testsuite/
* gcc.target/nvptx/softstack-decl-1.c: New.
* gcc.target/nvptx/uniform-simt-decl-1.c: Likewise.

2 years agonvptx: Make 'nvptx_uniform_warp_check' fit for non-full-warp execution
Thomas Schwinge [Mon, 12 Dec 2022 21:05:37 +0000 (22:05 +0100)] 
nvptx: Make 'nvptx_uniform_warp_check' fit for non-full-warp execution

For example, this allows for '-muniform-simt' code to be executed
single-threaded, which currently fails (device-side 'trap'), as the 0xffffffff
mask isn't correct if not all 32 threads of a warp are active.  The same
issue/fix, I suppose but have not verified, would apply if we were to allow for
OpenACC 'vector_length' smaller than 32, for example for OpenACC 'serial'.

We use 'nvptx_uniform_warp_check' only for PTX ISA version less than 6.0.
Otherwise we're using 'nvptx_warpsync', which emits 'bar.warp.sync 0xffffffff',
which evidently appears to do the right thing.  (I've tested '-muniform-simt'
code executing single-threaded.)

gcc/
* config/nvptx/nvptx.md (nvptx_uniform_warp_check): Make fit for
non-full-warp execution.
gcc/testsuite/
* gcc.target/nvptx/nvptx.exp
(check_effective_target_default_ptx_isa_version_at_least_6_0):
New.
* gcc.target/nvptx/uniform-simt-5.c: New.
libgomp/
* plugin/plugin-nvptx.c (nvptx_exec): Assert what we know about
'blockDimX'.

2 years agoClean up after newlib "nvptx: In offloading execution, map '_exit' to 'abort' [GCC...
Thomas Schwinge [Thu, 19 Jan 2023 19:25:45 +0000 (20:25 +0100)] 
Clean up after newlib "nvptx: In offloading execution, map '_exit' to 'abort' [GCC PR85463]"

PR target/85463
libgfortran/
* runtime/minimal.c [__nvptx__] (exit): Don't override.
libgomp/
* config/nvptx/error.c (exit): Don't override.
* testsuite/libgomp.oacc-fortran/error_stop-1.f: Update.
* testsuite/libgomp.oacc-fortran/error_stop-2.f: Likewise.
* testsuite/libgomp.oacc-fortran/error_stop-3.f: Likewise.
* testsuite/libgomp.oacc-fortran/stop-1.f: Likewise.
* testsuite/libgomp.oacc-fortran/stop-2.f: Likewise.
* testsuite/libgomp.oacc-fortran/stop-3.f: Likewise.

2 years agoFix 'libgomp.c/simd-math-1.c' configuration, again
Thomas Schwinge [Fri, 20 Jan 2023 16:17:21 +0000 (17:17 +0100)] 
Fix 'libgomp.c/simd-math-1.c' configuration, again

Tobias pointed out that as of my recent
og12 commit e7d4bcb974915bfe95be6c385641fc66a4201581
"Fix 'libgomp.c/simd-math-1.c' configuration",
in GCC configurations without GCN offloading configured, we'd get:

    xgcc: error: GCC is not configured to support 'amdgcn-amdhsa' as '-foffload=' argument

("Interestingly", GCC doesn't complain for '-foffload-options=-lm' if there are
no offload targets configured...)

libgomp/
* testsuite/libgomp.c/simd-math-1.c: Fix configuration, again.

2 years agoForce '--param openacc-kernels=parloops' in 'libgomp.oacc-c-c++-common/abort-3.c'
Thomas Schwinge [Tue, 17 Jan 2023 08:56:15 +0000 (09:56 +0100)] 
Force '--param openacc-kernels=parloops' in 'libgomp.oacc-c-c++-common/abort-3.c'

libgomp/
* testsuite/libgomp.oacc-c-c++-common/abort-3.c: Force
'--param openacc-kernels=parloops'.

2 years agoFix 'libgomp.c/simd-math-1.c' configuration
Thomas Schwinge [Sat, 14 Jan 2023 09:28:09 +0000 (10:28 +0100)] 
Fix 'libgomp.c/simd-math-1.c' configuration

If nvptx offloading is configured in addition to GCN, we see:

    FAIL: libgomp.c/simd-math-1.c (test for excess errors)
    UNRESOLVED: libgomp.c/simd-math-1.c compilation failed to produce executable

    x86_64-pc-linux-gnu-accel-nvptx-none-gcc: error: unrecognized command-line option '-mstack-size=3000000'

Thus, restrict that ooption to GCN offloading compilation, and on the other
hand, there's no reason to skip this test for non-GCN offloading execution:
even if not SIMD-vectorized there, we still benefit from correctness testing.

libgomp/
* testsuite/libgomp.c/simd-math-1.c: Fix configuration.

2 years agoMerge branch 'releases/gcc-12' into devel/omp/gcc-12
Tobias Burnus [Thu, 19 Jan 2023 20:23:08 +0000 (21:23 +0100)] 
Merge branch 'releases/gcc-12' into devel/omp/gcc-12

Merge up to r12-9052-g61ef24af3ce8ec9c5eb65770f8047d98f42a93bf (19th Jan 2023)

2 years agoopenmp: Fix up OpenMP expansion of non-rectangular loops [PR108459]
Jakub Jelinek [Thu, 19 Jan 2023 20:22:22 +0000 (21:22 +0100)] 
openmp: Fix up OpenMP expansion of non-rectangular loops [PR108459]

expand_omp_for_init_counts was using for the case where collapse(2)
inner loop has init expression dependent on non-constant multiple of
the outer iterator and the condition upper bound expression doesn't
depend on the outer iterator fold_unary (NEGATE_EXPR, ...).  This
will just return NULL if it can't be folded, we need fold_build1
instead.

2023-01-19  Jakub Jelinek  <jakub@redhat.com>

PR middle-end/108459
* omp-expand.cc (expand_omp_for_init_counts): Use fold_build1 rather
than fold_unary for NEGATE_EXPR.

* testsuite/libgomp.c/pr108459.c: New test.

(cherry picked from commit 46644ec99cb355845b23bb1d02775c057ed8ee88)

2 years agoDaily bump.
GCC Administrator [Thu, 19 Jan 2023 00:21:17 +0000 (00:21 +0000)] 
Daily bump.

2 years agolibstdc++: Avoid recursion in __nothrow_wait_cv::wait [PR105730]
Jonathan Wakely [Thu, 22 Dec 2022 09:56:47 +0000 (09:56 +0000)] 
libstdc++: Avoid recursion in __nothrow_wait_cv::wait [PR105730]

The commit r12-5877-g9e18a25331fa25 removed the incorrect
noexcept-specifier from std::condition_variable::wait and gave the new
symbol version @@GLIBCXX_3.4.30. It also redefined the original symbol
std::condition_variable::wait(unique_lock<mutex>&)@GLIBCXX_3.4.11 as an
alias for a new symbol, __gnu_cxx::__nothrow_wait_cv::wait, which still
has the incorrect noexcept guarantee. That __nothrow_wait_cv::wait is
just a wrapper around the real condition_variable::wait which adds
noexcept and so terminates on a __forced_unwind exception.

This doesn't work on uclibc, possibly due to a dynamic linker bug. When
__nothrow_wait_cv::wait calls the condition_variable::wait function it
binds to the alias symbol, which means it just calls itself recursively
until the stack overflows.

This change avoids the possibility of a recursive call by changing the
__nothrow_wait_cv::wait function so that instead of calling
condition_variable::wait it re-implements it. This requires accessing
the private _M_cond member of condition_variable, so we need to use the
trick of instantiating a template with the member-pointer of the private
member.

libstdc++-v3/ChangeLog:

PR libstdc++/105730
* src/c++11/compatibility-condvar.cc (__nothrow_wait_cv::wait):
Access private data member of base class and call its wait
member.

(cherry picked from commit ee4af2ed0b7322884ec4ff537564683c3749b813)

2 years agoDaily bump.
GCC Administrator [Wed, 18 Jan 2023 00:21:32 +0000 (00:21 +0000)] 
Daily bump.

2 years agolibgomp: Add forgotten Changelog.omp entries
Andrew Stubbs [Tue, 17 Jan 2023 11:22:21 +0000 (11:22 +0000)] 
libgomp: Add forgotten Changelog.omp entries

2 years agoDaily bump.
GCC Administrator [Tue, 17 Jan 2023 00:21:46 +0000 (00:21 +0000)] 
Daily bump.

2 years agoAdd cpplib ka.po
Joseph Myers [Mon, 16 Jan 2023 22:44:28 +0000 (22:44 +0000)] 
Add cpplib ka.po

* ka.po: New.

2 years agolibstdc++: Unblock atomic wait on non-futex platforms [PR106183]
Jonathan Wakely [Thu, 28 Jul 2022 15:15:58 +0000 (16:15 +0100)] 
libstdc++: Unblock atomic wait on non-futex platforms [PR106183]

When using a mutex and condition variable, the notifying thread needs to
increment _M_ver while holding the mutex lock, and the waiting thread
needs to re-check after locking the mutex. This avoids a missed
notification as described in the PR.

By moving the increment of _M_ver to the base _M_notify we can make the
use of the mutex local to the use of the condition variable, and
simplify the code a little. We can use a relaxed store because the mutex
already provides sequential consistency. Also we don't need to check
whether __addr == &_M_ver because we know that's always true for
platforms that use a condition variable, and so we also know that we
always need to use notify_all() not notify_one().

Reviewed-by: Thomas Rodgers <trodgers@redhat.com>
libstdc++-v3/ChangeLog:

PR libstdc++/106183
* include/bits/atomic_wait.h (__waiter_pool_base::_M_notify):
Move increment of _M_ver here.
[!_GLIBCXX_HAVE_PLATFORM_WAIT]: Lock mutex around increment.
Use relaxed memory order and always notify all waiters.
(__waiter_base::_M_do_wait) [!_GLIBCXX_HAVE_PLATFORM_WAIT]:
Check value again after locking mutex.
(__waiter_base::_M_notify): Remove increment of _M_ver.

(cherry picked from commit af98cb88eb4be6a1668ddf966e975149bf8610b1)

2 years agoFortran/OpenMP: Reject non-scalar 'holds' expr in 'omp assume(s)' [PR107706]
Tobias Burnus [Mon, 16 Jan 2023 11:37:41 +0000 (12:37 +0100)] 
Fortran/OpenMP: Reject non-scalar 'holds' expr in 'omp assume(s)' [PR107706]

gcc/fortran/ChangeLog:

PR fortran/107706
* openmp.cc (gfc_resolve_omp_assumptions): Reject nonscalars.

gcc/testsuite/ChangeLog:

PR fortran/107706
* gfortran.dg/gomp/assume-2.f90: Update dg-error.
* gfortran.dg/gomp/assumes-2.f90: Likewise.
* gfortran.dg/gomp/assume-5.f90: New test.

(cherry picked from commit 2ce55247a8bf32985a96ed63a7a92d36746723dc)

2 years agoMerge branch 'releases/gcc-12' into devel/omp/gcc-12
Tobias Burnus [Mon, 16 Jan 2023 11:26:42 +0000 (12:26 +0100)] 
Merge branch 'releases/gcc-12' into devel/omp/gcc-12

Merge up to r12-9046-gd369eb486bdc720e4c50563226dbbb11a0226b5d (16th Jan 2023)

2 years agoDaily bump.
GCC Administrator [Mon, 16 Jan 2023 00:21:08 +0000 (00:21 +0000)] 
Daily bump.

2 years agoDaily bump.
GCC Administrator [Sun, 15 Jan 2023 00:20:59 +0000 (00:20 +0000)] 
Daily bump.

2 years agoDaily bump.
GCC Administrator [Sat, 14 Jan 2023 00:20:27 +0000 (00:20 +0000)] 
Daily bump.

2 years agolibgomp, amdgcn: Switch USM to 128-byte alignment
Andrew Stubbs [Fri, 13 Jan 2023 17:38:39 +0000 (17:38 +0000)] 
libgomp, amdgcn: Switch USM to 128-byte alignment

This should optimize cache-lines on the AMD GPUs somewhat.

libgomp/ChangeLog:

* usm-allocator.c (ALIGN): Use 128-byte alignment.

2 years agoDaily bump.
GCC Administrator [Fri, 13 Jan 2023 00:21:17 +0000 (00:21 +0000)] 
Daily bump.

2 years agoDaily bump.
GCC Administrator [Thu, 12 Jan 2023 00:24:45 +0000 (00:24 +0000)] 
Daily bump.

2 years agoamdgcn, libgomp: custom USM allocator
Andrew Stubbs [Tue, 13 Dec 2022 23:31:21 +0000 (23:31 +0000)] 
amdgcn, libgomp: custom USM allocator

There were problems with critical driver data sharing pages with USM data, so
this new allocator implementation moves USM to entirely different pages.

libgomp/ChangeLog:

* plugin/plugin-gcn.c: Include sys/mman.h and unistd.h.
(usm_heap_create): New function.
(struct usm_splay_tree_key_s): Delete function.
(usm_splay_compare): Delete function.
(splay_tree_prefix): Delete define.
(GOMP_OFFLOAD_usm_alloc): Use new allocator.
(GOMP_OFFLOAD_usm_free): Likewise.
(GOMP_OFFLOAD_is_usm_ptr): Likewise.
(gomp_fatal): Delete macro.
(splay_tree_c): Delete.
* usm-allocator.c: New file.

2 years agoFix problematic interaction between bitfields, unions, SSO and SRA
Eric Botcazou [Wed, 11 Jan 2023 14:58:47 +0000 (15:58 +0100)] 
Fix problematic interaction between bitfields, unions, SSO and SRA

The handling of bitfields by the SRA pass is peculiar and this must be taken
into account to support the scalar_storage_order attribute.

gcc/
PR tree-optimization/108199
* tree-sra.cc (sra_modify_expr): Deal with reverse storage order
for bit-field references.

gcc/testsuite/
* gcc.dg/sso-17.c: New test.

2 years agostrlen: do not use cond_expr for boundaries
Martin Liska [Fri, 23 Dec 2022 14:27:32 +0000 (15:27 +0100)] 
strlen: do not use cond_expr for boundaries

PR tree-optimization/108137

gcc/ChangeLog:

* tree-ssa-strlen.cc (get_range_strlen_phi): Reject anything
different from INTEGER_CST.

gcc/testsuite/ChangeLog:

* gcc.dg/tree-ssa/pr108137.c: New test.

(cherry picked from commit ee6f262b87fef590729e96e999f1c3b207c251c0)

2 years agoDaily bump.
GCC Administrator [Wed, 11 Jan 2023 00:22:09 +0000 (00:22 +0000)] 
Daily bump.

2 years agoFix memory constraint on MVE v[ld/st][2/4] instructions [PR107714]
Stam Markianos-Wright [Fri, 30 Dec 2022 11:25:22 +0000 (11:25 +0000)] 
Fix memory constraint on MVE v[ld/st][2/4] instructions [PR107714]

In the M-Class Arm-ARM:

https://developer.arm.com/documentation/ddi0553/bu/?lang=en

these MVE instructions only have '!' writeback variant and at:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107714

we found that the Um constraint would also allow through a
register offset writeback, resulting in an assembler error.

Here I have added a new constraint and predicate for these
instructions, which (uniquely, AFAICT), only support a `!` writeback
increment by the data size (inside the compiler this is a POST_INC).

No regressions in arm-none-eabi with MVE and MVE.FP.

gcc/ChangeLog:
PR target/107714
* config/arm/arm-protos.h (mve_struct_mem_operand): New protoype.
* config/arm/arm.cc (mve_struct_mem_operand): New function.
* config/arm/constraints.md (Ug): New constraint.
* config/arm/mve.md (mve_vst4q<mode>): Change constraint.
(mve_vst2q<mode>): Likewise.
(mve_vld4q<mode>): Likewise.
(mve_vld2q<mode>): Likewise.
* config/arm/predicates.md (mve_struct_operand): New predicate.

gcc/testsuite/ChangeLog:
PR target/107714
* gcc.target/arm/mve/intrinsics/vldst24q_reg_offset.c: New test.

(cherry picked from commit 4269a6567eb991e6838f40bda5be9e3a7972530c)

2 years agoaarch64: PR target/108140 Handle NULL target in data intrinsic expansion
Kyrylo Tkachov [Mon, 19 Dec 2022 11:16:47 +0000 (11:16 +0000)] 
aarch64: PR target/108140 Handle NULL target in data intrinsic expansion

In this PR we ICE when expanding the __rbit builtin with a NULL target rtx.
I *think* that only happens when the result is unused and hence maybe we shouldn't be expanding
any RTL at all, but the ICE here is easily fixed by deriving the mode from the type of the expression
rather than the target.

This patch does that.
Bootstrapped and tested on aarch64-none-linux-gnu.

gcc/ChangeLog:

PR target/108140
* config/aarch64/aarch64-builtins.cc
(aarch64_expand_builtin_data_intrinsic): Handle NULL target.

gcc/testsuite/ChangeLog:

PR target/108140
* gcc.target/aarch64/acle/pr108140.c: New test.

(cherry picked from commit 98756bcbe27647f263f2b312d1d933d70cf56ba9)

2 years agoDaily bump.
GCC Administrator [Tue, 10 Jan 2023 00:22:35 +0000 (00:22 +0000)] 
Daily bump.

2 years agoUpdate cpplib eo.po
Joseph Myers [Mon, 9 Jan 2023 20:17:37 +0000 (20:17 +0000)] 
Update cpplib eo.po

* eo.po: Update.

2 years agoopenmp: Fix up finish_omp_target_clauses [PR108286]
Jakub Jelinek [Mon, 9 Jan 2023 10:54:33 +0000 (11:54 +0100)] 
openmp: Fix up finish_omp_target_clauses [PR108286]

The comment in the loop says that we shouldn't add a map clause if such
a clause exists already, but the loop was actually using OMP_CLAUSE_DECL
on any clause.  Target construct can have various clauses which don't
have OMP_CLAUSE_DECL at all (e.g. nowait, device or if) or clause
where it means something different (e.g. privatization clauses, allocate,
depend).

So, only check OMP_CLAUSE_DECL on OMP_CLAUSE_MAP clauses.

2023-01-05  Jakub Jelinek  <jakub@redhat.com>

PR c++/108286
* semantics.cc (finish_omp_target_clauses): Ignore clauses other than
OMP_CLAUSE_MAP.

* testsuite/libgomp.c++/pr108286.C: New test.

(cherry picked from commit 29c3218618ef6177dc33871b26c8fbd9b21eabe1)

2 years agoMerge branch 'releases/gcc-12' into devel/omp/gcc-12
Tobias Burnus [Mon, 9 Jan 2023 09:20:42 +0000 (10:20 +0100)] 
Merge branch 'releases/gcc-12' into devel/omp/gcc-12

Merge up to r12-9034-g4494965932fc5d005e2482bbe58cf9e138c830bd (9th Jan 2023)

2 years agoDaily bump.
GCC Administrator [Mon, 9 Jan 2023 00:21:52 +0000 (00:21 +0000)] 
Daily bump.

2 years agoDaily bump.
GCC Administrator [Sun, 8 Jan 2023 00:21:14 +0000 (00:21 +0000)] 
Daily bump.

2 years agoDaily bump.
GCC Administrator [Sat, 7 Jan 2023 00:21:38 +0000 (00:21 +0000)] 
Daily bump.

2 years agoDaily bump.
GCC Administrator [Fri, 6 Jan 2023 00:21:03 +0000 (00:21 +0000)] 
Daily bump.

2 years agolibstdc++: Fix std::chrono::hh_mm_ss with unsigned rep [PR108265]
Jonathan Wakely [Wed, 4 Jan 2023 16:43:51 +0000 (16:43 +0000)] 
libstdc++: Fix std::chrono::hh_mm_ss with unsigned rep [PR108265]

libstdc++-v3/ChangeLog:

PR libstdc++/108265
* include/std/chrono (hh_mm_ss): Do not use chrono::abs if
duration rep is unsigned. Remove incorrect noexcept-specifier.
* testsuite/std/time/hh_mm_ss/1.cc: Check unsigned rep. Check
floating-point representations. Check default construction.

(cherry picked from commit e36e57b032b2d70eaa1294d5921e4fd8ce12a74d)

2 years agors6000: Raise error for __vector_{quad,pair} uses without MMA enabled [PR106736]
Kewen Lin [Wed, 21 Dec 2022 03:02:08 +0000 (21:02 -0600)] 
rs6000: Raise error for __vector_{quad,pair} uses without MMA enabled [PR106736]

As PR106736 shows, it's unexpected to use __vector_quad and
__vector_pair types without MMA support, it would cause ICE
when expanding the corresponding assignment.  We can't guard
these built-in types registering under MMA support as Peter
pointed out in that PR, because the registering is global,
it doesn't work for target pragma/attribute support with MMA
enabled.  The existing verify_type_context mentioned in [2]
can help to make the diagnostics invalid built-in type uses
better, but as Richard pointed out in [4], it can't deal with
all cases.  As the discussions in [1][3], this patch is to
check the invalid use of built-in types __vector_quad and
__vector_pair in mov pattern of OOmode and XOmode, on the
currently being expanded gimple assignment statement.  It
still puts an assertion in else arm rather than just makes
it go through, it's to ensure we can catch any other possible
unexpected cases in time if there are.

[1] https://gcc.gnu.org/pipermail/gcc/2022-December/240218.html
[2] https://gcc.gnu.org/pipermail/gcc/2022-December/240220.html
[3] https://gcc.gnu.org/pipermail/gcc/2022-December/240223.html
[4] https://gcc.gnu.org/pipermail/gcc-patches/2022-December/608083.html

PR target/106736

gcc/ChangeLog:

* config/rs6000/mma.md (define_expand movoo): Call function
rs6000_opaque_type_invalid_use_p to check and emit error message for
the invalid use of opaque type.
(define_expand movxo): Likewise.
* config/rs6000/rs6000-protos.h
(rs6000_opaque_type_invalid_use_p): New function declaration.
(currently_expanding_gimple_stmt): New extern declaration.
* config/rs6000/rs6000.cc (rs6000_opaque_type_invalid_use_p): New
function.

gcc/testsuite/ChangeLog:

* gcc.target/powerpc/pr106736-1.c: New test.
* gcc.target/powerpc/pr106736-2.c: Likewise.
* gcc.target/powerpc/pr106736-3.c: Likewise.
* gcc.target/powerpc/pr106736-4.c: Likewise.
* gcc.target/powerpc/pr106736-5.c: Likewise.

2 years agoDaily bump.
GCC Administrator [Thu, 5 Jan 2023 00:20:48 +0000 (00:20 +0000)] 
Daily bump.

2 years agoc++: mark_single_function and SFINAE [PR108282]
Patrick Palka [Wed, 4 Jan 2023 19:12:25 +0000 (14:12 -0500)] 
c++: mark_single_function and SFINAE [PR108282]

We typically ignore mark_used failure when in a non-SFINAE context for
sake of better error recovery.  But in mark_single_function we're
instead ignoring mark_used failure in a SFINAE context, which ends up
causing the second static_assert here to incorrectly fail.

PR c++/108282

gcc/cp/ChangeLog:

* decl2.cc (mark_single_function): Ignore mark_used failure
only in a non-SFINAE context rather than in a SFINAE one.

gcc/testsuite/ChangeLog:

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

(cherry picked from commit 238e292cf5d822f3bd12d9b58eb04cf377758b2a)

2 years agolibiberty: Fix C89-isms in configure tests
Florian Weimer [Tue, 18 Oct 2022 14:58:48 +0000 (16:58 +0200)] 
libiberty: Fix C89-isms in configure tests

libiberty/

* acinclude.m4 (ac_cv_func_strncmp_works): Add missing
int return type and parameter list to the definition of main.
Include <stdlib.h> and <string.h> for prototypes.
(ac_cv_c_stack_direction): Add missing
int return type and parameter list to the definitions of
main, find_stack_direction.  Include <stdlib.h> for exit
prototype.
* configure: Regenerate.

(cherry picked from commit 885b6660c17fb91980b5682514ef54668e544b02)

2 years agolibsanitizer: Avoid implicit function declaration in configure test
Florian Weimer [Wed, 4 Jan 2023 10:13:17 +0000 (11:13 +0100)] 
libsanitizer: Avoid implicit function declaration in configure test

libsanitizer/

* configure.ac (sanitizer_supported): Include <unistd.h> for
syscall prototype.
* configure: Regenerate.

(cherry picked from commit 6be2672e4ee41c566a9e072088cccca263bab5f7)

2 years agoOpenMP: GC unused SIMD clones
Sandra Loosemore [Tue, 3 Jan 2023 17:46:02 +0000 (17:46 +0000)] 
OpenMP: GC unused SIMD clones

SIMD clones are created during the IPA phase when it is not known whether
or not the vectorizer can use them.  Clones for functions with external
linkage are part of the ABI, but local clones can be GC'ed if no calls are
found in the compilation unit after vectorization.

gcc/ChangeLog
* cgraph.h (struct cgraph_node): Add gc_candidate bit, modify
default constructor to initialize it.
* cgraphunit.cc (expand_all_functions): Save gc_candidate functions
for last and iterate to handle recursive calls.  Delete leftover
candidates at the end.
* omp-simd-clone.cc (simd_clone_create): Set gc_candidate bit
on local clones.
* tree-vect-stmts.cc (vectorizable_simd_clone_call): Clear
gc_candidate bit when a clone is used.

gcc/testsuite/ChangeLog
* g++.dg/gomp/target-simd-clone-1.C: Tweak to test
that the unused clone is GC'ed.
* gcc.dg/gomp/target-simd-clone-1.c: Likewise.

(cherry picked from commit 0425ae780fb2b055d985b5719af5edfaaad5e980)

2 years agoDaily bump.
GCC Administrator [Wed, 4 Jan 2023 00:20:17 +0000 (00:20 +0000)] 
Daily bump.

2 years agoDaily bump.
GCC Administrator [Tue, 3 Jan 2023 00:20:41 +0000 (00:20 +0000)] 
Daily bump.

2 years agoDaily bump.
GCC Administrator [Mon, 2 Jan 2023 00:20:14 +0000 (00:20 +0000)] 
Daily bump.

2 years agoDaily bump.
GCC Administrator [Sun, 1 Jan 2023 00:21:07 +0000 (00:21 +0000)] 
Daily bump.

2 years agoDaily bump.
GCC Administrator [Sat, 31 Dec 2022 00:20:24 +0000 (00:20 +0000)] 
Daily bump.

2 years agoDaily bump.
GCC Administrator [Fri, 30 Dec 2022 00:20:15 +0000 (00:20 +0000)] 
Daily bump.

2 years agoDaily bump.
GCC Administrator [Thu, 29 Dec 2022 00:20:57 +0000 (00:20 +0000)] 
Daily bump.

2 years agoFortran: incorrect array bounds when bound intrinsic used in decl [PR108131]
Harald Anlauf [Sat, 17 Dec 2022 21:04:32 +0000 (22:04 +0100)] 
Fortran: incorrect array bounds when bound intrinsic used in decl [PR108131]

gcc/fortran/ChangeLog:

PR fortran/108131
* array.cc (match_array_element_spec): Avoid too early simplification
of matched array element specs that can lead to a misinterpretation
when used as array bounds in array declarations.

gcc/testsuite/ChangeLog:

PR fortran/108131
* gfortran.dg/pr103505.f90: Adjust expected patterns.
* gfortran.dg/pr108131.f90: New test.

(cherry picked from commit 6a95f0e0a06d78d94138d4c3dd64d41591197281)

2 years agoDaily bump.
GCC Administrator [Wed, 28 Dec 2022 00:20:23 +0000 (00:20 +0000)] 
Daily bump.

2 years agoMerge branch 'releases/gcc-12' into devel/omp/gcc-12
Tobias Burnus [Tue, 27 Dec 2022 10:53:58 +0000 (11:53 +0100)] 
Merge branch 'releases/gcc-12' into devel/omp/gcc-12

Merge up to r12-9015-ga3fbfc1027e9edcd14bb290b5702504d80d9e8fe (27th Dec 2022)

2 years agoDaily bump.
GCC Administrator [Tue, 27 Dec 2022 00:20:21 +0000 (00:20 +0000)] 
Daily bump.

2 years agoDaily bump.
GCC Administrator [Mon, 26 Dec 2022 00:20:39 +0000 (00:20 +0000)] 
Daily bump.

2 years agoDaily bump.
GCC Administrator [Sun, 25 Dec 2022 00:20:15 +0000 (00:20 +0000)] 
Daily bump.

2 years agoSkip guality tests on hppa-hpux.
John David Anglin [Sun, 13 Nov 2022 17:04:44 +0000 (17:04 +0000)] 
Skip guality tests on hppa-hpux.

The guality check command hangs. This causes TCL errors in
other tests and slows testsuite execution.

2022-11-13  John David Anglin  <danglin@gcc.gnu.org>

gcc/testsuite/ChangeLog:

* g++.dg/guality/guality.exp: Skip on hppa*-*-hpux*.
* gcc.dg/guality/guality.exp: Likewise.
* gfortran.dg/guality/guality.exp: Likewise.

2 years agoDaily bump.
GCC Administrator [Sat, 24 Dec 2022 00:20:55 +0000 (00:20 +0000)] 
Daily bump.

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

2 years agobootstrap/106482 - document minimal GCC version
Richard Biener [Thu, 22 Dec 2022 14:51:46 +0000 (15:51 +0100)] 
bootstrap/106482 - document minimal GCC version

There's no explicit mention of what GCC compiler supports C++11
and the cross compiler build requirement mentions GCC 4.8 but not
GCC 4.8.3 which is the earliest known version to not run into
C++11 implementation bugs.  The following adds explicit wording.

PR bootstrap/106482
* doc/install.texi (ISO C++11 Compiler): Document GCC version
known to work.

(cherry picked from commit b97c33fbd28e74a206c81c96a9b0b9fa3c8545d6)

2 years agolto: support --jobserver-style=fifo for recent GNU make
Martin Liska [Tue, 9 Aug 2022 11:59:36 +0000 (13:59 +0200)] 
lto: support --jobserver-style=fifo for recent GNU make

gcc/ChangeLog:

* opts-jobserver.h: Add one member.
* opts-common.cc (jobserver_info::jobserver_info): Parse FIFO
format of --jobserver-auth.

(cherry picked from commit 53e3b2bf16a486c15c20991c6095f7be09012b55)

2 years agoFactor out jobserver_active_p.
Martin Liska [Tue, 9 Aug 2022 11:59:32 +0000 (13:59 +0200)] 
Factor out jobserver_active_p.

gcc/ChangeLog:

* gcc.cc (driver::detect_jobserver): Remove and move to
jobserver.h.
* lto-wrapper.cc (jobserver_active_p): Likewise.
(run_gcc): Likewise.
* opts-jobserver.h: New file.
* opts-common.cc (jobserver_info::jobserver_info): New function.

(cherry picked from commit 1270ccda70ca09f7d4fe76b5156dca8992bd77a6)

2 years agoDaily bump.
GCC Administrator [Thu, 22 Dec 2022 00:20:54 +0000 (00:20 +0000)] 
Daily bump.

2 years agoMerge branch 'releases/gcc-12' into devel/omp/gcc-12
Tobias Burnus [Wed, 21 Dec 2022 17:57:06 +0000 (18:57 +0100)] 
Merge branch 'releases/gcc-12' into devel/omp/gcc-12

Merge up to r12-9005-g52daccd82cd71bd065826784ebb6eb04fa9b42af (21st Dec 2022)

2 years agonvptx: reimplement libgomp barriers [PR99555]
Chung-Lin Tang [Wed, 21 Dec 2022 17:56:41 +0000 (18:56 +0100)] 
nvptx: reimplement libgomp barriers [PR99555]

Instead of trying to have the GPU do CPU-with-OS-like things, this new barriers
implementation for NVPTX uses simplistic bar.* synchronization instructions.
Tasks are processed after threads have joined, and only if team->task_count != 0

It is noted that: there might be a little bit of performance forfeited for
cases where earlier arriving threads could've been used to process tasks ahead
of other threads, but that has the requirement of implementing complex
futex-wait/wake like behavior, which is what we're try to avoid with this patch.
It is deemed that task processing is not what GPU target offloading is usually
used for.

Implementation highlight notes:
1. gomp_team_barrier_wake() is now an empty function (threads never "wake" in
   the usual manner)
2. gomp_team_barrier_cancel() now uses the "exit" PTX instruction.
3. gomp_barrier_wait_last() now is implemented using "bar.arrive"

4. gomp_team_barrier_wait_end()/gomp_team_barrier_wait_cancel_end():
   The main synchronization is done using a 'bar.red' instruction. This reduces
   across all threads the condition (team->task_count != 0), to enable the task
   processing down below if any thread created a task.
   (this bar.red usage means that this patch is dependent on the prior NVPTX
   bar.red GCC patch)

PR target/99555

libgomp/ChangeLog:

* config/nvptx/bar.c (generation_to_barrier): Remove.
(futex_wait,futex_wake,do_spin,do_wait): Remove.
(GOMP_WAIT_H): Remove.
(#include "../linux/bar.c"): Remove.
(gomp_barrier_wait_end): New function.
(gomp_barrier_wait): Likewise.
(gomp_barrier_wait_last): Likewise.
(gomp_team_barrier_wait_end): Likewise.
(gomp_team_barrier_wait): Likewise.
(gomp_team_barrier_wait_final): Likewise.
(gomp_team_barrier_wait_cancel_end): Likewise.
(gomp_team_barrier_wait_cancel): Likewise.
(gomp_team_barrier_cancel): Likewise.
* config/nvptx/bar.h (gomp_barrier_t): Remove waiters, lock fields.
(gomp_barrier_init): Remove init of waiters, lock fields.
(gomp_team_barrier_wake): Remove prototype, add new static inline
function.

(cherry picked from commit fdc7469cf597ec11229ddfc3e9c7a06f3d0fba9d)

2 years agonvptx: support bar.red instruction
Chung-Lin Tang [Wed, 21 Dec 2022 17:55:19 +0000 (18:55 +0100)] 
nvptx: support bar.red instruction

This patch adds support for the PTX 'bar.red' (i.e. "barrier reduction")
instruction, in the form of nvptx-specific __builtin_nvptx_bar_red_[and/or/popc]
built-in functions.

gcc/ChangeLog:

* config/nvptx/nvptx.cc (nvptx_print_operand): Add 'p' case, adjust
comments.
(enum nvptx_builtins): Add NVPTX_BUILTIN_BAR_RED_AND,
NVPTX_BUILTIN_BAR_RED_OR, and NVPTX_BUILTIN_BAR_RED_POPC.
(nvptx_expand_bar_red): New function.
(nvptx_init_builtins):
Add DEFs of __builtin_nvptx_bar_red_[and/or/popc].
(nvptx_expand_builtin): Use nvptx_expand_bar_red to expand
NVPTX_BUILTIN_BAR_RED_[AND/OR/POPC] cases.

* config/nvptx/nvptx.md (define_c_enum "unspecv"): Add
UNSPECV_BARRED_AND, UNSPECV_BARRED_OR, and UNSPECV_BARRED_POPC.
(BARRED): New int iterator.
(barred_op,barred_mode,barred_ptxtype): New int attrs.
(nvptx_barred_<barred_op>): New define_insn.

(cherry picked from commit 623daaf8a229fcb58f84448d954f8c71191ca486)

2 years agoopenmp: Don't try to destruct DECL_OMP_PRIVATIZED_MEMBER vars [PR108180]
Jakub Jelinek [Wed, 21 Dec 2022 17:49:17 +0000 (18:49 +0100)] 
openmp: Don't try to destruct DECL_OMP_PRIVATIZED_MEMBER vars [PR108180]

DECL_OMP_PRIVATIZED_MEMBER vars are artificial vars with DECL_VALUE_EXPR
of this->field used just during gimplification and omp lowering/expansion
to privatize individual fields in methods when needed.
As the following testcase shows, when not in templates, they were handled
right, but in templates we actually called cp_finish_decl on them and
that can result in their destruction, which is obviously undesirable,
we should only destruct the privatized copies of them created in omp
lowering.

Fixed thusly.

2022-12-21  Jakub Jelinek  <jakub@redhat.com>

PR c++/108180
* pt.cc (tsubst_expr): Don't call cp_finish_decl on
DECL_OMP_PRIVATIZED_MEMBER vars.

* testsuite/libgomp.c++/pr108180.C: New test.

(cherry picked from commit 1119902b6c7c1c50123ed85ec1def8be4772d68c)

2 years agoOpenMP: Duplicate checking for map clauses in Fortran (PR107214)
Julian Brown [Wed, 21 Dec 2022 17:47:20 +0000 (18:47 +0100)] 
OpenMP: Duplicate checking for map clauses in Fortran (PR107214)

This patch adds duplicate checking for OpenMP "map" clauses, taking some
cues from the implementation for C in c-typeck.cc:c_finish_omp_clauses
(and similar for C++).

In addition to the existing use of the "mark" and "comp_mark" bitfields
in the gfc_symbol structure, the patch adds several new bits handling
duplicate checking within various categories of clause types.  If "mark"
is being used for map clauses, we need to use different bits for other
clauses for cases where "map" and some other clause can refer to the
same symbol (e.g. "map(n) shared(n)").

2022-12-06  Julian Brown  <julian@codesourcery.com>

gcc/fortran/
PR fortran/107214
* gfortran.h (gfc_symbol): Add data_mark, dev_mark, gen_mark and
reduc_mark bitfields.
* openmp.cc (resolve_omp_clauses): Use above bitfields to improve
duplicate clause detection.

gcc/testsuite/
PR fortran/107214
* gfortran.dg/gomp/pr107214.f90: New test.
* gfortran.dg/gomp/pr107214-2.f90: New test.
* gfortran.dg/gomp/pr107214-3.f90: New test.
* gfortran.dg/gomp/pr107214-4.f90: New test.
* gfortran.dg/gomp/pr107214-5.f90: New test.
* gfortran.dg/gomp/pr107214-6.f90: New test.
* gfortran.dg/gomp/pr107214-7.f90: New test.
* gfortran.dg/gomp/pr107214-8.f90: New test.

(cherry picked from commit 330b9a8d87dd73e10539da618496ad4964fee26d)

2 years agoOpenMP/Fortran: Combined directives with map/firstprivate of same symbol
Julian Brown [Wed, 21 Dec 2022 17:45:51 +0000 (18:45 +0100)] 
OpenMP/Fortran: Combined directives with map/firstprivate of same symbol

This patch fixes a case where a combined directive (e.g. "!$omp target
parallel ...") contains both a map and a firstprivate clause for the
same variable.  When the combined directive is split into two nested
directives, the outer "target" gets the "map" clause, and the inner
"parallel" gets the "firstprivate" clause, like so:

  !$omp target parallel map(x) firstprivate(x)

  -->

  !$omp target map(x)
    !$omp parallel firstprivate(x)
      ...

When there is no map of the same variable, the firstprivate is distributed
to both directives, e.g. for 'y' in:

  !$omp target parallel map(x) firstprivate(y)

  -->

  !$omp target map(x) firstprivate(y)
    !$omp parallel firstprivate(y)
      ...

This is not a recent regression, but appear to fix a long-standing ICE.
(The included testcase is based on one by Tobias.)

2022-12-06  Julian Brown  <julian@codesourcery.com>

gcc/fortran/
* trans-openmp.cc (gfc_add_firstprivate_if_unmapped): New function.
(gfc_split_omp_clauses): Call above.

libgomp/
* testsuite/libgomp.fortran/combined-directive-splitting-1.f90: New
test.

(cherry picked from commit 9316ad3b4354cbf2980f86902e54884e918c472a)

2 years agolibstdc++: Fix unsafe use of dirent::d_name [PR107814]
Jonathan Wakely [Tue, 22 Nov 2022 19:15:53 +0000 (19:15 +0000)] 
libstdc++: Fix unsafe use of dirent::d_name [PR107814]

Copy the fix for PR 104731 to the equivalent experimental::filesystem
test.

libstdc++-v3/ChangeLog:

PR libstdc++/107814
* testsuite/experimental/filesystem/iterators/error_reporting.cc:
Use a static buffer with space after it.

(cherry picked from commit 1cac00d013856fea4cee0f13c4959c8e21afd2d9)

2 years agolibstdc++: Fixes for std::expected
Jonathan Wakely [Fri, 16 Dec 2022 16:07:29 +0000 (16:07 +0000)] 
libstdc++: Fixes for std::expected

This fixes some bugs in the swap functions for std::expected.

It also disables the noexcept-specifiers for equality operators, because
those are problematic when querying whether a std::expected is equality
comparable. The operator==(const expected<T,E>&, const U&) function is
not constrained, so is viable for comparing expected<T,E> with
expected<void,G>, but then we get an error from the noexcept-specifier.

libstdc++-v3/ChangeLog:

* include/std/expected (expected::_M_swap_val_unex): Guard the
correct object.
(expected::swap): Move is_swappable
requirement from static_assert to constraint.
(swap): Likewise.
(operator==): Remove noexcept-specifier.
* testsuite/20_util/expected/swap.cc: Check swapping of
types without non-throwing move constructor. Check constraints
on swap.
* testsuite/20_util/expected/unexpected.cc: Check constraints on
swap.
* testsuite/20_util/expected/equality.cc: New test.

(cherry picked from commit 59822c39207c9e8be576e9d6c3370bd85ddaf886)

2 years agolibgfortran's ISO_Fortran_binding.c: Use GCC11 version for backward-only code [PR108056]
Tobias Burnus [Wed, 21 Dec 2022 06:55:22 +0000 (07:55 +0100)] 
libgfortran's ISO_Fortran_binding.c: Use GCC11 version for backward-only code [PR108056]

Since GCC 12, the conversion between the array descriptors formats - the
internal (GFC) and the C binding one (CFI) - moved to the compiler itself
such that the cfi_desc_to_gfc_desc/gfc_desc_to_cfi_desc functions are only
used with older code (GCC 9 to 11).  The newly added checks caused asserts
as older code did not pass the proper values (e.g. real(4) as effective
argument arrived as BT_ASSUME type as the effective type got lost inbetween).

As proposed in the PR, revert to the GCC 11 version - known bugs is better
than some fixes and new issues. Still, GCC 12 is much better in terms of
TS29113 support and should really be used.

This patch uses the current libgomp version of the GCC 11 branch, except
it fixes the GFC version number (which is 0), uses calloc instead of malloc,
and sets the lower bound to 1 instead of keeping it as is for
CFI_attribute_other.

(cherry picked from commit e205ec03f0794aeac3e8a89e947c12624d5a274e)

(This cherry pick excludes an accidentally committed file, which was
removed in follow-up commit 18af26fc375398f0a7cd7bae5aabebd447f8c899.)

libgfortran/ChangeLog:

PR libfortran/108056
* runtime/ISO_Fortran_binding.c (cfi_desc_to_gfc_desc,
gfc_desc_to_cfi_desc): Mostly revert to GCC 11 version for
those backward-compatiblity-only functions.

2 years agoDaily bump.
GCC Administrator [Wed, 21 Dec 2022 00:20:23 +0000 (00:20 +0000)] 
Daily bump.

2 years agod/104749 - document host GDC version requirement
Richard Biener [Tue, 20 Dec 2022 13:34:01 +0000 (14:34 +0100)] 
d/104749 - document host GDC version requirement

This documents that GDC 9.4 or later is required to build the D
language rather than GDC 9.1 which suffers from PR94240.

PR d/104749
* doc/install.texi (GDC): Document GDC 9.4 or later is required
to build the D language frontend.

(cherry picked from commit 05b7cf52e1b640271900894a894da2d27ef90092)

2 years agoi386: Avoid fma_chain for -march=alderlake and sapphirerapids.
Hongyu Wang [Tue, 6 Dec 2022 01:53:35 +0000 (09:53 +0800)] 
i386: Avoid fma_chain for -march=alderlake and sapphirerapids.

For Alderlake there is similar issue like PR81616, enable
avoid_fma256_chain will also benefit on Intel latest platforms
Alderlake and Sapphire Rapids.

gcc/ChangeLog:

* config/i386/x86-tune.def (X86_TUNE_AVOID_256FMA_CHAINS): Add
m_SAPPHIRERAPIDS, m_ALDERLAKE.

2 years agoDaily bump.
GCC Administrator [Tue, 20 Dec 2022 00:20:39 +0000 (00:20 +0000)] 
Daily bump.

2 years agoMerge branch 'releases/gcc-12' into devel/omp/gcc-12
Tobias Burnus [Mon, 19 Dec 2022 17:31:53 +0000 (18:31 +0100)] 
Merge branch 'releases/gcc-12' into devel/omp/gcc-12

Merge up to r12-8998-gcdc1a14be1182874ccf1ceb27ee5b67c5ce8c62d (19th Dec 2022)

2 years agoc++: extract_local_specs and unevaluated contexts [PR100295]
Patrick Palka [Thu, 15 Dec 2022 21:02:05 +0000 (16:02 -0500)] 
c++: extract_local_specs and unevaluated contexts [PR100295]

Here during partial instantiation of the constexpr if, extra_local_specs
walks the statement looking for local specializations within to capture.
However, we're thwarted by the fact that 'ts' first appears inside an
unevaluated context, and so the calls to process_outer_var_ref for its
local specializations are a no-op.  And since we walk each tree exactly
once, we end up not capturing the local specializations despite 'ts'
later occurring in an evaluated context.

This patch fixes this by making extract_local_specs walk evaluated
contexts first before walking unevaluated contexts.  We could probably
get away with not walking unevaluated contexts at all, but this approach
seems more clearly safe.

PR c++/100295
PR c++/107579

gcc/cp/ChangeLog:

* pt.cc (el_data::skip_unevaluated_operands): New data member.
(extract_locals_r): If skip_unevaluated_operands is true,
don't walk into unevaluated contexts.
(extract_local_specs): Walk the pattern twice, first with
skip_unevaluated_operands true followed by it set to false.

gcc/testsuite/ChangeLog:

* g++.dg/cpp1z/constexpr-if-lambda5.C: New test.

(cherry picked from commit 18499b9f848707aee42d810e99ac0a4c9788433c)

2 years agoc++: partial ordering with memfn ptr cst [PR108104]
Patrick Palka [Thu, 15 Dec 2022 20:38:47 +0000 (15:38 -0500)] 
c++: partial ordering with memfn ptr cst [PR108104]

Here we're triggering an overzealous assert in unify during partial
ordering since the member function pointer constants are represented as
ordinary CONSTRUCTORs (with TYPE_PTRMEMFUNC_P TREE_TYPE) but the assert
expects COMPOUND_LITERAL_P constructors.

PR c++/108104

gcc/cp/ChangeLog:

* pt.cc (unify) <default>: Relax assert to accept any
CONSTRUCTOR parm, not just COMPOUND_LITERAL_P one.

gcc/testsuite/ChangeLog:

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

(cherry picked from commit 38304846d18d6bb14b0fd6c627c5c6d43a814d01)

2 years agoc++: pack in requires-expr parm list [PR107417]
Patrick Palka [Sun, 4 Dec 2022 15:47:24 +0000 (10:47 -0500)] 
c++: pack in requires-expr parm list [PR107417]

Here find_parameter_packs_r isn't detecting the pack T inside the
requires-expr's parameter list ultimately because cp_walk_trees
deliberately avoids walking the list so as to avoid false positives in
the unexpanded pack checker.

But it should still be fine to walk the TREE_TYPE of each parameter,
which we already need to do from for_each_template_parm_r, and is
sufficient to fix the testcase.

PR c++/107417

gcc/cp/ChangeLog:

* pt.cc (for_each_template_parm_r) <case REQUIRES_EXPR>: Move
walking of the TREE_TYPE of each parameter to ...
* tree.cc (cp_walk_subtrees) <case REQUIRES_EXPR>: ... here.

gcc/testsuite/ChangeLog:

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

(cherry picked from commit 079add3ad39d6620d34665dd9c26c21951eb657c)

2 years agoc++: substituting CONST_DECL_USING_P enumerators [PR103081]
Patrick Palka [Sat, 3 Dec 2022 15:28:25 +0000 (10:28 -0500)] 
c++: substituting CONST_DECL_USING_P enumerators [PR103081]

We implement class-scope using enum by injecting clones of the enum's
CONST_DECLs as fields of the class, for which CONST_DECL_USING_P is
true, so that qualified lookup naturally finds the enumerators.
Substitution into such a CONST_DECL currently ICEs however, because we
assume the DECL_CONTEXT is always the ENUMERAL_TYPE (which has
TYPE_VALUES) but in this case it's the RECORD_TYPE for the class scope
(which has TYPE_FIELDS).

Since these CONST_DECLs appear to always be non-dependent, this patch
fixes this by shortcutting substitution for CONST_DECLs that have
non-dependent DECL_CONTEXT.  This subsumes the existing (and seemingly
dead) DECL_NAMESPACE_SCOPE_P early exit test and also benefits
substitution into ordinary non-dependent CONST_DECLs.

PR c++/103081

gcc/cp/ChangeLog:

* pt.cc (tsubst_copy) <case CONST_DECL>: Generalize
early exit test for namespace-scope decls to check dependence of
the enclosing scope instead.  Remove dead early exit test.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/using-enum-10.C: New test.
* g++.dg/cpp2a/using-enum-10a.C: New test.

(cherry picked from commit b3912122c9dfaba6c8229e8f095885f69782ceda)

2 years agoc++: ICE with <=> of incompatible pointers [PR107542]
Patrick Palka [Wed, 30 Nov 2022 00:25:37 +0000 (19:25 -0500)] 
c++: ICE with <=> of incompatible pointers [PR107542]

In a SFINAE context composite_pointer_type returns error_mark_node if
the given pointer types are incompatible.  But the SPACESHIP_EXPR case
of cp_build_binary_op wasn't prepared for this error_mark_node result,
which led to an ICE (from spaceship_comp_cat) for the below testcase.
(In a non-SFINAE context composite_pointer_type issues a permerror and
returns cv void* in this case, so this ICE seems specific to SFINAE.)

PR c++/107542

gcc/cp/ChangeLog:

* typeck.cc (cp_build_binary_op): In the SPACESHIP_EXPR case,
handle an error_mark_node result type.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/spaceship-sfinae2.C: New test.

(cherry picked from commit 000e9863120cbc75a0f8d497264519974c97669f)

2 years agoc-family: Fix ICE with -Wsuggest-attribute [PR98487]
Marek Polacek [Fri, 16 Dec 2022 17:28:43 +0000 (12:28 -0500)] 
c-family: Fix ICE with -Wsuggest-attribute [PR98487]

Here we crash because check_function_format was using TREE_PURPOSE
directly rather than using get_attribute_name.

PR c/98487

gcc/c-family/ChangeLog:

* c-format.cc (check_function_format): Use get_attribute_name.

gcc/testsuite/ChangeLog:

* c-c++-common/Wsuggest-attribute-1.c: New test.

(cherry picked from commit 68e51bd0a85794cd437d3e740357dfef84dc560d)

2 years agoDaily bump.
GCC Administrator [Mon, 19 Dec 2022 00:21:58 +0000 (00:21 +0000)] 
Daily bump.

2 years agoFortran: ICE on recursive derived types with allocatable components [PR107872]
Paul Thomas [Fri, 9 Dec 2022 21:13:45 +0000 (22:13 +0100)] 
Fortran: ICE on recursive derived types with allocatable components [PR107872]

gcc/fortran/ChangeLog:

PR fortran/107872
* resolve.cc (derived_inaccessible): Skip over allocatable components
to prevent an infinite loop.

gcc/testsuite/ChangeLog:

PR fortran/107872
* gfortran.dg/pr107872.f90: New test.

(cherry picked from commit 01254aa2eb766c7584fd047568d7277d4d65d067)

2 years agoDaily bump.
GCC Administrator [Sun, 18 Dec 2022 00:20:41 +0000 (00:20 +0000)] 
Daily bump.

2 years agoDaily bump.
GCC Administrator [Sat, 17 Dec 2022 00:21:28 +0000 (00:21 +0000)] 
Daily bump.

2 years agolibgomp: Fix USM bugs
Andrew Stubbs [Fri, 2 Dec 2022 16:37:58 +0000 (16:37 +0000)] 
libgomp: Fix USM bugs

Fix up some USM corner cases.

libgomp/ChangeLog:

* libgomp.h (OFFSET_USM): New macro.
* target.c (gomp_map_pointer): Handle USM mappings.
(gomp_map_val): Handle OFFSET_USM.
(gomp_map_vars_internal): Move USM check earlier, and use OFFSET_USM.
Add OFFSET_USM check to the second mapping pass.
* testsuite/libgomp.fortran/usm-1.f90: New test.
* testsuite/libgomp.fortran/usm-2.f90: New test.

2 years agoDaily bump.
GCC Administrator [Fri, 16 Dec 2022 00:21:18 +0000 (00:21 +0000)] 
Daily bump.

2 years agoAArch64: Add UNSPECV_PATCHABLE_AREA [PR98776]
Sebastian Pop [Wed, 30 Nov 2022 19:45:24 +0000 (19:45 +0000)] 
AArch64: Add UNSPECV_PATCHABLE_AREA [PR98776]

Currently patchable area is at the wrong place on AArch64.  It is placed
immediately after function label, before .cfi_startproc.  This patch
adds UNSPECV_PATCHABLE_AREA for pseudo patchable area instruction and
modifies aarch64_print_patchable_function_entry to avoid placing
patchable area before .cfi_startproc.

gcc/
PR target/98776
* config/aarch64/aarch64-protos.h (aarch64_output_patchable_area):
Declared.
* config/aarch64/aarch64.cc (aarch64_print_patchable_function_entry):
Emit an UNSPECV_PATCHABLE_AREA pseudo instruction.
(aarch64_output_patchable_area): New.
* config/aarch64/aarch64.md (UNSPECV_PATCHABLE_AREA): New.
(patchable_area): Define.

gcc/testsuite/
PR target/98776
* gcc.target/aarch64/pr98776.c: New.
* gcc.target/aarch64/pr92424-2.c: Adjust pattern.
* gcc.target/aarch64/pr92424-3.c: Adjust pattern.

2 years agoDaily bump.
GCC Administrator [Thu, 15 Dec 2022 00:20:50 +0000 (00:20 +0000)] 
Daily bump.

2 years agolibstdc++: Fix size passed to operator delete [PR108097]
Jonathan Wakely [Wed, 14 Dec 2022 11:58:05 +0000 (11:58 +0000)] 
libstdc++: Fix size passed to operator delete [PR108097]

The number of elements gets stored in _M_capacity so use a separate
variable for the number of bytes to allocate.

libstdc++-v3/ChangeLog:

PR libstdc++/108097
* include/std/stacktrace (basic_stracktrace::_Impl): Do not
multiply N by sizeof(value_type) when allocating.

(cherry picked from commit 881c6cabce5d0b27285ed41bd6dabdf48848cce7)

2 years agoDaily bump.
GCC Administrator [Wed, 14 Dec 2022 00:22:41 +0000 (00:22 +0000)] 
Daily bump.

2 years agolibphobos: Backport library and bindings fixes from mainline
Iain Buclaw [Tue, 13 Dec 2022 21:34:57 +0000 (22:34 +0100)] 
libphobos: Backport library and bindings fixes from mainline

D Runtime changes:

- Fix MIPS64 bindings for CRuntime_UClibc.

Phobos changes:

- Fix std.path.expandTilde erroneously raising onOutOfMemory
  after failed call to getpwnam_r().
- Fix std.random unittest failures on ILP32 targets.
- Use GENERIC_IO on CRuntime_UClibc port of std.stdio.

libphobos/ChangeLog:

* libdruntime/core/stdc/fenv.d: Compile in MIPS uClibc bindings on
MIPS_Any targets.
* libdruntime/core/stdc/math.d: Likewise.
* libdruntime/core/sys/posix/dlfcn.d: Likewise.
* libdruntime/core/sys/posix/setjmp.d: Add MIPS64 definitions for
CRuntime_UClibc.
* libdruntime/core/sys/posix/sys/types.d: Likewise.
* src/std/path.d (expandTilde): Handle more errno codes that could be
left set by getpwnam_r.
* src/std/random.d: Use D_LP64 in unittests.
* src/std/stdio.d: Set CRuntime_UClibc as GENERIC_IO target.

2 years agovarasm: Fix type confusion bug
Alex Coplan [Thu, 1 Dec 2022 17:36:02 +0000 (17:36 +0000)] 
varasm: Fix type confusion bug

This patch fixes a type confusion bug in varasm.cc:assemble_variable.
The problem is that the current code calls:

  sect = get_variable_section (decl, false);

and then accesses sect->named.name without checking whether the section
is in fact a named section. In the surrounding else clause, we only know
that SECTION_STYLE (sect) != SECTION_NOSWITCH, so it is possible that
the section is an unnamed section.

In practice, this means that we end up doing a wild string compare
between a function pointer and the string literal ".vtable_map_vars".
This is because sect->named.name aliases sect->unnamed.callback in the
section union.

This can be seen in GDB with a simple testcase such as "int x;".

This patch fixes the issue by checking the SECTION_STYLE of the section
is in fact SECTION_NAMED before trying to do the string comparison.

We drop the existing check of whether sect->named.name is non-NULL
because this should presumably always be the case for a named section.

gcc/ChangeLog:

* varasm.cc (assemble_variable): Fix type confusion bug when
checking for ".vtable_map_vars" section.

(cherry picked from commit de144fdab17dbbb64ccb540056ab78b4ffb3fbbc)

2 years agoOpenMP, libgomp: Handle unified shared memory in omp_target_is_accessible
Marcel Vollweiler [Tue, 13 Dec 2022 12:04:48 +0000 (12:04 +0000)] 
OpenMP, libgomp: Handle unified shared memory in omp_target_is_accessible

This patch handles Unified Shared Memory (USM) in the OpenMP runtime routine
omp_target_is_accessible.

libgomp/ChangeLog:

* target.c (omp_target_is_accessible): Handle unified shared memory.
* testsuite/libgomp.c-c++-common/target-is-accessible-1.c: Updated.
* testsuite/libgomp.fortran/target-is-accessible-1.f90: Updated.
* testsuite/libgomp.c-c++-common/target-is-accessible-2.c: New test.
* testsuite/libgomp.fortran/target-is-accessible-2.f90: New test.