platform/upstream/gcc.git
3 years agotestsuite/100272 - fix some malformed dg directives
Richard Biener [Tue, 27 Apr 2021 08:45:32 +0000 (10:45 +0200)]
testsuite/100272 - fix some malformed dg directives

The bug points out several malformed dg directives, the following
fixes the obvious ones where the testcases keep working after the
change.

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

PR testsuite/100272
* g++.dg/diagnostic/ptrtomem1.C: Fix dg directives.
* g++.dg/ipa/pr45572-2.C: Likewise.
* g++.dg/template/spec26.C: Likewise.
* gcc.dg/pr20126.c: Likewise.
* gcc.dg/tree-ssa/pr20739.c: Likewise.

3 years agotree-optimization/100278 - handle mismatched code in TBAA adjust of PRE
Richard Biener [Tue, 27 Apr 2021 07:41:38 +0000 (09:41 +0200)]
tree-optimization/100278 - handle mismatched code in TBAA adjust of PRE

PRE has code to adjust TBAA behavior for refs that expects the base
operation code to match.  The testcase shows a case where we have
a VAR_DECL vs. a MEM_REF so add code to give up in such cases.

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

PR tree-optimization/100278
* tree-ssa-pre.c (compute_avail): Give up when we cannot
adjust TBAA beacuse of mismatching bases.

* gcc.dg/tree-ssa/pr100278.c: New testcase.

3 years agoi386: Improve [QH]Imode rotates with masked shift count [PR99405]
Jakub Jelinek [Tue, 27 Apr 2021 08:17:45 +0000 (10:17 +0200)]
i386: Improve [QH]Imode rotates with masked shift count [PR99405]

The following testcase shows that while we nicely optimize away the
useless and? of shift count before rotation for [SD]Imode rotates,
we don't do that for [QH]Imode.

The following patch optimizes that by using the right iterator on those
4 patterns.

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

PR target/99405
* config/i386/i386.md (*<insn><mode>3_mask, *<insn><mode>3_mask_1):
For any_rotate define_insn_split and following splitters, use
SWI iterator instead of SWI48.

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

3 years agotree-optimization/99776 - relax condition on vector ctor element extract
Richard Biener [Fri, 26 Mar 2021 08:50:03 +0000 (09:50 +0100)]
tree-optimization/99776 - relax condition on vector ctor element extract

This relaxes the condition for the match.pd pattern doing vector ctor
element extracts to not require type identity but only size equality.
Since we vectorize pointer data as unsigned integer data such mismatches
have to be tolerated to optimize scalar code uses of vector results.

2021-03-26  Richard Biener  <rguenther@suse.de>

PR tree-optimization/99776
* match.pd (bit_field_ref (ctor)): Relax element extract
type compatibility checks.

* gcc.dg/tree-ssa/ssa-fre-91.c: New testcase.

3 years agoSynchronize Rocket Lake's processor_names and processor_cost_table with processor_type
Cui,Lili [Sat, 24 Apr 2021 03:52:17 +0000 (11:52 +0800)]
Synchronize Rocket Lake's processor_names and processor_cost_table with processor_type

gcc/ChangeLog

* common/config/i386/i386-common.c (processor_names):
Sync processor_names with processor_type.
* config/i386/i386-options.c (processor_cost_table):
Sync processor_cost_table with processor_type.

3 years agoDaily bump.
GCC Administrator [Tue, 27 Apr 2021 00:16:30 +0000 (00:16 +0000)]
Daily bump.

3 years agoc++: constexpr pointer indirection with negative offset [PR100209]
Patrick Palka [Mon, 26 Apr 2021 21:30:39 +0000 (17:30 -0400)]
c++: constexpr pointer indirection with negative offset [PR100209]

During constexpr evaluation, a base-to-derived conversion may yield an
expression like (Derived*)(&D.2217.D.2106 p+ -4) where D.2217 is the
derived object and D.2106 is the base.  But cxx_fold_indirect_ref
doesn't know how to resolve an INDIRECT_REF thereof to just D.2217,
because it doesn't handle POINTER_PLUS_EXPR of a COMPONENT_REF with
negative offset well: when the offset N is positive, it knows that
'&x p+ N' is equivalent to '&x.f p+ (N - bytepos(f))', but it doesn't
know about the reverse transformation, that '&x.f p+ N' is equivalent
to '&x p+ (N + bytepos(f))' when N is negative, which is important for
resolving such base-to-derived conversions and for accessing subobjects
backwards.  This patch teaches cxx_fold_indirect_ref this reverse
transformation.

gcc/cp/ChangeLog:

PR c++/100209
* constexpr.c (cxx_fold_indirect_ref): Try to canonicalize the
object/offset pair for a POINTER_PLUS_EXPR of a COMPONENT_REF
with a negative offset into one whose offset is nonnegative
before calling cxx_fold_indirect_ref_1.

gcc/testsuite/ChangeLog:

PR c++/100209
* g++.dg/cpp1y/constexpr-base1.C: New test.
* g++.dg/cpp1y/constexpr-ptrsub1.C: New test.

3 years agoOpenACC: Fix pattern in dg-bogus in Fortran testcases again
Tobias Burnus [Mon, 26 Apr 2021 20:59:21 +0000 (22:59 +0200)]
OpenACC: Fix pattern in dg-bogus in Fortran testcases again

It turned out that a compiler built without offloading support
and one with can produce slightly different diagnostic.

Offloading support implies ENABLE_OFFLOAD which implies that
g->have_offload is set when offloading is actually needed.
In cgraphunit.c, the latter causes flag_generate_offload = 1,
which in turn affects tree.c's free_lang_data.

The result is that the front-end specific diagnostic gets reset
('tree_diagnostics_defaults (global_dc)'), which affects in this
case 'Warning' vs. 'warning' via the Fortran frontend.

Result: 'Warning:' vs. 'warning:'.
Side note: Other FE also override the diagnostic, leading to
similar differences, e.g. the C++ FE outputs mangled function
names differently, cf. patch thread.

libgomp/ChangeLog:

* testsuite/libgomp.oacc-fortran/par-reduction-2-1.f:
Use [Ww]arning in dg-bogus as FE diagnostic and default
diagnostic differ and the result depends on ENABLE_OFFLOAD.
* testsuite/libgomp.oacc-fortran/par-reduction-2-2.f: Likewise.
* testsuite/libgomp.oacc-fortran/parallel-dims.f90: Likewise.
* testsuite/libgomp.oacc-fortran/parallel-reduction.f90: Likewise.

gcc/testsuite/ChangeLog:

* gfortran.dg/goacc/classify-serial.f95:
Use [Ww]arning in dg-bogus as FE diagnostic and default
diagnostic differ and the result depends on ENABLE_OFFLOAD.
* gfortran.dg/goacc/kernels-decompose-2.f95: Likewise.
* gfortran.dg/goacc/routine-module-mod-1.f90: Likewise.

3 years agoHandle anti-ranges of MIN,MAX uniformly.
Aldy Hernandez [Mon, 26 Apr 2021 17:24:09 +0000 (19:24 +0200)]
Handle anti-ranges of MIN,MAX uniformly.

The -fstrict-enums comment in the VR_ANTI_RANGE handling code is out
of date, as out-of-range ranges have already been handled by this
time.  I've removed it.

Furthermore, optimizing ~[MIN,MAX] as VARYING instead of UNDEFINED is
an old idiom.  I've been wanting to change it for a while, but have
only remembered late in the release cycle when it was too risky.

What I've chosen to do in this case is fall through to the code that
normalizes the range.  This will correctly turn ~[MIN,MAX] into
UNDEFINED, yet leaving things alone in the case of -fstrict-enums
where [MIN,MAX] may not necessarily include the entire range of the
underlying precision.  For example, if the domain of a strict enum is
[3,5] setting a VR_ANTI_RANGE of ~[3,5] should not cause neither
VR_UNDEFINED nor VR_VARYING, but just plain ~[3,5].

This is similar to what we do for -fstrict-enums when we set a range
of [3,5].  We leave it as a VR_RANGE, instead of upgrading it to
VR_VARYING.

gcc/ChangeLog:

* value-range.cc (irange::irange_set_1bit_anti_range): Add assert.
(irange::set): Call irange_set_1bit_anti_range for handling all
1-bit ranges.  Fall through on ~[MIN,MAX].

3 years agolibstdc++: Fix internet socket option classes
Jonathan Wakely [Mon, 26 Apr 2021 20:16:21 +0000 (21:16 +0100)]
libstdc++: Fix internet socket option classes

Similar to the previous commit, this fixes various problems with the
socket options classes in the <internet> header:

- The constructors were not noexcept.
- The __sockopt_base<T>::value() member function was present
  unconditionally (so was defined for socket_base::linger which is
  incorrect).
- The __socket_crtp<C, T>::operator=(T) assignment operator was not
  noexcept, and was hidden in the derived classes.
- The MulticastSocketOptions incorrectly used a union, incorrectly
  defined resize and const data() member functions, and their
  constructors were unimplemented.

Also, where appropriate:

- Use class instead of struct for the socket option types.
- Define the _S_level and _S_name constants as private.
- Declare the __socket_crtp base as a friend.

libstdc++-v3/ChangeLog:

* include/experimental/internet (tcp::no_delay, v6_only)
(unicast::hops, multicast::hops, multicast::enable_loopback):
Change access of base class and static data members. Add
using-declaration for __socket_crtp::operator=(_Tp).
(multicast::__mcastopt): New type.
(multicast::join_group, multicast::leave_group): Derive from
__mcastopt for common implementation.
* include/experimental/socket: Add comment.
* testsuite/experimental/net/internet/socket/opt.cc: New test.
* testsuite/experimental/net/socket/socket_base.cc: Check for
protected constructor/destructor of socket_base. Check for
explicit constructors of socket option classes.

3 years agolibstdc++: Fix socket option classes
Jonathan Wakely [Mon, 26 Apr 2021 20:16:21 +0000 (21:16 +0100)]
libstdc++: Fix socket option classes

This fixes some flaws in the socket option types defined in
net::socket_base:

- The constructors were not noexcept.
- The __sockopt_base<T>::value() member function was present
  unconditionally (so was defined for socket_base::linger which is
  incorrect).
- The __socket_crtp<C, T>::operator=(T) assignment operator was not
  noexcept, and was hidden in the derived classes.

Also:

- Use class instead of struct for the socket option types.
- Define the _S_level and _S_name constants as private.
- Declare the __socket_crtp base as a friend.

libstdc++-v3/ChangeLog:

* include/experimental/bits/net.h (__socket_base): Add
bool template parameter to allow BooleanSocketOption and
IntegerSocketOption to have different __socket_base<int>
base classes.
(__socket_base<bool>): Adjust base class.
(__socket_base<int>): Add partial specialization.
(__socket_crtp::operator=(_Tp)): Add noexcept-specifier.
* include/experimental/socket (socket_base::broadcast)
(socket_base::debug, socket_base::do_not_route)
(socket_base::keep_alive, socket_base::linger)
(socket_base::out_of_band_inline)
(socket_base::receive_buffer_size)
(socket_base::receive_low_watermark)
(socket_base::reuse_address, socket_base::send_buffer_size)
(socket_base::send_low_watermark): Add using-declaration for
__socket_crtp::operator=(_Tp).
* testsuite/experimental/net/socket/socket_base.cc: Check
properties of socket option types.

3 years agolibstdc++: Simplify definition of net::ip::resolver_base constants
Jonathan Wakely [Mon, 26 Apr 2021 20:16:20 +0000 (21:16 +0100)]
libstdc++: Simplify definition of net::ip::resolver_base constants

libstdc++-v3/ChangeLog:

* include/experimental/internet (resolver_base::flags): Remove
enumerators. Initialize constants directly with desired values.
Make all operators constexpr and noexcept.
* testsuite/experimental/net/internet/resolver/base.cc: Use
__gnu_test::test_bitmask_values for bitmask type. Check
construction and destruction is protected.

3 years agoOpenACC: Fix pattern in dg-bogus in Fortran testcases
Tobias Burnus [Mon, 26 Apr 2021 19:57:31 +0000 (21:57 +0200)]
OpenACC: Fix pattern in dg-bogus in Fortran testcases

libgomp/ChangeLog:

* testsuite/libgomp.oacc-fortran/par-reduction-2-1.f:
Correct spelling in dg-bogus to match -Wopenacc-parallelism.
* testsuite/libgomp.oacc-fortran/par-reduction-2-2.f: Likewise.
* testsuite/libgomp.oacc-fortran/parallel-dims.f90: Likewise.
* testsuite/libgomp.oacc-fortran/parallel-reduction.f90: Likewise.

gcc/testsuite/ChangeLog:

* gfortran.dg/goacc/classify-serial.f95:
Correct spelling in dg-bogus to match -Wopenacc-parallelism.
* gfortran.dg/goacc/kernels-decompose-2.f95: Likewise.
* gfortran.dg/goacc/routine-module-mod-1.f90: Likewise.

3 years agoCache irange::num_pairs() for non-legacy code.
Aldy Hernandez [Sat, 17 Apr 2021 15:44:37 +0000 (17:44 +0200)]
Cache irange::num_pairs() for non-legacy code.

This does for num_pairs() what my previous patch did for VR_UNDEFINED
and VR_VARYING.

Note that VR_ANTI_RANGE for legacy is always set to 2 ranges.  There
is only one way of representing a range, so a range that can be
represented as a VR_RANGE will never have a kind of VR_ANTI_RANGE.
Also legacy symbolics can also use VR_ANTI_RANGE, but no one will ever
ask for the bounds of such range, so m_num_ranges is irrelevant.

gcc/ChangeLog:

* value-range.cc (irange::legacy_num_pairs): Remove.
(irange::invert): Change gcc_assert to gcc_checking_assert.
* value-range.h (irange::num_pairs): Adjust for a cached
num_pairs().  Also, rename all gcc_assert's to
gcc_checking_assert's.

3 years agoKeep VR_UNDEFINED and VR_VARYING in sync (speeds up evrp by 8.47%).
Aldy Hernandez [Fri, 16 Apr 2021 16:40:44 +0000 (18:40 +0200)]
Keep VR_UNDEFINED and VR_VARYING in sync (speeds up evrp by 8.47%).

Currently multi-ranges calculate the undefined and varying bits on the
fly, whereas legacy uses the m_kind field.  Since we will always have
space in the irange class for a kind field, might as well keep it in
sync as ranges are created, thus speeding up lookups.

This patch, along with an upcoming ones for num_pairs(), speeds up EVRP
by 8.47%, VRP proper by 1.84% and overall compilation by 0.24%.

FWIW, since evrp is such a fast pass, and is hard to measure clock-wise,
we've been using callgrind to estimate improvements.  This has coincided
more or less with -ftime-report numbers (albeit having to run -ftime-report
half a dozen times and use the average).

gcc/ChangeLog:

* value-range.cc (irange::operator=): Set m_kind.
(irange::copy_to_legacy): Handle varying and undefined sources
as a legacy copy since they can be easily copied.
(irange::irange_set): Set m_kind.
(irange::irange_set_anti_range): Same.
(irange::set): Rename normalize_min_max to normalize_kind.
(irange::verify_range): Adjust for multi-ranges having the
m_kind field set.
(irange::irange_union): Set m_kind.
(irange::irange_intersect): Same.
(irange::invert): Same.
* value-range.h (irange::kind): Always return m_kind.
(irange::varying_p): Rename to...
(irange::varying_comptaible_p): ...this.
(irange::undefined_p): Only look at m_kind.
(irange::irange): Always set VR_UNDEFINED if applicable.
(irange::set_undefined): Always set VR_UNDEFINED.
(irange::set_varying): Always set m_kind to VR_VARYING.
(irange::normalize_min_max): Rename to...
(irange::normalize_kind): ...this.

3 years agoRemove irange::varying_p checks from symbolic_p and constant_p.
Aldy Hernandez [Sat, 17 Apr 2021 12:26:33 +0000 (14:26 +0200)]
Remove irange::varying_p checks from symbolic_p and constant_p.

As of a few releases ago, varying_p() ranges are also constant_p.
Consequently, there is no need to check varying_p from either
symbolic_p or constant_p.

I have adjusted a few users of constant_p that were depending on
constant_p returning false for varying_p.  In these cases, I have
placed the varying_p check before the constant_p check to avoid
the more expensive constant_p check when possible.

gcc/ChangeLog:

* gimple-ssa-evrp-analyze.c (evrp_range_analyzer::set_ssa_range_info):
Adjust for constant_p including varying_p.
* tree-vrp.c (vrp_prop::finalize): Same.
(determine_value_range): Same.
* vr-values.c (vr_values::range_of_expr): Same.
* value-range.cc (irange::symbolic_p): Do not check varying_p.
(irange::constant_p): Same.

3 years agoReplace !irange::undefined_p checks with num_ranges > 0 for readability.
Aldy Hernandez [Sat, 17 Apr 2021 12:24:15 +0000 (14:24 +0200)]
Replace !irange::undefined_p checks with num_ranges > 0 for readability.

A few of the undefined_p checks in the irange code are really checking if
there are sub-ranges.  It just so happens that undefined_p is
implemented with num_ranges > 0, so it was a shorthand used throughout.
This shorthand was making the code unreadable.

gcc/ChangeLog:

* value-range.cc (irange::legacy_lower_bound): Replace
  !undefined_p check with num_ranges > 0.
(irange::legacy_upper_bound): Same.
* value-range.h (irange::type): Same.
(irange::lower_bound): Same.
(irange::upper_bound): Same.

3 years agotree-optimization/99956 - improve loop interchange
Richard Biener [Wed, 7 Apr 2021 12:53:40 +0000 (14:53 +0200)]
tree-optimization/99956 - improve loop interchange

When we apply store motion and DSE manually to the bwaves kernel
in gfortran.dg/pr81303.f loop interchange no longer happens because
the perfect nest considered covers outer loops we cannot analyze
strides for.  The following compensates for this by shrinking the
nest in this analysis which was already possible but on a too coarse
granularity.  It shares the shrinked nest with the rest of the DRs
so the complexity overhead should be negligible.

2021-04-07  Richard Biener  <rguenther@suse.de>

PR tree-optimization/99956
* gimple-loop-interchange.cc (compute_access_stride):
Try instantiating the access in a shallower loop nest
if instantiating failed.
(compute_access_strides): Pass adjustable loop_nest
to compute_access_stride.

* gfortran.dg/pr99956.f: New testcase.

3 years agolibstdc++: Add missing headers for errno and std::terminate
Jonathan Wakely [Mon, 26 Apr 2021 11:28:37 +0000 (12:28 +0100)]
libstdc++: Add missing headers for errno and std::terminate

libstdc++-v3/ChangeLog:

* include/bits/semaphore_base.h: Include <exception> and <errno.h>.

3 years agotestsuite/arm: Add arm_cmse_hw effective target
Christophe Lyon [Mon, 26 Apr 2021 11:23:41 +0000 (11:23 +0000)]
testsuite/arm: Add arm_cmse_hw effective target

Some of the CMSE tests have 'dg-do run', but qemu-arm does not support
the privileged instructions involved; one has to use qemu-system-arm
for this, which in turn requires modifications to the default
newlib/libgloss startup code to enable the FPU as the FP status
registers need to be saved when using CMSE code.

This patch introduces arm_cmse_hw, similar to arm_neon_hw, to detect
whether the execution engine supports the CMSE instructions. If not,
we set dg-do-what-default to assemble instead of run. We thus remove
all the 'dg-do run' directives from CMSE tests, to rely on
dg-do-what-default instead.

Note that cmse-16.c used to pass with dg-do run under qemu-arm,
because the property being tested is not available (qemu-arm does not
model secure vs non-secure memory). The patch removes dg-do from it
too, since it is relevant only with an adequate simulator.

Before the patch, bitfield-[123].c and struct-1.c fail at execution
under qemu-arm. With the patch, execution is skipped.

The same tests pass under qemu-system-arm both with and without the
patch.

This avoids failures when testing with
-mthumb/-mfloat-abi=hard/-march=armv8-m.main+fp+dsp under qemu-arm for
cortex-m33.

I'm also running tests with qemu-system-arm for cortex-m33, but I run
only cmse.exp with a patched newlib in this case: I use qemu-arm for
all combinations except that one because it's faster and supports
semihosting.

I do not have a setup to check this with actual hardware or another
simulator.

2021-04-26  Christophe Lyon  <christophe.lyon@linaro.org>

gcc/
* doc/sourcebuild.texi (arm_cmse_hw): Document.

gcc/testsuite/
* gcc.target/arm/cmse/bitfield-1.c: Remove dg-do.
* gcc.target/arm/cmse/bitfield-2.c: Likewise.
* gcc.target/arm/cmse/bitfield-3.c: Likewise.
* gcc.target/arm/cmse/cmse-16.c: Likewise.
* gcc.target/arm/cmse/struct-1.c: Likewise.
* gcc.target/arm/cmse/cmse.exp: Set dg-do-what-default depending
on arm_cmse_hw.
* lib/target-supports.exp (check_effective_target_arm_cmse_hw):
New.

3 years agoaarch64: Handle V4BF V8BF modes in vwcore attribute
Kyrylo Tkachov [Mon, 26 Apr 2021 11:01:33 +0000 (12:01 +0100)]
aarch64: Handle V4BF V8BF modes in vwcore attribute

While playing with other unrelated changes I hit an assemble-failure bug where
a pattern (one of the get_lane ones) that was using V4BF, V8BF as part of a
mode iterator and outputting registers with the vwcore attribute,
but there is no vwcore mapping for V4BF and V8BF.

This patch fixes that in the obvious way by adding the missing mappings

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

gcc/ChangeLog:

* config/aarch64/iterators.md (vwcore): Handle V4BF, V8BF.

3 years agoAdd XFAIL for gcc.dg/pr84877.c on the SPARC
Eric Botcazou [Mon, 26 Apr 2021 10:55:24 +0000 (12:55 +0200)]
Add XFAIL for gcc.dg/pr84877.c on the SPARC

The maximum supported alignment is 64-bit on 32-bit mode.

gcc/testsuite/
* gcc.dg/pr84877.c: XFAIL on SPARC as well.

3 years agolibstdc++: Add missing 'inline' specifiers to net::ip functions [PR 100259]
Jonathan Wakely [Mon, 26 Apr 2021 10:37:38 +0000 (11:37 +0100)]
libstdc++: Add missing 'inline' specifiers to net::ip functions [PR 100259]

libstdc++-v3/ChangeLog:

PR libstdc++/100259
* include/experimental/internet (net::ip::make_error_code)
(net::ip::make_error_condition, net::ip::make_network_v4)
(net::ip::operator==(const udp&, const udp&)): Add 'inline'.

3 years agoAdd '-Wopenacc-parallelism'
Thomas Schwinge [Fri, 23 Apr 2021 10:23:51 +0000 (12:23 +0200)]
Add '-Wopenacc-parallelism'

... to diagnose potentially suboptimal choices regarding OpenACC parallelism.

Not enabled by default: too noisy ("*potentially* suboptimal choices"); see
XFAILed 'dg-bogus'es.

gcc/c-family/
* c.opt (Wopenacc-parallelism): New.
gcc/fortran/
* lang.opt (Wopenacc-parallelism): New.
gcc/
* omp-offload.c (oacc_validate_dims): Implement
'-Wopenacc-parallelism'.
* doc/invoke.texi (-Wopenacc-parallelism): Document.
gcc/testsuite/
* c-c++-common/goacc/diag-parallelism-1.c: New.
* c-c++-common/goacc/acc-icf.c: Specify '-Wopenacc-parallelism',
and match diagnostics, as appropriate.
* c-c++-common/goacc/classify-kernels-unparallelized.c: Likewise.
* c-c++-common/goacc/classify-kernels.c: Likewise.
* c-c++-common/goacc/classify-parallel.c: Likewise.
* c-c++-common/goacc/classify-routine.c: Likewise.
* c-c++-common/goacc/classify-serial.c: Likewise.
* c-c++-common/goacc/kernels-decompose-1.c: Likewise.
* c-c++-common/goacc/kernels-decompose-2.c: Likewise.
* c-c++-common/goacc/parallel-dims-1.c: Likewise.
* c-c++-common/goacc/parallel-reduction.c: Likewise.
* c-c++-common/goacc/pr70688.c: Likewise.
* c-c++-common/goacc/routine-1.c: Likewise.
* c-c++-common/goacc/routine-level-of-parallelism-2.c: Likewise.
* c-c++-common/goacc/uninit-dim-clause.c: Likewise.
* gfortran.dg/goacc/classify-kernels-unparallelized.f95: Likewise.
* gfortran.dg/goacc/classify-kernels.f95: Likewise.
* gfortran.dg/goacc/classify-parallel.f95: Likewise.
* gfortran.dg/goacc/classify-routine.f95: Likewise.
* gfortran.dg/goacc/classify-serial.f95: Likewise.
* gfortran.dg/goacc/kernels-decompose-1.f95: Likewise.
* gfortran.dg/goacc/kernels-decompose-2.f95: Likewise.
* gfortran.dg/goacc/parallel-tree.f95: Likewise.
* gfortran.dg/goacc/routine-4.f90: Likewise.
* gfortran.dg/goacc/routine-level-of-parallelism-1.f90: Likewise.
* gfortran.dg/goacc/routine-module-mod-1.f90: Likewise.
* gfortran.dg/goacc/routine-multiple-directives-1.f90: Likewise.
* gfortran.dg/goacc/uninit-dim-clause.f95: Likewise.
libgomp/
* testsuite/libgomp.oacc-c-c++-common/firstprivate-1.c: Specify
'-Wopenacc-parallelism', and match diagnostics, as appropriate.
* testsuite/libgomp.oacc-c-c++-common/loop-auto-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/loop-red-w-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/loop-red-w-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/loop-w-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/mode-transitions.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/par-reduction-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/par-reduction-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/parallel-dims.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/parallel-reduction.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/pr85381-3.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/private-variables.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/reduction-5.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/reduction-7.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/routine-g-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/routine-w-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/routine-wv-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/static-variable-1.c:
Likewise.
* testsuite/libgomp.oacc-fortran/optional-private.f90: Likewise.
* testsuite/libgomp.oacc-fortran/par-reduction-2-1.f: Likewise.
* testsuite/libgomp.oacc-fortran/par-reduction-2-2.f: Likewise.
* testsuite/libgomp.oacc-fortran/parallel-dims.f90: Likewise.
* testsuite/libgomp.oacc-fortran/parallel-reduction.f90: Likewise.
* testsuite/libgomp.oacc-fortran/pr84028.f90: Likewise.
* testsuite/libgomp.oacc-fortran/private-variables.f90: Likewise.
* testsuite/libgomp.oacc-fortran/reduction-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/reduction-5.f90: Likewise.
* testsuite/libgomp.oacc-fortran/reduction-6.f90: Likewise.
* testsuite/libgomp.oacc-fortran/routine-7.f90: Likewise.

Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com>
Co-Authored-By: Tom de Vries <vries@codesourcery.com>
Co-Authored-By: Julian Brown <julian@codesourcery.com>
Co-Authored-By: Kwok Cheung Yeung <kcy@codesourcery.com>
3 years ago[OpenACC] Don't compile libgomp testcases with '-w'
Thomas Schwinge [Fri, 16 Apr 2021 14:08:19 +0000 (16:08 +0200)]
[OpenACC] Don't compile libgomp testcases with '-w'

We'd like to actually catch compiler diagnostics (and currently there aren't
any).

libgomp/
* testsuite/libgomp.oacc-c-c++-common/par-reduction-1.c: Don't
compile with '-w'.
* testsuite/libgomp.oacc-c-c++-common/par-reduction-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/parallel-reduction.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/reduction-5.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/reduction-6.c: Likewise.
* testsuite/libgomp.oacc-fortran/parallel-reduction.f90: Likewise.
* testsuite/libgomp.oacc-fortran/reduction-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/reduction-5.f90: Likewise.
* testsuite/libgomp.oacc-fortran/reduction-6.f90: Likewise.
* testsuite/libgomp.oacc-fortran/reduction-7.f90: Likewise.

3 years agoMove gimplify_buildN API local to only remaining user
Richard Biener [Thu, 15 Apr 2021 11:03:21 +0000 (13:03 +0200)]
Move gimplify_buildN API local to only remaining user

This moves the legacy gimplify_buildN API to tree-vect-generic.c,
its only user and elides the gimplification step, making it a wrapper
around gimple_build, adjusting tree_vec_extract for this.

I've noticed that vector CTOR expansion doesn't deal with unfolded
{} and thus this makes it more resilent.  I've also adjusted the
match.pd vector CTOR extraction code to make sure it doesn't
produce a CTOR when folding would make it a vector constant.

2021-04-15  Richard Biener  <rguenther@suse.de>

* tree-cfg.h (gimplify_build1): Remove.
(gimplify_build2): Likewise.
(gimplify_build3): Likewise.
* tree-cfg.c (gimplify_build1): Move to tree-vect-generic.c.
(gimplify_build2): Likewise.
(gimplify_build3): Likewise.
* tree-vect-generic.c (gimplify_build1): Move from tree-cfg.c.
Modernize.
(gimplify_build2): Likewise.
(gimplify_build3): Likewise.
(tree_vec_extract): Use resimplify with following SSA edges.
(expand_vector_parallel): Avoid passing NULL size/bitpos
to tree_vec_extract.
* expr.c (store_constructor): Deal with zero-element CTORs.
* match.pd (bit_field_ref <vector CTOR>): Make sure to
produce vector constants when possible.

3 years agoRemove gimplify_buildN API use from complex lowering
Richard Biener [Thu, 15 Apr 2021 09:52:16 +0000 (11:52 +0200)]
Remove gimplify_buildN API use from complex lowering

This removes the legacy gimplify_buildN API use from complex lowering.

2021-04-15  Richard Biener  <rguenther@suse.de>

* tree-complex.c: Include gimple-fold.h.
(expand_complex_addition): Use gimple_build.
(expand_complex_multiplication_components): Likewise.
(expand_complex_multiplication): Likewise.
(expand_complex_div_straight): Likewise.
(expand_complex_div_wide): Likewise.
(expand_complex_division): Likewise.
(expand_complex_conjugate): Likewise.
(expand_complex_comparison): Likewise.

3 years agoRemove gimplify_buildN API use from phiopt
Richard Biener [Thu, 15 Apr 2021 09:06:09 +0000 (11:06 +0200)]
Remove gimplify_buildN API use from phiopt

This removes use of the legacy gimplify_buildN API from phiopt.

2021-04-15  Richard Biener  <rguenther@suse.de>

* tree-ssa-phiopt.c (two_value_replacement): Remove use
of legacy gimplify_buildN API.

3 years agotree-optimization/99473 - more cselim
Richard Biener [Tue, 9 Mar 2021 08:29:29 +0000 (09:29 +0100)]
tree-optimization/99473 - more cselim

This fixes the pre-condition on cselim to include all references
and decls when they end up as auto-var.

Bootstrapped/tested on x86_64-linux

2021-03-09  Richard Biener  <rguenther@suse.de>

PR tree-optimization/99473
* tree-ssa-phiopt.c (cond_store_replacement): Handle all
stores.

* gcc.dg/tree-ssa/pr99473-1.c: New testcase.

3 years agoSimplify {gimplify_and_,}update_call_from_tree API
Richard Biener [Wed, 14 Apr 2021 11:40:58 +0000 (13:40 +0200)]
Simplify {gimplify_and_,}update_call_from_tree API

This removes update_call_from_tree in favor of
gimplify_and_update_call_from_tree, removing some code duplication
and simplifying the API use.  Some users of update_call_from_tree
have been transitioned to replace_call_with_value and the API
and its dependences have been moved to gimple-fold.h.

This shaves off another user of valid_gimple_rhs_p which is now
only used from within gimple-fold.c and thus moved and made private.

2021-04-14  Richard Biener  <rguenther@suse.de>

* tree-ssa-propagate.h (valid_gimple_rhs_p): Remove.
(update_gimple_call): Likewise.
(update_call_from_tree): Likewise.
* tree-ssa-propagate.c (valid_gimple_rhs_p): Remove.
(valid_gimple_call_p): Likewise.
(move_ssa_defining_stmt_for_defs): Likewise.
(finish_update_gimple_call): Likewise.
(update_gimple_call): Likewise.
(update_call_from_tree): Likewise.
(propagate_tree_value_into_stmt): Use replace_call_with_value.
* gimple-fold.h (update_gimple_call): Declare.
* gimple-fold.c (valid_gimple_rhs_p): Move here from
tree-ssa-propagate.c.
(update_gimple_call): Likewise.
(valid_gimple_call_p): Likewise.
(finish_update_gimple_call): Likewise, and simplify.
(gimplify_and_update_call_from_tree): Implement
update_call_from_tree functionality, avoid excessive
push/pop_gimplify_context.
(gimple_fold_builtin): Use only gimplify_and_update_call_from_tree.
(gimple_fold_call): Likewise.
* gimple-ssa-sprintf.c (try_substitute_return_value): Likewise.
* tree-ssa-ccp.c (ccp_folder::fold_stmt): Likewise.
(pass_fold_builtins::execute): Likewise.
(optimize_stack_restore): Use replace_call_with_value.
* tree-cfg.c (fold_loop_internal_call): Likewise.
* tree-ssa-dce.c (maybe_optimize_arith_overflow): Use
only gimplify_and_update_call_from_tree.
* tree-ssa-strlen.c (handle_builtin_strlen): Likewise.
(handle_builtin_strchr): Likewise.
* tsan.c: Include gimple-fold.h instead of tree-ssa-propagate.h.

* config/rs6000/rs6000-call.c (rs6000_gimple_fold_builtin):
Use replace_call_with_value.

3 years agovmsdbgout: Remove useless register keywords
Jakub Jelinek [Mon, 26 Apr 2021 07:59:15 +0000 (09:59 +0200)]
vmsdbgout: Remove useless register keywords

register keyword was removed in C++17, and in vmsdbgout.c it served no
useful purpose.

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

PR debug/100255
* vmsdbgout.c (ASM_OUTPUT_DEBUG_STRING, vmsdbgout_begin_block,
vmsdbgout_end_block, lookup_filename, vmsdbgout_source_line): Remove
register keywords.

3 years agoDaily bump.
GCC Administrator [Mon, 26 Apr 2021 00:16:26 +0000 (00:16 +0000)]
Daily bump.

3 years agoAdd folding and remove expanders for x86 *pcmp{et,gt}* builtins [PR target/98911]
liuhongt [Tue, 23 Feb 2021 03:17:40 +0000 (11:17 +0800)]
Add folding and remove expanders for x86 *pcmp{et,gt}* builtins [PR target/98911]

gcc/ChangeLog:

PR target/98911
* config/i386/i386-builtin.def (BDESC): Change the icode of
the following builtins to CODE_FOR_nothing.
* config/i386/i386.c (ix86_gimple_fold_builtin): Fold
IX86_BUILTIN_PCMPEQB128, IX86_BUILTIN_PCMPEQW128,
IX86_BUILTIN_PCMPEQD128, IX86_BUILTIN_PCMPEQQ,
IX86_BUILTIN_PCMPEQB256, IX86_BUILTIN_PCMPEQW256,
IX86_BUILTIN_PCMPEQD256, IX86_BUILTIN_PCMPEQQ256,
IX86_BUILTIN_PCMPGTB128, IX86_BUILTIN_PCMPGTW128,
IX86_BUILTIN_PCMPGTD128, IX86_BUILTIN_PCMPGTQ,
IX86_BUILTIN_PCMPGTB256, IX86_BUILTIN_PCMPGTW256,
IX86_BUILTIN_PCMPGTD256, IX86_BUILTIN_PCMPGTQ256.
* config/i386/sse.md (avx2_eq<mode>3): Deleted.
(sse2_eq<mode>3): Ditto.
(sse4_1_eqv2di3): Ditto.
(sse2_gt<mode>3): Rename to ..
(*sse2_gt<mode>3): .. this.

gcc/testsuite/ChangeLog:

PR target/98911
* gcc.target/i386/pr98911.c: New test.
* gcc.target/i386/funcspec-8.c: Replace __builtin_ia32_pcmpgtq
with __builtin_ia32_pcmpistrm128 since it has been folded.

3 years agoDaily bump.
GCC Administrator [Sun, 25 Apr 2021 00:16:26 +0000 (00:16 +0000)]
Daily bump.

3 years agoanalyzer: fix ICE on NULL change.m_expr [PR100244]
David Malcolm [Sat, 24 Apr 2021 23:49:31 +0000 (19:49 -0400)]
analyzer: fix ICE on NULL change.m_expr [PR100244]

PR analyzer/100244 reports an ICE on a -Wanalyzer-free-of-non-heap
due to a case where free_of_non_heap::describe_state_change can be
passed a NULL change.m_expr for a suitably complicated symbolic value.

Bulletproof it by checking for change.m_expr being NULL before
dereferencing it.

gcc/analyzer/ChangeLog:
PR analyzer/100244
* sm-malloc.cc (free_of_non_heap::describe_state_change):
Bulletproof against change.m_expr being NULL.

gcc/testsuite/ChangeLog:
PR analyzer/100244
* g++.dg/analyzer/pr100244.C: New test.

3 years agoPR fortran/100154 - ICE in gfc_conv_procedure_call, at fortran/trans-expr.c:6131
Harald Anlauf [Sat, 24 Apr 2021 18:51:41 +0000 (20:51 +0200)]
PR fortran/100154 - ICE in gfc_conv_procedure_call, at fortran/trans-expr.c:6131

Add appropriate static checks for the character and status arguments to
the GNU Fortran intrinsic extensions fget[c], fput[c].  Extend variable
check to allow a function reference having a data pointer result.

gcc/fortran/ChangeLog:

PR fortran/100154
* check.c (variable_check): Allow function reference having a data
pointer result.
(arg_strlen_is_zero): New function.
(gfc_check_fgetputc_sub): Add static check of character and status
arguments.
(gfc_check_fgetput_sub): Likewise.
* intrinsic.c (add_subroutines): Fix argument name for the
character argument to intrinsic subroutines fget[c], fput[c].

gcc/testsuite/ChangeLog:

PR fortran/100154
* gfortran.dg/pr100154.f90: New test.

3 years agoFortran - allow target of pointer from evaluation of function-reference
Harald Anlauf [Sat, 24 Apr 2021 18:38:06 +0000 (20:38 +0200)]
Fortran - allow target of pointer from evaluation of function-reference

Fortran allows the target of a pointer from the evaluation of a
function-reference in a variable definition context (e.g. F2018:R902).

gcc/fortran/ChangeLog:

PR fortran/100218
* expr.c (gfc_check_vardef_context): Extend check to allow pointer
from a function reference.

gcc/testsuite/ChangeLog:

PR fortran/100218
* gfortran.dg/ptr-func-4.f90: New test.

3 years agoRevert "Darwin : Adjust darwin_binds_local_p for PIC code [PR100152]."
Iain Sandoe [Sat, 24 Apr 2021 18:28:25 +0000 (19:28 +0100)]
Revert "Darwin : Adjust darwin_binds_local_p for PIC code [PR100152]."

Unfortunately, although this is required to fix the PR, and is
notionally correct, it regresses some of the sanitizer and IPA
tests.  Reverting until this can be analysed.

This reverts commit b6600392bf71c4a9785f8f49948b611425896830.

3 years agotestuite: fix libtdc++ libatomic flags
David Edelsohn [Fri, 23 Apr 2021 21:45:10 +0000 (17:45 -0400)]
testuite: fix libtdc++ libatomic flags

Some ports require libatomic for atomic operations, at least for some
data types and widths.  The libstdc++ testsuite previously was updated
to link against libatomic, but the search path was hard-coded to
something that is not always correct, and the shared library search
path was not set.

The search path was hard-coded to the expected location of the
libatomic build directory relative to the libstdc++ testsuite
directory, but if one uses parallelism when invoking the libstdc++
testsuite, the tests are run in the "normalXX" sub-directories, for
which the hard-coded search path is incorrect. The path also is
incorrect for alternative multilib and tool options.

This patch adopts the logic from gcc/testsuite/lib/atomic-dg.exp to
search for the library and adds the logic to the libstdc++ testsuite
libatomic seatch path code.  Previously the libstdc++ testsuite atomic
tests failed depending on the build configuration and if a build of
libatomic was installed in the default search path.

Bootstrapped on powerpc-ibm-aix7.2.3.0.

libstdc++-v3/ChangeLog:

* testsuite/lib/dg-options.exp (atomic_link_flags): New.
(add_options_for_libatomic): Use atomic_link_flags.

3 years agoDarwin : Adjust darwin_binds_local_p for PIC code [PR100152].
Iain Sandoe [Sat, 24 Apr 2021 12:34:49 +0000 (13:34 +0100)]
Darwin : Adjust darwin_binds_local_p for PIC code [PR100152].

Darwin's dynamic linker supports interposition and lazy symbol binding.
If we are generating PIC code and a symbol is public, then it could
potentially be indirected via a lazy-resolver stub; we cannot tell at
compile-time if this will be done (since the indirection can be the
result of adding a -flat-namespace option at link-time).  Here we are
conservative and assume that any such symbol cannot bind locally.
The default implementation for binds_local_p handles undefined, weak and
common symbols which are always indirected (for mdynamic-no-pic also).

gcc/ChangeLog:

PR target/100152
* config/darwin.c (darwin_binds_local_p): Assume that any
public symbol might be interposed for PIC code. Update function
header comment to reflect current Darwin capability.

3 years agoAdjust guality xfails for aarch64*-*-*
Richard Sandiford [Sat, 24 Apr 2021 08:35:16 +0000 (09:35 +0100)]
Adjust guality xfails for aarch64*-*-*

This patch gives clean guality.exp test results for aarch64-linux-gnu
with modern (top-of-tree) gdb.

For people using older gdbs, it will trade one set of noisy results for
another set.  I still think it's better to have the xfails based on
one “clean” and “modern” run rather than have FAILs and XPASSes for
all runs.

It's hard to tell which of these results are aarch64-specific and
which aren't.  If other target maintainers want to do something similar,
and are prepared to assume the same gdb version, then it should become
clearer over time which ones are target-specific and which aren't.

There are no new skips here, so changes in test results will still
show up as XPASSes.

I've not analysed the failures or filed PRs for them.  In some
ways the guality directory itself seems like the best place to
start looking for xfails, if someone's interested in working
in this area.

gcc/testsuite/
* gcc.dg/guality/example.c: Update aarch64*-*-* xfails.
* gcc.dg/guality/guality.c: Likewise.
* gcc.dg/guality/inline-params.c: Likewise.
* gcc.dg/guality/loop-1.c: Likewise.
* gcc.dg/guality/pr36728-1.c: Likewise.
* gcc.dg/guality/pr36728-2.c: Likewise.
* gcc.dg/guality/pr36728-3.c: Likewise.
* gcc.dg/guality/pr41447-1.c: Likewise.
* gcc.dg/guality/pr54200.c:  Likewise.
* gcc.dg/guality/pr54519-1.c: Likewise.
* gcc.dg/guality/pr54519-2.c: Likewise.
* gcc.dg/guality/pr54519-3.c: Likewise.
* gcc.dg/guality/pr54519-4.c: Likewise.
* gcc.dg/guality/pr54519-5.c: Likewise.
* gcc.dg/guality/pr54519-6.c: Likewise.
* gcc.dg/guality/pr54693-2.c: Likewise.
* gcc.dg/guality/pr56154-1.c: Likewise.
* gcc.dg/guality/pr59776.c: Likewise.
* gcc.dg/guality/pr68860-1.c: Likewise.
* gcc.dg/guality/pr68860-2.c: Likewise.
* gcc.dg/guality/pr90074.c: Likewise.
* gcc.dg/guality/pr90716.c: Likewise.
* gcc.dg/guality/sra-1.c: Likewise.

3 years agoAdd dg-final option-based target selectors
Richard Sandiford [Sat, 24 Apr 2021 08:35:16 +0000 (09:35 +0100)]
Add dg-final option-based target selectors

This patch adds target selectors of the form:

  { any-opts "opt1" ... "optn" }
  { no-opts "opt1" ... "optn" }

for skipping or xfailing tests based on compiler options.  It only
works for dg-final selectors.

The patch then uses no-opts to exclude -O0 and (sometimes) -Og from
some guality.exp xfails.  AFAICT (based on gcc-testresults) these
tests pass for those options for all targets.

gcc/
* doc/sourcebuild.texi: Document no-opts and any-opts target
selectors.

gcc/testsuite/
* lib/target-supports-dg.exp (selector_expression): Handle any-opts
and no-opts.
* gcc.dg/guality/pr41353-1.c: Exclude -O0 from xfail.
* gcc.dg/guality/pr59776.c: Likewise.
* gcc.dg/guality/pr54970.c: Likewise -O0 and -Og.

3 years agoc++: do_class_deduction and dependent init [PR93383]
Patrick Palka [Sat, 24 Apr 2021 04:14:29 +0000 (00:14 -0400)]
c++: do_class_deduction and dependent init [PR93383]

Here we're crashing during CTAD with a dependent initializer (performed
from convert_template_argument) because one of the initializer's
elements has an empty TREE_TYPE, which ends up making resolve_args
unhappy.

Besides the case where we're initializing one template placeholder
from another, which is already specifically handled earlier in
do_class_deduction, it seems we can't in general correctly resolve a
template placeholder using a dependent initializer, so this patch makes
the function just punt until instantiation time instead.

gcc/cp/ChangeLog:

PR c++/89565
PR c++/93383
PR c++/95291
PR c++/99200
PR c++/99683
* pt.c (do_class_deduction): Punt if the initializer is
type-dependent.

gcc/testsuite/ChangeLog:

PR c++/89565
PR c++/93383
PR c++/95291
PR c++/99200
PR c++/99683
* g++.dg/cpp2a/nontype-class39.C: Remove dg-ice directive.
* g++.dg/cpp2a/nontype-class45.C: New test.
* g++.dg/cpp2a/nontype-class46.C: New test.
* g++.dg/cpp2a/nontype-class47.C: New test.
* g++.dg/cpp2a/nontype-class48.C: New test.

3 years agoc++: Hard error with tentative parse and CTAD [PR87709]
Patrick Palka [Sat, 24 Apr 2021 04:01:42 +0000 (00:01 -0400)]
c++: Hard error with tentative parse and CTAD [PR87709]

When parsing e.g. the operand of sizeof, where both types and
expressions are accepted, if during the tentative type parse we
encounter an unexpected template placeholder, we must simulate
an error rather than issue a real error because the expression
parse can still succeed.

gcc/cp/ChangeLog:

PR c++/87709
* parser.c (cp_parser_type_id_1): If we see a template
placeholder, first try simulating an error before issuing
a real error.

gcc/testsuite/ChangeLog:

PR c++/87709
* g++.dg/cpp1z/class-deduction86.C: New test.

3 years agoDaily bump.
GCC Administrator [Sat, 24 Apr 2021 00:16:37 +0000 (00:16 +0000)]
Daily bump.

3 years agoFix logic error in 32-bit trampolines.
Michael Meissner [Fri, 23 Apr 2021 22:16:03 +0000 (18:16 -0400)]
Fix logic error in 32-bit trampolines.

The test in the PowerPC 32-bit trampoline support is backwards.  It aborts
if the trampoline size is greater than the expected size.  It should abort
when the trampoline size is less than the expected size.  I fixed the test
so the operands are reversed.  I then folded the load immediate into the
compare instruction.

I verified this by creating a 32-bit trampoline program and manually
changing the size of the trampoline to be 48 instead of 40.  The program
aborted with the larger size.  I updated this code and ran the test again
and it passed.

I added a test case that runs on PowerPC 32-bit Linux systems and it calls
the __trampoline_setup function with a larger buffer size than the
compiler uses.  The test is not run on 64-bit systems, since the function
__trampoline_setup is not called.  I also limited the test to just Linux
systems, in case trampolines are handled differently in other systems.

libgcc/
2021-04-23  Michael Meissner  <meissner@linux.ibm.com>

PR target/98952
* config/rs6000/tramp.S (__trampoline_setup, elfv1 #ifdef): Fix
trampoline size comparison in 32-bit by reversing test and
combining load immediate with compare.
(__trampoline_setup, elfv2 #ifdef): Fix trampoline size comparison
in 32-bit by reversing test and combining load immediate with
compare.

gcc/testsuite/
2021-04-23  Michael Meissner  <meissner@linux.ibm.com>

PR target/98952
* gcc.target/powerpc/pr98952.c: New test.

3 years agobpf: allow BSS symbols to be global symbols
YiFei Zhu [Thu, 22 Apr 2021 10:05:57 +0000 (05:05 -0500)]
bpf: allow BSS symbols to be global symbols

Prior to this, a BSS declaration such as:

  int foo;
  static int bar;

Generates:

  .global foo
  .local  foo
  .comm   foo,4,4
  .local  bar
  .comm   bar,4,4

Creating symbols:

  0000000000000000 b foo
  0000000000000004 b bar

Both symbols are local. However, libbpf bpf_object__variable_offset
rquires symbols to be STB_GLOBAL & STT_OBJECT for data section lookup.
This patch makes the same declaration generate:

  .global foo
  .type   foo, @object
  .lcomm  foo,4,4
  .local  bar
  .comm   bar,4,4

Creating symbols:

  0000000000000000 B foo
  0000000000000004 b bar

And libbpf will be okay with looking up the global symbol "foo".

2021-04-22  YiFei Zhu  <zhuyifei1999@gmail.com>

gcc/

* config/bpf/bpf.h (ASM_OUTPUT_ALIGNED_BSS): Use .type and .lcomm.

3 years agobpf: align function entry point to 64 bits
YiFei Zhu [Thu, 22 Apr 2021 10:05:56 +0000 (05:05 -0500)]
bpf: align function entry point to 64 bits

Libbpf does not treat paddings after functions well. If function
symbols does not cover a whole text section, it will emit error
similar to:

  libbpf: sec '.text': failed to find program symbol at offset 56

Each instruction in BPF is a multiple of 8 bytes, so align the
functions to 8 bytes, similar to how clang does it.

2021-04-22  YiFei Zhu  <zhuyifei1999@gmail.com>

gcc/

* config/bpf/bpf.h (FUNCTION_BOUNDARY): Set to 64.

3 years agoi386: Reject -m96bit-long-double for 64bit targets [PR100041]
Uros Bizjak [Fri, 23 Apr 2021 16:45:14 +0000 (18:45 +0200)]
i386: Reject -m96bit-long-double for 64bit targets [PR100041]

64bit targets default to 128bit long double, so -m96bit-long-double should
not be used.  Together with -m128bit-long-double, this option was intended
to be an optimization for 32bit targets only.

Error out when -m96bit-long-double is used with 64bit targets.

2021-04-23  Uroš Bizjak  <ubizjak@gmail.com>

gcc/
PR target/100041
* config/i386/i386-options.c (ix86_option_override_internal):
Error out when -m96bit-long-double is used with 64bit targets.
* config/i386/i386.md (*pushxf_rounded): Remove pattern.

gcc/testsuite/

PR target/100041
* gcc.target/i386/pr79514.c (dg-error):
Expect error for 64bit targets.

3 years agoRemove not feasible FIXME
Martin Liska [Thu, 22 Apr 2021 07:14:28 +0000 (09:14 +0200)]
Remove not feasible FIXME

gcc/ChangeLog:

* lto-wrapper.c: Remove FIXME about usage of
hardware_concurrency. The function is not on par with
what we have now.

3 years agoMAINTAINERS: Add myself for write after approval
David Faust [Fri, 23 Apr 2021 16:12:43 +0000 (09:12 -0700)]
MAINTAINERS: Add myself for write after approval

ChangeLog:

2021-04-23  David Faust  <david.faust@oracle.com>

* MAINTAINERS (Write After Approval): Add myself.

3 years agoi386: Fix atomic FP peepholes [PR100182]
Uros Bizjak [Fri, 23 Apr 2021 15:29:29 +0000 (17:29 +0200)]
i386: Fix atomic FP peepholes [PR100182]

64bit loads to/stores from x87 and SSE registers are atomic also on 32-bit
targets, so there is no need for additional atomic moves to a temporary
register.

Introduced load peephole2 patterns assume that there won't be any additional
loads from the load location outside the peepholed sequence and wrongly
removed the source location initialization.

OTOH, introduced store peephole2 patterns assume there won't be any additional
loads from the stored location outside the peepholed sequence and wrongly
removed the destination location initialization.  Note that we can't use plain
x87 FST instruction to initialize destination location because FST converts
the value to the double-precision format, changing bits during move.

The patch restores removed initializations in load and store patterns.
Additionally, plain x87 FST in store peephole2 patterns is prevented by
limiting the store operand source to SSE registers.

2021-04-23  Uroš Bizjak  <ubizjak@gmail.com>

gcc/
PR target/100182
* config/i386/sync.md (FILD_ATOMIC/FIST_ATOMIC FP load peephole2):
Copy operand 3 to operand 4.  Use sse_reg_operand
as operand 3 predicate.
(FILD_ATOMIC/FIST_ATOMIC FP load peephole2 with mem blockage): Ditto.
(LDX_ATOMIC/STX_ATOMIC FP load peephole2): Ditto.
(LDX_ATOMIC/LDX_ATOMIC FP load peephole2 with mem blockage): Ditto.
(FILD_ATOMIC/FIST_ATOMIC FP store peephole2):
Copy operand 1 to operand 0.
(FILD_ATOMIC/FIST_ATOMIC FP store peephole2 with mem blockage): Ditto.
(LDX_ATOMIC/STX_ATOMIC FP store peephole2): Ditto.
(LDX_ATOMIC/LDX_ATOMIC FP store peephole2 with mem blockage): Ditto.

gcc/testsuite/

PR target/100182
* gcc.target/i386/pr100182.c: New test.
* gcc.target/i386/pr71245-1.c (dg-final): Xfail scan-assembler-not.
* gcc.target/i386/pr71245-2.c (dg-final): Ditto.

3 years agoearly-remat.c: Fix new/delete mismatch [PR100230]
Alex Coplan [Fri, 23 Apr 2021 13:09:15 +0000 (14:09 +0100)]
early-remat.c: Fix new/delete mismatch [PR100230]

This simple patch fixes a mistmatched operator new/delete in
early-remat.c which triggers ASan errors on (at least) AArch64 when
compiling SVE code.

gcc/ChangeLog:

PR rtl-optimization/100230
* early-remat.c (early_remat::sort_candidates): Use delete[]
instead of delete for array allocated with new[].

3 years agolibstdc++: Allow net::io_context to compile without <poll.h> [PR 100180]
Jonathan Wakely [Fri, 23 Apr 2021 12:38:05 +0000 (13:38 +0100)]
libstdc++: Allow net::io_context to compile without <poll.h> [PR 100180]

This adds dummy placeholders to net::io_context so that it can still be
compiled on targets without <poll.h>.

libstdc++-v3/ChangeLog:

PR libstdc++/100180
* include/experimental/io_context (io_context): Define
dummy_pollfd type so that most member functions still compile
without <poll.h> and struct pollfd.

3 years agolibstdc++: Clarify argument to net::io_context::async_wait
Jonathan Wakely [Fri, 23 Apr 2021 12:31:33 +0000 (13:31 +0100)]
libstdc++: Clarify argument to net::io_context::async_wait

Add a comment documenting the __w parameter of the private
ios_context::async_wait function. Add casts to callers, making the
conversions explicit.

libstdc++-v3/ChangeLog:

* include/experimental/io_context (io_context::async_wait): Add
comment.
* include/experimental/socket (basic_socket::async_connect):
Cast wait_type constant to int.
(basic_datagram_socket::async_receive): Likewise.
(basic_datagram_socket::async_receive_from): Likewise.
(basic_datagram_socket::async_send): Likewise.
(basic_datagram_socket::async_send_to): Likewise.
(basic_stream_socket::async_receive): Likewise.
(basic_stream_socket::async_send): Likewise. Use io_context
parameter directly, instead of via an executor.
(basic_socket_acceptor::async_accept): Likewise.

3 years agolibstdc++ Simplify definition of net::socket_base constants
Jonathan Wakely [Fri, 23 Apr 2021 12:25:56 +0000 (13:25 +0100)]
libstdc++ Simplify definition of net::socket_base constants

libstdc++-v3/ChangeLog:

* include/experimental/socket (socket_base::shutdown_type):
(socket_base::wait_type, socket_base::message_flags):
Remove enumerators. Initialize constants directly with desired
values.
(socket_base::message_flags): Make all operators constexpr and
noexcept.
* testsuite/util/testsuite_common_types.h (test_bitmask_values):
New test utility.
* testsuite/experimental/net/socket/socket_base.cc: New test.

3 years agoc++: Fix pretty printing pointer to function type [PR98767]
Patrick Palka [Fri, 23 Apr 2021 12:47:02 +0000 (08:47 -0400)]
c++: Fix pretty printing pointer to function type [PR98767]

When pretty printing a pointer to function type,
pp_cxx_parameter_declaration_clause ends up always outputting an empty
function parameter list because the loop that outputs the list iterates
over 'args' instead of 'types', and 'args' is empty when a FUNCTION_TYPE
is passed to this routine (as opposed to a FUNCTION_DECL).

This patch fixes this by making the loop iterate over 'types' instead.
This patch also moves the retrofitted chain-of-PARM_DECLs printing from
here to pp_cxx_requires_expr, the only caller that uses it.  Doing so
lets us easily output the trailing '...' in the parameter list of a
variadic function, which this patch also implements.

gcc/cp/ChangeLog:

PR c++/98767
* cxx-pretty-print.c (pp_cxx_parameter_declaration_clause):
Adjust parameter list loop to iterate over 'types' instead of
'args'.  Output the trailing '...' for a variadic function.
Remove PARM_DECL support.
(pp_cxx_requires_expr): Pretty print the parameter list directly
instead of going through pp_cxx_parameter_declaration_clause.

gcc/testsuite/ChangeLog:

PR c++/98767
* g++.dg/concepts/diagnostic17.C: New test.

3 years agoc++: Refine enum direct-list-initialization [CWG2374]
Patrick Palka [Fri, 23 Apr 2021 12:28:58 +0000 (08:28 -0400)]
c++: Refine enum direct-list-initialization [CWG2374]

This implements the wording changes of CWG2374, which clarifies the
wording of P0138 to forbid e.g. direct-list-initialization of a scoped
enumeration from a different scoped enumeration.

gcc/cp/ChangeLog:

DR 2374
* decl.c (is_direct_enum_init): Check the implicit
convertibility requirement added by CWG 2374.

gcc/testsuite/ChangeLog:

DR 2374
* g++.dg/cpp1z/direct-enum-init2.C: New test.

3 years agoVEC_COND_EXPR code cleanup
Richard Biener [Wed, 14 Apr 2021 08:53:30 +0000 (10:53 +0200)]
VEC_COND_EXPR code cleanup

This removes now unnecessary special-casings of VEC_COND_EXPRs after
making its first operand a gimple value.

2021-04-14  Richard Biener  <rguenther@suse.de>

* genmatch.c (lower_cond): Remove VEC_COND_EXPR special-casing.
(capture_info::capture_info): Likewise.
(capture_info::walk_match): Likewise.
(expr::gen_transform): Likewise.
(dt_simplify::gen_1): Likewise.
* gimple-match-head.c (maybe_resimplify_conditional_op):
Remove VEC_COND_EXPR special-casing.
(gimple_simplify): Likewise.
* gimple.c (gimple_could_trap_p_1): Adjust.
* tree-ssa-pre.c (compute_avail): Allow VEC_COND_EXPR
to participate in PRE.

3 years agoFirst do add_noreturn_fake_exit_edges in connect_infinite_loops_to_exit
Richard Biener [Thu, 25 Feb 2021 10:31:37 +0000 (11:31 +0100)]
First do add_noreturn_fake_exit_edges in connect_infinite_loops_to_exit

Most callers of connect_infinite_loops_to_exit already do this but
the few that do not end up with extra exit edges.  The following
makes that consistent, also matching the post-dominance DFS walk code.

2021-02-25  Richard Biener  <rguenther@suse.de>

* cfganal.c (connect_infinite_loops_to_exit): First call
add_noreturn_fake_exit_edges.
* ipa-sra.c (process_scan_results): Do not call the now redundant
add_noreturn_fake_exit_edges.
* predict.c (tree_estimate_probability): Likewise.
(rebuild_frequencies): Likewise.
* store-motion.c (one_store_motion_pass): Likewise.

3 years agotree-optimization/100222 - remove redundant mark_irreducible_loops calls
Richard Biener [Fri, 23 Apr 2021 09:16:52 +0000 (11:16 +0200)]
tree-optimization/100222 - remove redundant mark_irreducible_loops calls

loop_optimizer_init (LOOPS_NORMAL) already performs this (quite
expensive) marking.

2021-04-23  Richard Biener  <rguenther@suse.de>

PR tree-optimization/100222
* predict.c (pass_profile::execute): Remove redundant call to
mark_irreducible_loops.
(report_predictor_hitrates): Likewise.

3 years agoAvoid more temporaries in IVOPTs
Richard Biener [Wed, 14 Apr 2021 10:48:37 +0000 (12:48 +0200)]
Avoid more temporaries in IVOPTs

This avoids use of valid_gimple_rhs_p and instead gimplifies to
such a RHS, avoiding more SSA copies being generated by IVOPTs.

2021-04-14  Richard Biener  <rguenther@suse.de>

* tree-ssa-loop-ivopts.c (rewrite_use_nonlinear_expr): Avoid
valid_gimple_rhs_p by instead gimplifying to one.

3 years agoc++: Use STATIC_ASSERT for OVL_OP_MAX.
Martin Liska [Fri, 12 Mar 2021 13:32:07 +0000 (14:32 +0100)]
c++: Use STATIC_ASSERT for OVL_OP_MAX.

gcc/cp/ChangeLog:

* cp-tree.h (STATIC_ASSERT): Prefer static assert.
* lex.c (init_operators): Remove run-time check.

3 years agotree-optimization/99971 - improve BB vect dependence analysis
Richard Biener [Fri, 9 Apr 2021 07:35:51 +0000 (09:35 +0200)]
tree-optimization/99971 - improve BB vect dependence analysis

We can use TBAA even when we have a DR, do so.  For the testcase
that means fully vectorizing it instead of only vectorizing
the first store group resulting in suboptimal code.

2021-04-09  Richard Biener  <rguenther@suse.de>

PR tree-optimization/99971
* tree-vect-data-refs.c (vect_slp_analyze_node_dependences):
Always use TBAA for loads.

* g++.dg/vect/slp-pr99971.cc: New testcase.

3 years agoMASK_AVX256_SPLIT_UNALIGNED_STORE/LOAD should be cleared in opts->x_target_flags...
liuhongt [Fri, 16 Apr 2021 03:29:10 +0000 (11:29 +0800)]
MASK_AVX256_SPLIT_UNALIGNED_STORE/LOAD should be cleared in opts->x_target_flags when X86_TUNE_AVX256_UNALIGNED_LOAD/STORE_OPTIMAL is enabled by target attribute.

gcc/ChangeLog:

PR target/100093
* config/i386/i386-options.c (ix86_option_override_internal):
Clear MASK_AVX256_SPLIT_UNALIGNED_LOAD/STORE in x_target_flags
when X86_TUNE_AVX256_UNALIGNED_LOAD/STORE_OPTIMAL is enabled
by target attribute.

gcc/testsuite/ChangeLog:

PR target/100093
* gcc.target/i386/pr100093.c: New test.

3 years agoDaily bump.
GCC Administrator [Fri, 23 Apr 2021 00:16:25 +0000 (00:16 +0000)]
Daily bump.

3 years agoaix: Switch AIX configurtion to DWARF2 debugging
David Edelsohn [Tue, 14 Jan 2020 18:12:59 +0000 (13:12 -0500)]
aix: Switch AIX configurtion to DWARF2 debugging

This patch is in preparation for removing stabs debugging support from GCC.

The rs6000 configuration files remain somewhat intertwined with the
stabs debugging support, but the configuration no longer generates
stabs debugging information.

This patch means that earlier releases (Technology Levels) of AIX 7.1
and 7.2, prior to DWARF support and fixes, cannot build GCC or support
GCC.

gcc/ChangeLog:

* config/rs6000/aix71.h (PREFERRED_DEBUGGING_TYPE): Change to
DWARF2_DEBUG.
* config/rs6000/aix72.h (PREFERRED_DEBUGGING_TYPE): Same.

3 years agoaix: Remove AIX 6.1 support.
David Edelsohn [Thu, 22 Apr 2021 21:41:10 +0000 (17:41 -0400)]
aix: Remove AIX 6.1 support.

AIX 6.1 is past end of life and extended support.  This patch removes
the configuration option and references to AIX 6.1.

contrib/ChangeLog:

* config-list.mk: Remove rs6000-ibm-aix6.1.
Rename rs6000-ibm-aix7.1 to powerpc-ibm-aix7.1.
Add powerpc-ibm-aix7.2.

gcc/ChangeLog:

* config.gcc (powerpc-ibm-aix6.*): Remove.
* config/rs6000/aix61.h: Delete.

3 years agoaix: delete AIX pre-PowerPC version of atomicity.h
David Edelsohn [Thu, 22 Apr 2021 18:52:22 +0000 (14:52 -0400)]
aix: delete AIX pre-PowerPC version of atomicity.h

The AIX-specific version of atomicity.h that provides compatibility
for the origina POWER architecture without atomic instructions no longer
is referenced.  This patch deletes the file.

libstdc++-v3/ChangeLog:

* config/os/aix/atomicity.h: Delete.

3 years agoc++: Add testcase for already fixed PR [PR94508]
Patrick Palka [Thu, 22 Apr 2021 21:47:02 +0000 (17:47 -0400)]
c++: Add testcase for already fixed PR [PR94508]

We correctly accept this testcase since r11-8144.

gcc/testsuite/ChangeLog:

PR c++/94508
* g++.dg/cpp2a/concepts-uneval3.C: New test.

3 years agoc++: Add testcase for already fixed PR [PR77435]
Patrick Palka [Thu, 22 Apr 2021 21:47:00 +0000 (17:47 -0400)]
c++: Add testcase for already fixed PR [PR77435]

We correctly accept this testcase since r8-1437.

gcc/testsuite/ChangeLog:

PR c++/77435
* g++.dg/template/partial-specialization9.C: New test.

3 years agoc++: Prevent bogus -Wtype-limits warning with NTTP [PR100161]
Marek Polacek [Wed, 21 Apr 2021 00:24:09 +0000 (20:24 -0400)]
c++: Prevent bogus -Wtype-limits warning with NTTP [PR100161]

Recently, we made sure that we never call value_dependent_expression_p
on an expression that isn't potential_constant_expression.  That caused
this bogus warning with a non-type template parameter, something that
users don't want to see.

The problem is that in tsubst_copy_and_build/LE_EXPR 't' is "i < n",
which, due to 'i', is not p_c_e, therefore we call t_d_e_p.  But the
type of 'n' isn't dependent, so we think the whole 't' expression is
not dependent.  It seems we need to test both op0 and op1 separately
to suppress this warning.

gcc/cp/ChangeLog:

PR c++/100161
* pt.c (tsubst_copy_and_build) <case PLUS_EXPR>: Test op0 and
op1 separately for value- or type-dependence.

gcc/testsuite/ChangeLog:

PR c++/100161
* g++.dg/warn/Wtype-limits6.C: New test.

3 years agoc++: Add testcase for already fixed PR [PR84689]
Patrick Palka [Thu, 22 Apr 2021 17:32:44 +0000 (13:32 -0400)]
c++: Add testcase for already fixed PR [PR84689]

We correctly accept this testcase since r11-1638.

gcc/testsuite/ChangeLog:

PR c++/84689
* g++.dg/cpp0x/sfinae67.C: New test.

3 years agoc++: Add testcase for already fixed PR [PR16617]
Patrick Palka [Thu, 22 Apr 2021 17:32:40 +0000 (13:32 -0400)]
c++: Add testcase for already fixed PR [PR16617]

We correctly diagnose the invalid access since r11-1350.

gcc/testsuite/ChangeLog:

PR c++/16617
* g++.dg/template/access36.C: New test.

3 years agotestsuite/substr_{9,10}.f90: Move to gfortran.dg/
Tobias Burnus [Thu, 22 Apr 2021 17:14:58 +0000 (19:14 +0200)]
testsuite/substr_{9,10}.f90: Move to gfortran.dg/

gcc/testsuite/
* substr_9.f90: Move to ...
* gfortran.dg/substr_9.f90: ... here.
* substr_10.f90: Move to ...
* gfortran.dg/substr_10.f90: ... here.

3 years agolibstdc++: Fix semaphore to work with system_clock timeouts
Jonathan Wakely [Thu, 22 Apr 2021 16:26:50 +0000 (17:26 +0100)]
libstdc++: Fix semaphore to work with system_clock timeouts

The __cond_wait_until_impl function takes a steady_clock timeout, but
then sometimes tries to compare it to a time from the system_clock,
which won't compile.  Additionally, that function gets called with
system_clock timeouts, which also won't compile. This makes the function
accept timeouts for either clock, and compare to the time from the right
clock.

This fixes the compilation error that was causing two tests to fail on
non-futex targets, so we can revert the r12-11 change to disable them.

libstdc++-v3/ChangeLog:

* include/bits/atomic_timed_wait.h (__cond_wait_until_impl):
Handle system_clock as well as steady_clock.
* testsuite/30_threads/semaphore/try_acquire_for.cc: Re-enable.
* testsuite/30_threads/semaphore/try_acquire_until.cc:
Re-enable.

3 years agolibstdc++: Add options for libatomic to test
Jonathan Wakely [Thu, 22 Apr 2021 14:51:08 +0000 (15:51 +0100)]
libstdc++: Add options for libatomic to test

This fixes a linker error on AIX:

FAIL: 30_threads/semaphore/try_acquire_posix.cc (test for excess errors)
Excess errors:
ld: 0711-317 ERROR: Undefined symbol: .__atomic_fetch_add_8
ld: 0711-317 ERROR: Undefined symbol: .__atomic_load_8
ld: 0711-317 ERROR: Undefined symbol: .__atomic_fetch_sub_8
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
collect2: error: ld returned 8 exit status

libstdc++-v3/ChangeLog:

* testsuite/30_threads/semaphore/try_acquire_posix.cc: Add
options for libatomic.

3 years agolibstdc++: Fix typo in comment
Jonathan Wakely [Thu, 22 Apr 2021 14:48:29 +0000 (15:48 +0100)]
libstdc++: Fix typo in comment

libstdc++-v3/ChangeLog:

* config/os/gnu-linux/os_defines.h: Fix type in comment.

3 years agolibstdc++: Reject std::make_shared<T[]> [PR 99006]
Jonathan Wakely [Thu, 22 Apr 2021 14:46:51 +0000 (15:46 +0100)]
libstdc++: Reject std::make_shared<T[]> [PR 99006]

Prior to C++20 it should be ill-formed to use std::make_shared with an
array type (and we don't support the C++20 feature to make it valid yet
anyway).

libstdc++-v3/ChangeLog:

PR libstdc++/99006
* include/bits/shared_ptr.h (allocate_shared): Assert that _Tp
is not an array type.
* include/bits/shared_ptr_base.h (__allocate_shared): Likewise.
* testsuite/20_util/shared_ptr/creation/99006.cc: New test.

3 years agoFix various typos.
Martin Liska [Thu, 22 Apr 2021 09:32:29 +0000 (11:32 +0200)]
Fix various typos.

PR testsuite/100159
PR testsuite/100192

gcc/ChangeLog:

* builtins.c (expand_builtin): Fix typos and missing comments.
* dwarf2out.c (gen_subprogram_die): Likewise.
(gen_struct_or_union_type_die): Likewise.

gcc/fortran/ChangeLog:

* frontend-passes.c (optimize_expr): Fix typos and missing comments.

gcc/testsuite/ChangeLog:

* g++.dg/template/nontype29.C: Fix typos and missing comments.
* gcc.dg/Warray-bounds-64.c: Likewise.
* gcc.dg/Warray-parameter.c: Likewise.
* gcc.dg/Wstring-compare.c: Likewise.
* gcc.dg/format/gcc_diag-11.c: Likewise.
* gfortran.dg/array_constructor_3.f90: Likewise.
* gfortran.dg/matmul_bounds_9.f90: Likewise.
* gfortran.dg/pr78033.f90: Likewise.
* gfortran.dg/pr96325.f90: Likewise.

3 years agolibstdc++: Fix "bare" notifications dropped by waiters check
Thomas Rodgers [Thu, 22 Apr 2021 01:12:03 +0000 (18:12 -0700)]
libstdc++: Fix "bare" notifications dropped by waiters check

For types that track whether or not there extant waiters (e.g.
semaphore) internally, the __atomic_notify_address_bare() call was
introduced to avoid the overhead of loading the atomic count of
waiters. For platforms that don't have Futex, however, there was
still a check for waiters, and seeing that there are none (because
in the bare case, the count is not incremented), the notification
is dropped. This commit addresses that case.

libstdc++-v3/ChangeLog:
* include/bits/atomic_wait.h: Always notify waiters in the
case of 'bare' address notification.

3 years agoi386: Fix unsigned int -> double conversion on i386 w/ -mfpmath=sse [PR100119]
Uros Bizjak [Thu, 22 Apr 2021 14:30:38 +0000 (16:30 +0200)]
i386: Fix unsigned int -> double conversion on i386 w/ -mfpmath=sse [PR100119]

2021-04-22  Uroš Bizjak  <ubizjak@gmail.com>

gcc/
PR target/100119
* config/i386/i386-expand.c (ix86_expand_convert_uns_sidf_sse):
Remove the sign with FE_DOWNWARD, where x - x = -0.0.

gcc/testsuite/

PR target/100119
* gcc.target/i386/pr100119.c: New test.

3 years agolibstdc++: Add workaround for ia32 floating atomics miscompilations [PR100184]
Jakub Jelinek [Thu, 22 Apr 2021 13:08:21 +0000 (15:08 +0200)]
libstdc++: Add workaround for ia32 floating atomics miscompilations [PR100184]

gcc on ia32 miscompiles various atomics involving floating point,
unfortunately I'm afraid it is too late to fix that for 11.1 and
as I'm quite lost on it, it might take a while for 12 too
(disabling all the 8 peephole2s would be easiest, but then we'd
run into optimization regressions).

While 1.cc just FAILs, with dejagnu 1.6.1 wait_notify.cc hangs the
make check even after the timeout fires.  The following patch therefore
xfails the former and skips the latter.

Tested on x86_64-linux where
make check RUNTESTFLAGS='conformance.exp=atomic_float/*.cc'
is still
                === libstdc++ Summary ===

 # of expected passes            8
and on i686-linux, where it is now
                === libstdc++ Summary ===

 # of expected passes            5
 # of expected failures          1
 # of unsupported tests          1

2021-04-22  Jakub Jelinek  <jakub@redhat.com>

PR target/100182
* testsuite/29_atomics/atomic_float/1.cc: Add dg-xfail-run-if for
ia32.
* testsuite/29_atomics/atomic_float/wait_notify.cc: Add dg-skip-if for
ia32.

3 years agolibstdc++: Remove #error from <semaphore> implementation [PR 100179]
Jonathan Wakely [Thu, 22 Apr 2021 10:10:06 +0000 (11:10 +0100)]
libstdc++: Remove #error from <semaphore> implementation [PR 100179]

This removes the #error from <bits/semaphore_base.h> for the case where
neither __atomic_semaphore nor __platform_semaphore is defined.

Also rename the _GLIBCXX_REQUIRE_POSIX_SEMAPHORE macro to
_GLIBCXX_USE_POSIX_SEMAPHORE for consistency with the similar
_GLIBCXX_USE_CXX11_ABI macro that can be used to request an alternative
(ABI-changing) implementation.

libstdc++-v3/ChangeLog:

PR libstdc++/100179
* include/bits/semaphore_base.h: Remove #error.
* include/std/semaphore: Do not define anything unless one of
the implementations is available.

3 years agotestsuite/aarch64: Run pr99988.c test under lp64 only
Christophe Lyon [Thu, 22 Apr 2021 12:43:25 +0000 (12:43 +0000)]
testsuite/aarch64: Run pr99988.c test under lp64 only

The new test fails with -mabi=ilp32:
sorry, unimplemented: return address signing is only supported for '-mabi=lp64'

2021-04-22  Christophe Lyon  <christophe.lyon@linaro.org>

gcc/testsuite/
PR target/99988
* gcc.target/aarch64/pr99988.c: Skip if not lp64 target.

3 years agogfortran.dg/pr68078.f90: Avoid increasing RLIMIT_AS
Tobias Burnus [Thu, 22 Apr 2021 09:05:17 +0000 (11:05 +0200)]
gfortran.dg/pr68078.f90: Avoid increasing RLIMIT_AS

pr68078.f90 tests out-of-memory handling and calls set_vm_limit to set the
soft limit.  However, setrlimit was then called with hard limit RLIM_INFINITY,
which failed when the current hard limit was lower.

gcc/testsuite/
* gfortran.dg/set_vm_limit.c (set_vm_limit): Call getrlimit, use
obtained hard limit, and only call setrlimit if new softlimit is lower.

3 years agotestsuite/100176 - fix struct-layout-1_generate.c compile
Richard Biener [Thu, 22 Apr 2021 07:50:26 +0000 (09:50 +0200)]
testsuite/100176 - fix struct-layout-1_generate.c compile

With -Werror=return-type we run into compile fails complaining about
missing return stmts.

2021-04-21  Richard Biener  <rguenther@suse.de>

PR testsuite/100176
* objc.dg/gnu-encoding/struct-layout-encoding-1_generate.c: Add
missing return.

3 years agoAvoid -latomic for amdgcn offloading
Richard Biener [Wed, 21 Apr 2021 12:54:05 +0000 (14:54 +0200)]
Avoid -latomic for amdgcn offloading

libatomic isn't built for amdgcn but reduction-16.c adds it
via -foffload=-latomic when offloading for nvptx is enabled.
The following avoids linker errors when offloading to amdgcn is enabled
as well.

2021-04-21  Richard Biener  <rguenther@suse.de>

libgomp/
* testsuite/libgomp.c-c++-common/reduction-16.c: Use -latomic
only on nvptx-none.

3 years agoFix Fortran rounding issues, PR fortran/96983.
Michael Meissner [Thu, 22 Apr 2021 03:02:07 +0000 (23:02 -0400)]
Fix Fortran rounding issues, PR fortran/96983.

I was looking at Fortran PR 96983, which fails on the PowerPC when trying to
run the test PR96711.F90.  The compiler ICEs because the PowerPC does not have
a floating point type with a type precision of 128.  The reason is that the
PowerPC has 3 different 128 bit floating point types (__float128/_Float128,
__ibm128, and long double).  Currently long double uses the IBM extended double
type, but we would like to switch to using IEEE 128-bit long doubles in the
future.

In order to prevent the compiler from converting explicit __ibm128 types to
long double when long double uses the IEEE 128-bit representation, we have set
up the precision for __ibm128 to be 128, long double to be 127, and
__float128/_Float128 to be 126.

Originally, I was trying to see if for Fortran, I could change the precision of
long double to be 128 (Fortran doesn't access __ibm128), but it quickly became
hard to get the changes to work.

I looked at the Fortran code in build_round_expr, and I came to the conclusion
that there is no reason to promote the floating point type.  If you just do a
normal round of the value using the current floating point format and then
convert it to the integer type.  We don't have an appropriate built-in function
that provides the equivalent of llround for 128-bit integer types.

This patch fixes the compiler crash.

However, while with this patch, the PowerPC compiler will not crash when
building the test case, it will not run on the current default installation.
The failure is because the test is explicitly expecting 128-bit floating point
to handle 10384593717069655257060992658440192_16 (i.e. 2**113).

By default, the PowerPC uses IBM extended double used for 128-bit floating
point.  The IBM extended double format is a pair of doubles that provides more
mantissa bits but does not grow the expoenent range.  The value in the test is
fine for IEEE 128-bit floating point, but it is too large for the PowerPC
extended double setup.

I have built the following tests with this patch:

   * I have built a bootstrap compiler on a little endian power9 Linux system
     with the default long double format (IBM extended double).  The
     pr96711.f90 test builds, but it does not run due to the range of the
     real*16 exponent.  There were no other regressions in the C/C++/Fortran
     tests.

   * I have built a bootstrap compiler on a little endian power9 Linux system
     with the default long double format set to IEEE 128-bit. I used the
     Advance Toolchain 14.0-2 to provide the IEEE 128-bits.  The compiler was
     configured to build power9 code by default, so the test generated native
     power9 IEEE 128-bit instructions.  The pr96711.f90 test builds and runs
     correctly in this setup.

   * I have built a bootstrap compiler on a big endian power8 Linux system with
     the default long double format (IBM extended double).  Like the first
     case, the pr96711.f90 test does not crash the compiler, but the test fails
     due to the range of the real*16 exponent.    There were no other
     regressions in the C/C++/Fortran tests.

   * I built a bootstrap compiler on my x86_64 laptop.  There were no
     regressions in the tests.

gcc/fortran/
2021-04-21  Michael Meissner  <meissner@linux.ibm.com>

PR fortran/96983
* trans-intrinsic.c (build_round_expr): If int type is larger than
long long, do the round and convert to the integer type.  Do not
try to find a floating point type the exact size of the integer
type.

3 years agoDaily bump.
GCC Administrator [Thu, 22 Apr 2021 00:16:32 +0000 (00:16 +0000)]
Daily bump.

3 years agolibgomp.fortran/depobj-1.f90: Fix omp_depend_kind
Tobias Burnus [Wed, 21 Apr 2021 20:47:18 +0000 (22:47 +0200)]
libgomp.fortran/depobj-1.f90: Fix omp_depend_kind

libgomp/
* testsuite/libgomp.fortran/depobj-1.f90: Use omp_lib's
omp_depend_kind instead of defining it as 16.

3 years ago[libstdc++] Fix test timeout in stop_calback/destroy.cc
Thomas Rodgers [Wed, 21 Apr 2021 17:01:06 +0000 (10:01 -0700)]
[libstdc++] Fix test timeout in stop_calback/destroy.cc

A change was made to __atomic_semaphore::_S_do_try_acquire() to
(ideally) let the compare_exchange reload the value of __old rather than
always reloading it twice. This causes _M_acquire to spin indefinitely
if the value of __old is already 0.

libstdc++-v3/ChangeLog:
* include/bits/semaphore_base.h: Always reload __old in
__atomic_semaphore::_S_do_try_acquire().
* testsuite/30_threads/stop_token/stop_callback/destroy.cc:
re-enable testcase.

3 years agoDarwin, X86 : Fix bootstrap break from flags changes.
Iain Sandoe [Wed, 21 Apr 2021 19:40:48 +0000 (20:40 +0100)]
Darwin, X86 : Fix bootstrap break from flags changes.

The changes from r12-36-g1751bec027f030515889fcf4baa9c91501aafc85
did not remove the uses of TARGET_ISA_* from i386/darwin.h.

Fixed thus.

gcc/ChangeLog:

* config/i386/darwin.h (TARGET_64BIT): Remove definition
based on TARGET_ISA_64BIT.
(TARGET_64BIT_P): Remove definition based on
TARGET_ISA_64BIT_P().

3 years agoRevert "Use std::thread::hardware_concurrency in lto-wrapper.c."
Martin Liska [Wed, 21 Apr 2021 19:33:41 +0000 (21:33 +0200)]
Revert "Use std::thread::hardware_concurrency in lto-wrapper.c."

This reverts commit 0a18305ee11e139838771f96c5a037a29606236e.

3 years agoCall toplev::finalize in CHECKING_P mode.
Martin Liska [Mon, 11 Jan 2021 17:12:54 +0000 (18:12 +0100)]
Call toplev::finalize in CHECKING_P mode.

gcc/ChangeLog:

PR jit/98615
* main.c (main): Call toplev::finalize in CHECKING_P mode.
* ipa-modref.c (ipa_modref_c_finalize): summaries are NULL
when incremental LTO linking happens.

3 years agolibgomp/testsuite: Fix checks for dg-excess-errors
Tobias Burnus [Wed, 21 Apr 2021 18:07:19 +0000 (20:07 +0200)]
libgomp/testsuite: Fix checks for dg-excess-errors

For the tests modified below, the effective target line has to be effective
when compiling for an offload target, except that variable-not-offloaded.c
would compile with unified-share memory and pr86416-*.c if long double/float128
is supported.
The previous check used a run-time device ability check. This new variant
now enables those dg- lines when _compiling_ for nvptx or gcn.

libgomp/ChangeLog:

* testsuite/lib/libgomp.exp (offload_target_to_openacc_device_type):
New, based on check_effective_target_offload_target_nvptx.
(check_effective_target_offload_target_nvptx): Call it.
(check_effective_target_offload_target_amdgcn): New.
* testsuite/libgomp.c-c++-common/function-not-offloaded.c:
Require target offload_target_nvptx || offload_target_amdgcn.
* testsuite/libgomp.c-c++-common/variable-not-offloaded.c: Likewise.
* testsuite/libgomp.c/pr86416-1.c: Likewise.
* testsuite/libgomp.c/pr86416-2.c: Likewise.

3 years agolibstdc++: Install libstdc++*-gdb.py more robustly [PR 99453]
Philippe Blain [Sat, 13 Mar 2021 00:26:46 +0000 (19:26 -0500)]
libstdc++: Install libstdc++*-gdb.py more robustly [PR 99453]

In order for GDB to auto-load the pretty printers, they must be installed
as "libstdc++.$ext-gdb.py", where 'libstdc++.$ext' is the name of the
object file that is loaded by GDB [1], i.e. the libstdc++ shared library.

The approach taken in libstdc++-v3/python/Makefile.am is to loop over
files matching 'libstdc++*' in $(DESTDIR)$(toolexeclibdir) and choose
the last file matching that glob that is not a symlink, the Libtool
'*.la' file or a Python file.

That works fine for ELF targets where the matching names are:

  libstdc++.a
  libstdc++.so
  libstdc++.so.6
  libstdc++.so.6.0.29

But not for macOS with:

  libstdc++.6.dylib
  libstdc++.a

Or MinGW with:

  libstdc++-6.dll
  libstdc++.dll.a

Try to make a better job at installing the pretty printers with the
correct name by copying the approach taken by isl [2], that is, using
a sed invocation on the Libtool-generated 'libstdc++.la' to read the
correct name for the current platform.

[1] https://sourceware.org/gdb/onlinedocs/gdb/objfile_002dgdbdotext-file.html
[2] https://repo.or.cz/isl.git/blob/HEAD:/Makefile.am#l611

libstdc++-v3/ChangeLog:

PR libstdc++/99453
* python/Makefile.am: Install libstdc++*-gdb.py more robustly.
* python/Makefile.in: Regenerate.

Co-authored-by: Jonathan Wakely <jwakely@redhat.com>
3 years agotestsuite: Fix bind_c_array_params_2.f90 on AIX
David Edelsohn [Wed, 21 Apr 2021 12:27:31 +0000 (08:27 -0400)]
testsuite: Fix bind_c_array_params_2.f90 on AIX

gcc/testsuite/ChangeLog:

* gfortran.dg/bind_c_array_params_2.f90: Look for AIX-specific call
pattern.

3 years ago[libstdc++] Add missing _M_try_acquire() to __platform_semaphore
Thomas Rodgers [Wed, 21 Apr 2021 15:15:16 +0000 (08:15 -0700)]
[libstdc++] Add missing _M_try_acquire() to __platform_semaphore

libstdc++-v3/ChangeLog:
* include/bits/semaphore_base.h: Add missing _M_try_acquire()
member to __platform_wait.

3 years agoLTO: fallback to -flto=N if -flto=jobserver does not work.
Martin Liska [Fri, 12 Mar 2021 12:37:06 +0000 (13:37 +0100)]
LTO: fallback to -flto=N if -flto=jobserver does not work.

gcc/ChangeLog:

* lto-wrapper.c (run_gcc): When -flto=jobserver is used, but the
makeserver cannot be detected, then use -flto=N fallback.