]> gcc.gnu.org Git - gcc.git/log
gcc.git
22 months agoDaily bump.
GCC Administrator [Mon, 1 Aug 2022 00:18:33 +0000 (00:18 +0000)]
Daily bump.

22 months agoDaily bump.
GCC Administrator [Sun, 31 Jul 2022 00:18:17 +0000 (00:18 +0000)]
Daily bump.

22 months agoDaily bump.
GCC Administrator [Sat, 30 Jul 2022 00:18:10 +0000 (00:18 +0000)]
Daily bump.

22 months agoDaily bump.
GCC Administrator [Fri, 29 Jul 2022 00:18:25 +0000 (00:18 +0000)]
Daily bump.

22 months agoDaily bump.
GCC Administrator [Thu, 28 Jul 2022 00:18:13 +0000 (00:18 +0000)]
Daily bump.

22 months agoRISC-V: Remove duplicate backslashes from `stack_protect_set_<mode>'
Maciej W. Rozycki [Wed, 27 Jul 2022 10:09:43 +0000 (11:09 +0100)]
RISC-V: Remove duplicate backslashes from `stack_protect_set_<mode>'

Remove redundant duplicate backslash characters from \t sequences in the
output pattern of the `stack_protect_set_<mode>' RTL insn.

gcc/
* config/riscv/riscv.md (stack_protect_set_<mode>): Remove
duplicate backslashes.

(cherry picked from commit 3cf07cc5e51c833f39f5bad5ca6fbe23c853a214)

22 months agoDaily bump.
GCC Administrator [Wed, 27 Jul 2022 00:18:42 +0000 (00:18 +0000)]
Daily bump.

22 months agolibstdc++: Minor codegen improvement for atomic wait spinloop
Thomas Rodgers [Wed, 6 Jul 2022 00:42:42 +0000 (17:42 -0700)]
libstdc++: Minor codegen improvement for atomic wait spinloop

This patch merges the spin loops in the atomic wait implementation which is a
minor codegen improvement.

libstdc++-v3/ChangeLog:
* include/bits/atomic_wait.h (__atomic_spin): Merge spin loops.

(cherry picked from commit e75da2ace6b6f634237259ef62cfb2d3d34adb10)

22 months agoFortran: error recovery from calculation of storage size of a symbol [PR103504]
Harald Anlauf [Mon, 25 Jul 2022 20:29:50 +0000 (22:29 +0200)]
Fortran: error recovery from calculation of storage size of a symbol [PR103504]

gcc/fortran/ChangeLog:

PR fortran/103504
* interface.c (get_sym_storage_size): Array bounds and character
length can only be of integer type.

gcc/testsuite/ChangeLog:

PR fortran/103504
* gfortran.dg/pr103504.f90: New test.

(cherry picked from commit 600956c81c784f4a0cc9d10f6e03e01847afd961)

22 months agoDaily bump.
GCC Administrator [Tue, 26 Jul 2022 00:18:36 +0000 (00:18 +0000)]
Daily bump.

22 months agoRTEMS: Do not define _GNU_SOURCE by default
Sebastian Huber [Fri, 22 Jul 2022 12:09:20 +0000 (14:09 +0200)]
RTEMS: Do not define _GNU_SOURCE by default

gcc/ChangeLog:

* config/rs6000/rtems.h (CPLUSPLUS_CPP_SPEC): Undef.

(cherry picked from commit 556b816b820f6749910784cbaca8bb0bb822a970)

22 months agoDaily bump.
GCC Administrator [Mon, 25 Jul 2022 00:18:29 +0000 (00:18 +0000)]
Daily bump.

22 months agoDaily bump.
GCC Administrator [Sun, 24 Jul 2022 00:18:13 +0000 (00:18 +0000)]
Daily bump.

22 months agoDaily bump.
GCC Administrator [Sat, 23 Jul 2022 00:18:19 +0000 (00:18 +0000)]
Daily bump.

22 months agolibstdc++: Fix backward compatibility of P2325R3 backport [PR106320]
Patrick Palka [Fri, 22 Jul 2022 16:52:03 +0000 (12:52 -0400)]
libstdc++: Fix backward compatibility of P2325R3 backport [PR106320]

The 11 and 10 partial backports of P2325R3, r11-9555-g92d612cccc1eec and
r10-10808-g22b86cdc4d7fdd, unnecessarily preserved some changes from the
paper that made certain view specializations no longer default
constructible, changes which aren't required to reap the overall benefits
of the paper and which are backward incompatible with pre-P2325R3 code in
practice.

This patch reverts the problematic changes, specifically it relaxes the
constraints on various views' default constructors added by the paper
so that we keep only the constraints that were already implicitly
imposed by the NSDMIs of the view.  Thus for example this patch retains
the default_initializable<_Vp> constraint on transform_view's default
constructor since its '_Vp _M_base = _Vp()' NSDMI already requires this
constraint, and it removes the default_initializable<_Fp> constraint
since the corresponding member '__detail::__box<_Fp> _M_fun' doesn't
require default constructibility (specializations of __box are always
default constructible).

After reverting these changes, all static_asserts from p2325.cc that
verify lack of default constructibility now fail as expected, matching
the pre-P2325R3 behavior.

PR libstdc++/106320

libstdc++-v3/ChangeLog:

* include/std/ranges (single_view): Relax constraints on
default constructor so as to preserve pre-P2325R3 behavior.
(filter_view): Likewise.
(transform_view): Likewise.
(take_while_view): Likewise.
(drop_while_view): Likewise.
* testsuite/std/ranges/adaptors/join.cc (test13): New test.
* testsuite/std/ranges/p2325.cc: Fix S to be only non default
constructible and not also non copy constructible.  XFAIL the
tests that verify a non default constructible functor makes a
view non default constructible (lines 94, 97 and 98).  XFAIL
the test that effectively verifies a non default constructible
element type makes single_view non default constructible (line
114).

22 months agotree-optimization/105618 - restore load sinking
Richard Biener [Tue, 17 May 2022 07:45:02 +0000 (09:45 +0200)]
tree-optimization/105618 - restore load sinking

The PR97330 fix caused some missed sinking of loads out of loops
the following patch re-instantiates.

2022-05-17  Richard Biener  <rguenther@suse.de>

PR tree-optimization/105618
* tree-ssa-sink.c (statement_sink_location): For virtual
PHI uses ignore those defining the used virtual operand.

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

(cherry picked from commit ebce0e9bd8d714a8607ae24331a3d842b0d11859)

22 months agomiddle-end/103193 - avoid canonicalizing <= and >= to == for floats
Richard Biener [Mon, 15 Nov 2021 11:13:40 +0000 (12:13 +0100)]
middle-end/103193 - avoid canonicalizing <= and >= to == for floats

This avoids doing aforementioned canoncalization when -ftrapping-math
is in effect and we honor NaNs.

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

PR middle-end/103193
* match.pd: Avoid canonicalizing (le/ge @0 @0) to (eq @0 @0)
with NaNs and -ftrapping-math.

(cherry picked from commit d9ca2ca381e44a332703155d07b50b84aa21f80d)

22 months agotree-optimization/103116 - SLP permutes and peeling for gaps
Richard Biener [Wed, 4 May 2022 08:43:07 +0000 (10:43 +0200)]
tree-optimization/103116 - SLP permutes and peeling for gaps

The testcase shows that we can end up with a contiguous access across
loop iterations but by means of permutations the elements accessed
might only cover parts of a vector.  In this case we end up with
GROUP_GAP == 0 but still need to avoid accessing excess elements
in the last loop iterations.  Peeling for gaps is designed to cover
this but a single scalar iteration might not cover all of the excess
elements.  The following ensures peeling for gaps is done in this
situation and when that isn't sufficient because we need to peel
more than one iteration (gcc.dg/vect/pr103116-2.c), fail the SLP
vectorization.

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

PR tree-optimization/103116
* tree-vect-stmts.c (get_group_load_store_type): Handle the
case we need peeling for gaps even though GROUP_GAP is zero.

* gcc.dg/vect/pr103116-1.c: New testcase.
* gcc.dg/vect/pr103116-2.c: Likewise.

(cherry picked from commit 52b7b86f8c72eb19e637f1e72ffd10f39b8cb829)

22 months agolibstdc++: Fix std::common_iterator assignment [PR100823]
Jonathan Wakely [Wed, 20 Jul 2022 15:51:44 +0000 (16:51 +0100)]
libstdc++: Fix std::common_iterator assignment [PR100823]

This fixes the following conformance problems reported in the PR:

- Move constructor and move assignment should be defined.
- Copy assignment from a valueless object should be allowed.

Assignment is completely rewritten by this patch, as the previous
version had a number of problems. The converting assignment failed to
handle the case of assigning a new value to a valueless object, which
should work. It only accepted lvalue arguments, so wasn't usable to
implement the move assignment operator. Finally, it enforced the
precondition that the argument is not valueless, which is correct for
the converting assignment but not for the copy assignment.

A new _M_assign member is added to handle all cases of assignment
(copying from an lvalue, moving from an rvalue, and converting from a
different type). The not valueless precondition is checked in the
converting assignment before calling _M_assign, so isn't enforced for
copy and move assignment. The new function no longer uses a switch, so
handles valueless objects as the LHS or RHS of the assignment.

libstdc++-v3/ChangeLog:

PR libstdc++/100823
* include/bits/stl_iterator.h (common_iterator): Define move
constructor and move assignment operator.
(common_iterator::_M_assign): New function implementing
assignment.
(common_iterator::operator=): Use _M_assign.
(common_iterator::_S_valueless): New constant.
* testsuite/24_iterators/common_iterator/100823.cc: New test.

(cherry picked from commit 56c999860bbbb2fd5091ba0985e2e5eaa90c6478)

22 months agolibstdc++: Fix minor bugs in std::common_iterator
Jonathan Wakely [Wed, 20 Jul 2022 11:49:28 +0000 (12:49 +0100)]
libstdc++: Fix minor bugs in std::common_iterator

The noexcept-specifier for some std::common_iterator constructors was
incorrectly using an rvalue as the first argument of
std::is_nothrow_assignable_v. This gave the wrong answer for some types,
e.g. std::common_iterator<int*, S>, because an rvalue of scalar type
cannot be assigned to.

Also fix the friend declaration to use the same constraints as on the
definition of the class template. G++ fails to diagnose this error, due
to PR c++/96830.

Finally, the copy constructor was using std::move for its argument
in some cases, which should be removed.

libstdc++-v3/ChangeLog:

* include/bits/stl_iterator.h (common_iterator): Fix incorrect
uses of is_nothrow_assignable_v. Fix inconsistent constraints on
friend declaration. Do not move argument in copy constructor.
* testsuite/24_iterators/common_iterator/1.cc: Check for
noexcept constructibnle/assignable.

(cherry picked from commit 3b5567c3ec7e5759bdecc6a6fc0be2b65a93636e)

22 months agolibstdc++: Use std::construct_at in std::common_iterator [PR103992]
Jonathan Wakely [Wed, 12 Jan 2022 16:58:18 +0000 (16:58 +0000)]
libstdc++: Use std::construct_at in std::common_iterator [PR103992]

This should have been done as part of the LWG 3574 changes.

libstdc++-v3/ChangeLog:

PR libstdc++/103992
* include/bits/stl_iterator.h (common_iterator): Use
std::construct_at instead of placement new.
* testsuite/24_iterators/common_iterator/1.cc: Check copy
construction is usable in constant expressions.

(cherry picked from commit d67ba1dce9796bff177e52e2bbb68bfa2c69a884)

22 months agolibstdc++: Make std::common_iterator completely constexpr-able (LWG 3574)
Jonathan Wakely [Mon, 10 Jan 2022 16:51:49 +0000 (16:51 +0000)]
libstdc++: Make std::common_iterator completely constexpr-able (LWG 3574)

This library issue was approved in the October 2021 plenary.

This backport for gcc-11 also includes some [[nodiscard]] attributes
from earlier commits on trunk.

libstdc++-v3/ChangeLog:

* include/bits/stl_iterator.h (common_iterator): Add constexpr
to all member functions (LWG 3574).
* testsuite/24_iterators/common_iterator/1.cc: Evaluate some
tests as constant expressions.
* testsuite/24_iterators/common_iterator/2.cc: Likewise.

(cherry picked from commit 11d3e8f4364b05e2746689c6d0f573594f6ddb74)

22 months agolibstdc++: testsuite: Guard use of C99 std::log2
Jonathan Wakely [Tue, 28 Jun 2022 08:17:06 +0000 (09:17 +0100)]
libstdc++: testsuite: Guard use of C99 std::log2

This prevents the test from failing if the only thing not supported is
the text printed to the log about the size of the floating-point type.

libstdc++-v3/ChangeLog:

* testsuite/20_util/from_chars/4.cc: Only use log2 if C99 math
functions are available.

(cherry picked from commit 30aea28bd30027e0a6be8e3077828256779954b3)

22 months agolibstdc++: Fix experimental::filesystem::status on Windows [PR88881]
Jonathan Wakely [Tue, 28 Jun 2022 14:56:30 +0000 (15:56 +0100)]
libstdc++: Fix experimental::filesystem::status on Windows [PR88881]

Although the Filesystem TS isn't properly supported on Windows (unlike
the C++17 Filesystem lib), most tests do pass. Two of the failures are
due to PR 88881 which was only fixed for std::filesystem not the TS.
This applies the fix to the TS implementation too.

libstdc++-v3/ChangeLog:

PR libstdc++/88881
* src/filesystem/ops.cc (has_trailing_slash): New helper
function.
(fs::status): Strip trailing slashes.
(fs::symlink_status): Likewise.
* testsuite/experimental/filesystem/operations/temp_directory_path.cc:
Clean the environment before each test and use TMP instead of
TMPDIR so the test passes on Windows.

(cherry picked from commit 6c96b14a19a9e6c365eacc59868a866b99f9786d)

22 months agoc++: defaulted friend op== [PR106361]
Jason Merrill [Thu, 21 Jul 2022 00:00:58 +0000 (20:00 -0400)]
c++: defaulted friend op== [PR106361]

Now non-member functions can be defaulted, so this assert is wrong.
move_signature_fn_p already checks for ctor or op=.

PR c++/106361

gcc/cp/ChangeLog:

* decl.c (move_fn_p): Remove assert.

gcc/testsuite/ChangeLog:

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

22 months agoDaily bump.
GCC Administrator [Fri, 22 Jul 2022 00:18:14 +0000 (00:18 +0000)]
Daily bump.

22 months agolibgo: don't include <linux/fs.h> when building gen-sysinfo.go
Ian Lance Taylor [Wed, 13 Jul 2022 02:42:43 +0000 (19:42 -0700)]
libgo: don't include <linux/fs.h> when building gen-sysinfo.go

Removing this doesn't change anything at least with glibc 2.33.
The include was added in https://go.dev/cl/6100049 but it's not
clear why.

Fixes PR go/106266

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/417294
(cherry picked from commit f35d65517a59565758107c5b1a51a5fa382f8d1a)

22 months agolibsanitizer: cherry-pick 9cf13067cb5088626ba7 from upstream
Martin Liska [Mon, 11 Jul 2022 20:03:14 +0000 (22:03 +0200)]
libsanitizer: cherry-pick 9cf13067cb5088626ba7 from upstream

9cf13067cb5088626ba7ee1ec4c42ec59c7995a0 [sanitizer] Remove #include <linux/fs.h> to resolve fsconfig_command/mount_attr conflict with glibc 2.36

(cherry picked from commit 2701442d0cf6292f6624443c15813d6d1a3562fe)

22 months agoregrename: Fix -fcompare-debug issue in check_new_reg_p [PR105041]
Surya Kumari Jangala [Fri, 10 Jun 2022 14:22:57 +0000 (19:52 +0530)]
regrename: Fix -fcompare-debug issue in check_new_reg_p [PR105041]

In check_new_reg_p, the nregs of a du chain is computed by obtaining the
MODE of the first element in the chain, and then calling
hard_regno_nregs() with the MODE. But the first element of the chain can
be a DEBUG_INSN whose mode need not be the same as the rest of the
elements in the du chain. This was resulting in fcompare-debug failure
as check_new_reg_p was returning a different result with -g for the same
candidate register. We can instead obtain nregs from the du chain
itself.

2022-06-10  Surya Kumari Jangala  <jskumari@linux.ibm.com>

gcc/
PR rtl-optimization/105041
* regrename.c (check_new_reg_p): Use nregs value from du chain.

gcc/testsuite/
PR rtl-optimization/105041
* gcc.target/powerpc/pr105041.c: New test.

(cherry picked from commit 3e16b4359e86b36676ed01219e6deafa95f3c16b)

22 months agoDaily bump.
GCC Administrator [Thu, 21 Jul 2022 00:18:30 +0000 (00:18 +0000)]
Daily bump.

22 months agoDaily bump.
GCC Administrator [Wed, 20 Jul 2022 00:18:24 +0000 (00:18 +0000)]
Daily bump.

22 months agoDaily bump.
GCC Administrator [Tue, 19 Jul 2022 00:18:37 +0000 (00:18 +0000)]
Daily bump.

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

23 months agoDaily bump.
GCC Administrator [Sun, 17 Jul 2022 00:18:28 +0000 (00:18 +0000)]
Daily bump.

23 months agoFortran: do not generate conflicting results under -ff2c [PR104313]
Steve Kargl [Fri, 15 Jul 2022 20:07:15 +0000 (22:07 +0200)]
Fortran: do not generate conflicting results under -ff2c [PR104313]

gcc/fortran/ChangeLog:

PR fortran/104313
* trans-decl.c (gfc_generate_return): Do not generate conflicting
fake results for functions with no result variable under -ff2c.

gcc/testsuite/ChangeLog:

PR fortran/104313
* gfortran.dg/pr104313.f: New test.

(cherry picked from commit 517fb1a78102df43f052c6934c27dd51d786aff7)

23 months agoDaily bump.
GCC Administrator [Sat, 16 Jul 2022 00:18:29 +0000 (00:18 +0000)]
Daily bump.

23 months agoDaily bump.
GCC Administrator [Fri, 15 Jul 2022 00:18:28 +0000 (00:18 +0000)]
Daily bump.

23 months ago[BACKPORT] Disable generating load/store vector pairs for block copies.
Michael Meissner [Thu, 14 Jul 2022 18:03:37 +0000 (14:03 -0400)]
[BACKPORT] Disable generating load/store vector pairs for block copies.

Testing has found that using load and store vector pair for block copies
can result in a slow down on power10.  This patch disables using the
vector pair instructions for block copies if we are tuning for power10.

2022-06-11   Michael Meissner  <meissner@linux.ibm.com>

gcc/

* config/rs6000/rs6000.c (rs6000_option_override_internal): Do
not generate block copies with vector pair instructions if we are
tuning for power10.  Back port from master branch.

23 months agoDaily bump.
GCC Administrator [Thu, 14 Jul 2022 00:18:29 +0000 (00:18 +0000)]
Daily bump.

23 months agoDaily bump.
GCC Administrator [Wed, 13 Jul 2022 00:18:31 +0000 (00:18 +0000)]
Daily bump.

23 months agotree-sra: Fix union handling in build_reconstructed_reference
Martin Jambor [Tue, 12 Jul 2022 11:16:35 +0000 (13:16 +0200)]
tree-sra: Fix union handling in build_reconstructed_reference

As the testcase in PR 105860 shows, the code that tries to re-use the
handled_component chains in SRA can be horribly confused by unions,
where it thinks it has found a compatible structure under which it can
chain the references, but in fact it found the type it was looking
for elsewhere in a union and generated a write to a completely wrong
part of an aggregate.

I don't remember whether the plan was to support unions at all in
build_reconstructed_reference but it can work, to an extent, if we
make sure that we start the search only outside the outermost union,
which is what the patch does (and the extra testcase verifies).

Additionally, this commit also contains sqashed in it a backport of
b984b84cbe4bf026edef2ba37685f3958a1dc1cf which fixes the testcase
gcc.dg/tree-ssa/alias-access-path-13.c for many 32-bit targets.

gcc/ChangeLog:

2022-07-01  Martin Jambor  <mjambor@suse.cz>

PR tree-optimization/105860
* tree-sra.c (build_reconstructed_reference): Start expr
traversal only just below the outermost union.

gcc/testsuite/ChangeLog:

2022-07-01  Martin Jambor  <mjambor@suse.cz>

PR tree-optimization/105860
* gcc.dg/tree-ssa/alias-access-path-13.c: New test.
* gcc.dg/tree-ssa/pr105860.c: Likewise.

(cherry picked from commit b110e5283e368b5377e04766e4ff82cd52634208)

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

23 months agoDaily bump.
GCC Administrator [Mon, 11 Jul 2022 00:18:32 +0000 (00:18 +0000)]
Daily bump.

23 months agoDaily bump.
GCC Administrator [Sun, 10 Jul 2022 00:18:17 +0000 (00:18 +0000)]
Daily bump.

23 months agoDaily bump.
GCC Administrator [Sat, 9 Jul 2022 00:18:42 +0000 (00:18 +0000)]
Daily bump.

23 months agoDaily bump.
GCC Administrator [Fri, 8 Jul 2022 00:18:22 +0000 (00:18 +0000)]
Daily bump.

23 months agolibstdc++: Add missing prerequisite to generated header [PR106162]
Jonathan Wakely [Fri, 1 Jul 2022 21:23:43 +0000 (22:23 +0100)]
libstdc++: Add missing prerequisite to generated header [PR106162]

The ${host_builddir}/largefile-config.h header can't be written until
its parent directory has been created, so it needs to have the creation
of that directory as a prerequisite.

libstdc++-v3/ChangeLog:

PR libstdc++/106162
* include/Makefile.am (largefile-config.h): Add
stamp-${host_alias} prerequisite.
* include/Makefile.in: Regenerate.

(cherry picked from commit 8a6ee426c2be3bd4359520e02c00ec60cac2fece)

23 months agolibstdc++: Properly remove temporary directories in filesystem tests
Jonathan Wakely [Thu, 23 Jun 2022 13:25:49 +0000 (14:25 +0100)]
libstdc++: Properly remove temporary directories in filesystem tests

Although these tests use filesystem::remove_all to clean up, that fails
because it uses recursive_directory_iterator which is intentionally
bodged by the custom readdir defined in the test.

Just use POSIX rmdir to clean up. We don't need to use _rmdir or _wrmdir
for Windows, because we'll never reach test02() on targets where the
custom readdir doesn't interpose the one from libc.

libstdc++-v3/ChangeLog:

* testsuite/27_io/filesystem/iterators/error_reporting.cc: Use
rmdir to remove directories.
* testsuite/experimental/filesystem/iterators/error_reporting.cc:
Likewise.

(cherry picked from commit 7c1c7e120cca183671b11ba68a6350c8800823c0)

23 months agolibstdc++: Add constexpr to std::counted_iterator post-increment (LWG 3643)
Jonathan Wakely [Thu, 26 May 2022 11:41:03 +0000 (12:41 +0100)]
libstdc++: Add constexpr to std::counted_iterator post-increment (LWG 3643)

libstdc++-v3/ChangeLog:

* include/bits/stl_iterator.h (counted_iterator::operator++(int)):
Add 'constexpr' as per LWG 3643.
* testsuite/24_iterators/counted_iterator/lwg3643.cc: New test.

(cherry picked from commit 47b20d027ade5bfbd932724d0ea2aedee7421243)

23 months agolibstdc++: Mark non-exported function always_inline [PR105671]
Jonathan Wakely [Fri, 27 May 2022 11:43:18 +0000 (12:43 +0100)]
libstdc++: Mark non-exported function always_inline [PR105671]

This new function was added for gcc 11.1 but is not exported from the
shared library. Depending on inlining decisions, its callers might get
inlined but an external definition be needed for this function. That
then fails to link.

Since we can't add the export to the gcc-11 release branch now, mark it
always_inline. We can consider exporting it for gcc-13 if/when we bump
the shared library version (and maybe also for gcc-12 which is currently
at the same version as trunk). For now, the attribute will solve the
problem on all affected branches. The function is small enough that
force-inlining it shouldn't cause problems.

libstdc++-v3/ChangeLog:

PR libstdc++/105671
* include/std/sstream (basic_stringbuf::_M_high_mark): Add
always_inline attribute.

(cherry picked from commit de57440858591a88e8fd7ba2505ca54546c86021)

23 months agolibstdc++: Add noexcept to std::launch operators
Jonathan Wakely [Thu, 12 May 2022 18:33:58 +0000 (19:33 +0100)]
libstdc++: Add noexcept to std::launch operators

libstdc++-v3/ChangeLog:

* include/std/future (launch): Make operators noexcept.

(cherry picked from commit 8659bcd6b7e692a9a516cd57bb19303a2efe78ba)

23 months agolibstdc++: Make ranges::size and ranges::empty check for unbounded arrays
Jonathan Wakely [Sun, 12 Dec 2021 21:16:25 +0000 (21:16 +0000)]
libstdc++: Make ranges::size and ranges::empty check for unbounded arrays

Passing IncompleteType(&)[] to ranges::begin produces an error outside
the immediate context, which is fine for ranges::begin, but it means
that we fail to enforce the SFINAE-able constraints for ranges::size and
ranges::size. They should not be callable for any array of unknown
bound, whether the type is complete or not. Because we don't enforce
that in their constraints, we get a hard error when they try to use
ranges::begin.

This simply adds explicit checks for arrays of unknown bound to the
constraints for ranges::size and ranges::empty. We only need to check it
for the __sentinel_size and __eq_iter_empty concepts, because those are
the ones that are relevant to arrays, and which try to use
ranges::begin.

libstdc++-v3/ChangeLog:

* include/bits/ranges_base.h (ranges::size, ranges::empty): Add
explicit check for unbounded arrays before using ranges::begin.
* testsuite/std/ranges/access/empty.cc: Check handling of unbounded
arrays.
* testsuite/std/ranges/access/size.cc: Likewise.

(cherry picked from commit 55823c5a0ba50022d7fcc95e74ec293143810ef6)

23 months agolibstdc++: Remove obfuscating typedefs in <regex>
Jonathan Wakely [Tue, 28 Sep 2021 12:39:36 +0000 (13:39 +0100)]
libstdc++: Remove obfuscating typedefs in <regex>

There is no benefit to using _SizeT instead of size_t, and IterT tells
you less about the type than const _CharT*. This removes some unhelpful
typedefs.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:

* include/bits/regex_automaton.h (_NFA_base::_SizeT): Remove.
* include/bits/regex_compiler.h (_Compiler::_IterT): Remove.
* include/bits/regex_compiler.tcc: Likewise.
* include/bits/regex_scanner.h (_Scanner::_IterT): Remove.
* include/bits/regex_scanner.tcc: Likewise.

(cherry picked from commit c44c5f3d9f46705a262911c2098c1568d7e8ac2d)

23 months agolibstdc++: Add noexcept to functions in <regex>
Jonathan Wakely [Mon, 27 Sep 2021 19:42:17 +0000 (20:42 +0100)]
libstdc++: Add noexcept to functions in <regex>

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:

* include/bits/regex.h (basic_regex, swap): Add noexcept to
non-throwing functions.
* include/bits/regex_automaton.h (_State_base, _State)
(_NFA_base): Likewise.
* include/bits/regex_compiler.h (_Compiler): Likewise.
* include/bits/regex_error.h (regex_error::code()): Likewise.
* include/bits/regex_scanner.h (_Scanner): Likewise.

(cherry picked from commit df0dd04b78cfc0f723387b703978600caac93cbb)

23 months agolibstdc++: Fix handling of invalid ranges in std::regex [PR102447]
Jonathan Wakely [Tue, 14 Dec 2021 14:32:35 +0000 (14:32 +0000)]
libstdc++: Fix handling of invalid ranges in std::regex [PR102447]

std::regex currently allows invalid bracket ranges such as [\w-a] which
are only allowed by ECMAScript when in web browser compatibility mode.
It should be an error, because the start of the range is a character
class, not a single character. The current implementation of
_Compiler::_M_expression_term does not provide a way to reject this,
because we only remember a previous character, not whether we just
processed a character class (or collating symbol etc.)

This patch replaces the pair<bool, CharT> used to emulate
optional<CharT> with a custom class closer to pair<tribool,CharT>. That
allows us to track three states, so that we can tell when we've just
seen a character class.

With this additional state the code in _M_expression_term for processing
the _S_token_bracket_dash can be improved to correctly reject the [\w-a]
case, without regressing for valid cases such as [\w-] and [----].

libstdc++-v3/ChangeLog:

PR libstdc++/102447
* include/bits/regex_compiler.h (_Compiler::_BracketState): New
class.
(_Compiler::_BrackeyMatcher): New alias template.
(_Compiler::_M_expression_term): Change pair<bool, CharT>
parameter to _BracketState. Process first character for
ECMAScript syntax as well as POSIX.
* include/bits/regex_compiler.tcc
(_Compiler::_M_insert_bracket_matcher): Pass _BracketState.
(_Compiler::_M_expression_term): Use _BracketState to store
state between calls. Improve handling of dashes in ranges.
* testsuite/28_regex/algorithms/regex_match/cstring_bracket_01.cc:
Add more tests for ranges containing dashes. Check invalid
ranges with character class at the beginning.

(cherry picked from commit 7ce3c230edf6e498e125c805a6dd313bf87dc439)

23 months agolibstdc++: Check for invalid syntax_option_type values in <regex>
Jonathan Wakely [Wed, 29 Sep 2021 12:48:15 +0000 (13:48 +0100)]
libstdc++: Check for invalid syntax_option_type values in <regex>

The standard says that it is invalid for more than one grammar element
to be set in a value of type regex_constants::syntax_option_type. This
adds a check in the regex compiler andthrows an exception if an invalid
value is used.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:

* include/bits/regex_compiler.h (_Compiler::_S_validate): New
function.
* include/bits/regex_compiler.tcc (_Compiler::_Compiler): Use
_S_validate to check flags.
* include/bits/regex_error.h (_S_grammar): New error code for
internal use.
* testsuite/28_regex/basic_regex/ctors/grammar.cc: New test.

(cherry picked from commit 9ca4c42a3b756e54a92ff8e1ac6c396b680b7839)

23 months agolibstdc++: Tweaks to <regex> to avoid warnings
Jonathan Wakely [Mon, 27 Sep 2021 19:44:24 +0000 (20:44 +0100)]
libstdc++: Tweaks to <regex> to avoid warnings

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:

* include/bits/regex_compiler.tcc: Add line break in empty while
statement.
* include/bits/regex_executor.tcc: Avoid unused parameter
warning.

(cherry picked from commit b5f276b8c76d892f7fed229153cfbadc13f4696e)

23 months agolibstdc++: Add dg-timeout-factor to some more regex tests
Jonathan Wakely [Fri, 7 Jan 2022 21:15:48 +0000 (21:15 +0000)]
libstdc++: Add dg-timeout-factor to some more regex tests

I'm seeing these fail with tool_timeout=30 on a busy machine.

libstdc++-v3/ChangeLog:

* testsuite/28_regex/algorithms/regex_replace/char/103664.cc:
Add dg-timeout-factor directive.
* testsuite/28_regex/basic_regex/84110.cc: Likewise.
* testsuite/28_regex/basic_regex/ctors/char/other.cc: Likewise.
* testsuite/28_regex/match_results/102667.cc: Likewise.

(cherry picked from commit e54dda45f9acc96f9898b0ed514d7cc1020dd7a4)

23 months agolibstdc++: Simplify std::basic_regex construction and assignment
Jonathan Wakely [Wed, 29 Sep 2021 12:48:02 +0000 (13:48 +0100)]
libstdc++: Simplify std::basic_regex construction and assignment

Introduce a new _M_compile function which does the common work needed by
all constructors and assignment. Call that directly to avoid multiple
levels of constructor delegation or calls to basic_regex::assign
overloads.

For assignment, there is no need to construct a std::basic_string if we
already have a contiguous sequence of the correct character type, and no
need to construct a temporary basic_regex when assigning from an
existing basic_regex.

Also define the copy and move assignment operators as defaulted, which
does the right thing without constructing a temporary and swapping it.
Copying or moving the shared_ptr member cannot fail, so they can be
noexcept. The assign(const basic_regex&) and assign(basic_regex&&)
member can then be defined in terms of copy or move assignment.

The new _M_compile function takes pointer arguments, so the caller has
to convert arbitrary iterator ranges into a contiguous sequence of
characters. With that simplification, the __compile_nfa helpers are not
needed and can be removed.

This also fixes a bug where construction from a contiguous sequence with
the wrong character type would fail to compile, rather than converting
the elements to the regex character type.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:

* include/bits/regex.h (__detail::__is_contiguous_iter): Move
here from <bits/regex_compiler.h>.
(basic_regex::_M_compile): New function to compile an NFA from
a regular expression string.
(basic_regex::basic_regex): Use _M_compile instead of delegating
to other constructors.
(basic_regex::operator=(const basic_regex&)): Define as
defaulted.
(basic_regex::operator=(initializer_list<C>)): Use _M_compile.
(basic_regex::assign(const basic_regex&)): Use copy assignment.
(basic_regex::assign(basic_regex&&)): Use move assignment.
(basic_regex::assign(const C*, flag_type)): Use _M_compile
instead of constructing a temporary string.
(basic_regex::assign(const C*, size_t, flag_type)): Likewise.
(basic_regex::assign(const basic_string<C,T,A>&, flag_type)):
Use _M_compile instead of constructing a temporary basic_regex.
(basic_regex::assign(InputIter, InputIter, flag_type)): Avoid
constructing a temporary string for contiguous iterators of the
right value type.
* include/bits/regex_compiler.h (__is_contiguous_iter): Move to
<bits/regex.h>.
(__enable_if_contiguous_iter, __disable_if_contiguous_iter)
(__compile_nfa): Remove.
* testsuite/28_regex/basic_regex/assign/exception_safety.cc: New
test.
* testsuite/28_regex/basic_regex/ctors/char/other.cc: New test.

(cherry picked from commit b59be1adbaea022f19dc7c30d9bf5089e80795d9)

23 months agolibstdc++: Fix std::regex_replace for strings with embedded null [PR103664]
Jonathan Wakely [Sun, 12 Dec 2021 21:15:17 +0000 (21:15 +0000)]
libstdc++: Fix std::regex_replace for strings with embedded null [PR103664]

The overload of std::regex_replace that takes a std::basic_string as the
fmt argument (for the replacement string) is implemented in terms of the
one taking a const C*, which uses std::char_traits to find the length.
That means it stops at a null character, even though the basic_string
might have additional characters beyond that.

Rather than duplicate the implementation of the const C* one for the
std::basic_string case, this moves that implementation to a new
__regex_replace function which takes a const C* and a length. Then both
the std::basic_string and const C* overloads can call that (with the
latter using char_traits to find the length to pass to the new
function).

libstdc++-v3/ChangeLog:

PR libstdc++/103664
* include/bits/regex.h (__regex_replace): Declare.
(regex_replace): Use it.
* include/bits/regex.tcc (__regex_replace): Replace regex_replace
definition with __regex_replace.
* testsuite/28_regex/algorithms/regex_replace/char/103664.cc: New test.

(cherry picked from commit ef5d671cd80a4afa4f74c3dfe2904c63f51fcfde)

23 months agolibstdc++: Remove try/catch overhead in std::variant::emplace
Jonathan Wakely [Fri, 15 Oct 2021 09:58:56 +0000 (10:58 +0100)]
libstdc++: Remove try/catch overhead in std::variant::emplace

The __variant_construct_by_index helper function sets the new index
before constructing the new object. This means that if the construction
throws then the exception needs to be caught, so the index can be reset
to variant_npos, and then the exception rethrown. This means callers are
responsible for restoring the variant's invariants and they need the
overhead of a catch handler and a rethrow.

If we don't set the index until after construction completes then the
invariant is never broken, and callers can ignore the exception and let
it propagate. The callers all call _M_reset() first, which sets index to
variant_npos as required while the variant is valueless.

We need to be slightly careful here, because changing the order of
operations in __variant_construct_by_index and removing the try-block
from variant::emplace<I> changes an implicit ABI contract between those
two functions. If the linker were to create an executable containing an
instantiation of the old __variant_construct_by_index and an
instantiation of the new variant::emplace<I> code then we would have a
combination that breaks the invariant and doesn't have the exception
handling to restore it. To avoid this problem, we can rename the
__variant_construct_by_index function so that the new emplace<I> code
calls a new symbol, and is unaffected by the behaviour of the old
symbol.

libstdc++-v3/ChangeLog:

* include/std/variant (__detail::__variant::__get_storage):
Remove unused function.
(__variant_construct_by_index): Set index after construction is
complete. Rename to ...
(__detail::__variant::__construct_by_index): ... this.
(variant): Use new name for __variant_construct_by_index friend
declaration. Remove __get_storage friend declaration.
(variant::emplace): Use new name and remove try-blocks.

(cherry picked from commit e27771e5dcd8cf2cb757db6177a3485acd28b88f)

23 months agolibstdc++: Replace try-catch in std::list::merge to avoid O(N) size
Jonathan Wakely [Wed, 29 Sep 2021 19:46:55 +0000 (20:46 +0100)]
libstdc++: Replace try-catch in std::list::merge to avoid O(N) size

The current std::list::merge code calls size() before starting to merge
any elements, so that the _M_size members can be updated after the merge
finishes. The work is done in a try-block so that the sizes can still be
updated in an exception handler if any element comparison throws.

The _M_size members only exist for the cxx11 ABI, so the initial call to
size() and the try-catch are only needed for that ABI. For the old ABI
the size() call performs an O(N) list traversal to get a value that
isn't even used, and catching exceptions just to rethrow them isn't
needed either.

This refactors the merge functions to remove the try-catch block and use
an RAII type instead. For the cxx11 ABI that type's destructor updates
the list sizes, and for the old ABI it's a no-op.

libstdc++-v3/ChangeLog:

* include/bits/list.tcc (list::merge): Remove call to size() and
try-catch block. Use _Finalize_merge instead.
* include/bits/stl_list.h (list::_Finalize_merge): New
scope guard type to update _M_size members after a merge.

(cherry picked from commit b8d42cfa84fb31e592411e6cea41bdde980c51d7)

23 months agolibstdc++: Define basic_regex::multiline for non-strict modes
Jonathan Wakely [Fri, 1 Oct 2021 13:06:42 +0000 (14:06 +0100)]
libstdc++: Define basic_regex::multiline for non-strict modes

The regex_constants::multiline constant is defined for non-strict C++11
and C++14 modes, on the basis that the feature is a DR (even though it
was really a new feature addition to C++17 and probably shouldn't have
gone through the issues list).

This makes the basic_regex::multiline constant defined consistently with
the regex_constants::multiline one.

For strict C++11 and C++14 mode we don't define them, because multiline
is not a reserved name in those standards.

libstdc++-v3/ChangeLog:

* include/bits/regex.h (basic_regex::multiline): Define for
non-strict C++11 and C++14 modes.
* include/bits/regex_constants.h (regex_constants::multiline):
Add _GLIBCXX_RESOLVE_LIB_DEFECTS comment.

(cherry picked from commit 17374dab3eefd282977ad90743c9aff97f2e41ce)

23 months agolibstdc++: Fix preprocessor check for C++17
Jonathan Wakely [Thu, 30 Sep 2021 07:59:21 +0000 (08:59 +0100)]
libstdc++: Fix preprocessor check for C++17

libstdc++-v3/ChangeLog:

* include/bits/regex.h (basic_regex::multiline): Fix #if
condition.

(cherry picked from commit c5369961fa3a5a319f1cc1469c6afb8b679e4846)

23 months agolibstdc++: Implement std::regex_constants::multiline (LWG 2503)
Jonathan Wakely [Wed, 29 Sep 2021 12:48:19 +0000 (13:48 +0100)]
libstdc++: Implement std::regex_constants::multiline (LWG 2503)

This implements LWG 2503, which allows ^ and $ to match line terminator
characters, rather than only matching the beginning and end of the
entire input. The multiline option is only valid for ECMAScript, but
for other grammars we ignore it rather than throwing an exception.

This is related to PR libstdc++/102480, which incorrectly said that
ECMAscript should match the beginning of a line when match_prev_avail
is used. I think that's only supposed to happen when multiline is used.

The new regex_constants::multiline and basic_regex::multiline constants
are not defined for strict -std=c++11 and -std=c++14 modes, but
regex_constants::__multiline is always defined, so that the
implementation can use it internally.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:

* include/bits/regex.h (basic_regex::multiline): Define constant
for C++17.
* include/bits/regex_constants.h (regex_constants::multiline):
Define constant for C++17.
(regex_constants::__multiline): Define duplicate constant for
internal use in C++11 and C++14.
* include/bits/regex_executor.h (_Executor::_M_match_multiline()):
New member function.
(_Executor::_M_is_line_terminator(_CharT)): New member function.
(_Executor::_M_at_begin(), _Executor::_M_at_end()): Use new
member functions to support multiline matches.
* testsuite/28_regex/algorithms/regex_match/multiline.cc: New test.

(cherry picked from commit f38cd3bdb4cd429a5f7082ea91793a59b37d47b9)

23 months agolibstdc++: Fix 28_regex/basic_regex/84110.cc on Solaris
Rainer Orth [Tue, 26 Oct 2021 12:07:57 +0000 (14:07 +0200)]
libstdc++: Fix 28_regex/basic_regex/84110.cc on Solaris

28_regex/basic_regex/84110.cc currently FAILs on Solaris:

FAIL: 28_regex/basic_regex/84110.cc (test for excess errors)
UNRESOLVED: 28_regex/basic_regex/84110.cc compilation failed to produce executable

Excess errors:
/vol/gcc/src/hg/master/local/libstdc++-v3/testsuite/28_regex/basic_regex/84110.cc:14: error: reference to 'extended' is ambiguous

The issue is seen in the full output:

/vol/gcc/src/hg/master/local/libstdc++-v3/testsuite/28_regex/basic_regex/84110.cc: In function ‘void test01()’:
/vol/gcc/src/hg/master/local/libstdc++-v3/testsuite/28_regex/basic_regex/84110.cc:14: error: reference to ‘extended’ is ambiguous
In file included from /var/gcc/regression/master/11.4-gcc-gas/build/gcc/include-fixed/math.h:391,
                 from /var/gcc/regression/master/11.4-gcc-gas/build/i386-pc-solaris2.11/libstdc++-v3/include/cmath:45,
                 from /vol/gcc/src/hg/master/local/libstdc++-v3/include/precompiled/stdc++.h:41:
/usr/include/floatingpoint.h:73: note: candidates are: ‘typedef unsigned int extended [3]’

Fixed by disambiguating extended.  Tested on i386-pc-solaris2.11,
sparc-sun-solaris2.11, and x86_64-pc-linux-gnu.

2021-10-20  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

libstdc++-v3:
* testsuite/28_regex/basic_regex/84110.cc (test01)
[__cpp_exceptions]: Disambiguate extended.

(cherry picked from commit 931f1e377ad27af2801c1e68946010e980810539)

23 months agolibstdc++: std::basic_regex should treat '\0' as an ordinary char [PR84110]
Jonathan Wakely [Wed, 29 Sep 2021 12:48:11 +0000 (13:48 +0100)]
libstdc++: std::basic_regex should treat '\0' as an ordinary char [PR84110]

When the input sequence contains a _CharT(0) character, the strchr call
in _Scanner<_CharT>::_M_scan_normal() will search for '\0' and so return
a pointer to the terminating null at the end of the string. This makes
the scanner think it's found a special character. Because it doesn't
match any of the actual special characters, we fall off the end of the
function (or assert in debug mode).

We should check for a null character explicitly and either treat it as
an ordinary character (for the ECMAScript grammar) or an error (for all
others). I'm not 100% sure that's right, but it seems consistent with
the POSIX RE rules where a '\0' means the end of the regex pattern or
the end of the sequence being matched.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:

PR libstdc++/84110
* include/bits/regex_error.h (regex_constants::_S_null): New
error code for internal use.
* include/bits/regex_scanner.tcc (_Scanner::_M_scan_normal()):
Check for null character.
* testsuite/28_regex/basic_regex/84110.cc: New test.

(cherry picked from commit b701e1f8f6870c0f8cb4050674da489101dd05a5)

23 months agolibstdc++: Remove unused functions in std::variant implementation
Jonathan Wakely [Fri, 15 Oct 2021 10:52:08 +0000 (11:52 +0100)]
libstdc++: Remove unused functions in std::variant implementation

These functions aren't used, and accessing the storage as a void* isn't
compatible with C++20 constexpr requirements anyway, so we're unlikely
to ever start using them in future.

libstdc++-v3/ChangeLog:

* include/std/variant (_Variant_storage::_M_storage()): Remove.
(__detail::__variant::__get_storage): Remove.
(variant): Remove friend declaration of __get_storage.

(cherry picked from commit 1ba7adabf29eb671e418692fad076ea6edd08e3d)

23 months agolibstdc++: Tweak source_location for clang trunk [PR105128]
Jakub Jelinek [Sat, 2 Apr 2022 10:49:38 +0000 (12:49 +0200)]
libstdc++: Tweak source_location for clang trunk [PR105128]

Apparently clang trunk implemented __builtin_source_location(), but the
using __builtin_ret_type = decltype(__builtin_source_location());
which has been added for it isn't enough, they also need the
std::source_location::__impl class to be defined (but incomplete seems
to be good enough) before the builtin is used.

The following has been tested on godbolt with clang trunk (old version
fails with
error: 'std::source_location::__impl' was not found; it must be defined before '__builtin_source_location' is called
and some follow-up errors), getting back to just void * instead of
__builtin_ret_type and commenting out using doesn't work either and
just struct __impl; before using __builtin_ret_type doesn't work too.

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

PR libstdc++/105128
* include/std/source_location (std::source_location::__impl): Move
definition before using __builtin_ret_type.

(cherry picked from commit 2a82301d409d3aa0e0b3b884e4c6daeaa0486d6b)

23 months agolibstdc++: Fix cast in source_location::current() [PR104602]
Jonathan Wakely [Thu, 24 Feb 2022 21:33:44 +0000 (21:33 +0000)]
libstdc++: Fix cast in source_location::current() [PR104602]

This fixes a problem for Clang, which is going to return a non-void
pointer from __builtin_source_location(). The current definition of
std::source_location::current() converts that to void* and then has to
cast it back again in the body (which makes it invalid in a constant
expression). By using the actual type of the returned pointer, we avoid
the problematic cast for Clang.

libstdc++-v3/ChangeLog:

PR libstdc++/104602
* include/std/source_location (source_location::current): Use
deduced type of __builtin_source_location().

(cherry picked from commit 41cbcf53dc60b7434b9ee059b3a734a47f5bf212)

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

This DR was approved at the February 2022 plenary.

libstdc++-v3/ChangeLog:

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

(cherry picked from commit e3c5e8360b4e4799e1e2daf74282629248690f23)

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

23 months agoDaily bump.
GCC Administrator [Wed, 6 Jul 2022 00:18:28 +0000 (00:18 +0000)]
Daily bump.

23 months agoDaily bump.
GCC Administrator [Tue, 5 Jul 2022 00:18:29 +0000 (00:18 +0000)]
Daily bump.

23 months agortl-ssa: Fix prev/next_def confusion [PR104869]
Richard Sandiford [Mon, 4 Jul 2022 19:02:26 +0000 (20:02 +0100)]
rtl-ssa: Fix prev/next_def confusion [PR104869]

rtl-ssa chains definitions into an RPO list.  It also groups
sequences of clobbers together into a single node, so that it's
possible to skip over the clobbers in constant time in order to
get the next or previous set.

When adding a clobber to an insn, the main DF barriers for that
clobber are the last use of the previous set (if any) and the next
set (if any); adding a new clobber to a sea of clobbers is fine.
def_lookup provided the basis for these barriers as prev_def ()
and next_def ().

But of course, in hindsight, those were bad names, since they
implied that the returned values were literally the previous
definition (of any kind) or the next definition (of any kind).
And function_info::make_use_available was using the same routines
assuming that they had that meaning. :-(

This made a difference for the case where the start of a BB
occurs in the middle of an (RPO) clobber group: we then want
the previous and next clobbers in the group, rather than the
set before the clobber group and the set after the clobber group.

This patch renames the existing routines to something that's hopefully
clearer (though also more long-winded).  It then adds routines that
really do provide the previous and next definitions.

This complication is supposed to be internal to rtl-ssa and, as
mentioned above, is part of trying to reduce time complexity.

gcc/
PR middle-end/104869
* rtl-ssa/accesses.h (clobber_group::prev_clobber): Declare.
(clobber_group::next_clobber): Likewise.
(def_lookup::prev_def): Rename to...
(def_lookup::last_def_of_prev_group): ...this.
(def_lookup::next_def): Rename to...
(def_lookup::first_def_of_next_group): ...this.
(def_lookup::matching_or_prev_def): Rename to...
(def_lookup::matching_set_or_last_def_of_prev_group): ...this.
(def_lookup::matching_or_next_def): Rename to...
(def_lookup::matching_set_or_first_def_of_next_group): ...this.
(def_lookup::prev_def): New function, taking the lookup insn as
argument.
(def_lookup::next_def): Likewise.
* rtl-ssa/member-fns.inl (def_lookup::prev_def): Rename to...
(def_lookup::last_def_of_prev_group): ...this.
(def_lookup::next_def): Rename to...
(def_lookup::first_def_of_next_group): ...this.
(def_lookup::matching_or_prev_def): Rename to...
(def_lookup::matching_set_or_last_def_of_prev_group): ...this.
(def_lookup::matching_or_next_def): Rename to...
(def_lookup::matching_set_or_first_def_of_next_group): ...this.
* rtl-ssa/movement.h (restrict_movement_for_dead_range): Update after
above renaming.
* rtl-ssa/accesses.cc (clobber_group::prev_clobber): New function.
(clobber_group::next_clobber): Likewise.
(def_lookup::prev_def): Likewise.
(def_lookup::next_def): Likewise.
(function_info::make_use_available): Pass the lookup insn to
def_lookup::prev_def and def_lookup::next_def.

gcc/testsuite/
PR middle-end/104869
* g++.dg/pr104869.C: New test.

(cherry picked from commit 4a3073f04e8b7987ad7bfe1bc23bfeb1d627ee6a)

23 months agod: Fix error: aggregate value used where floating point was expected
Iain Buclaw [Wed, 29 Jun 2022 19:52:39 +0000 (21:52 +0200)]
d: Fix error: aggregate value used where floating point was expected

Casting from vector to static array is permitted, and the frontend
generates a reinterpret cast, but casting back the other way resulted in
an error.  This has been fixed to be properly handled in the code
generation pass of VectorExp, and the conversion for lvalue and rvalue
handling done in convert_expr and convert_for_rvalue respectively.

PR d/106139

gcc/d/ChangeLog:

* d-convert.cc (convert_expr): Handle casting from array to vector.
(convert_for_rvalue): Rewrite vector to array casts of the same
element type into a constructor.
(convert_for_assignment): Return calling convert_for_rvalue.
* dmd/expressionsem.c (ExpressionSemanticVisitor::visit): Run semantic
on vector expression after lowering.
* expr.cc (ExprVisitor::visit (VectorExp *)): Handle generating a
vector expression from a static array.
* toir.cc (IRVisitor::visit (ReturnStatement *)): Call
convert_for_rvalue on return value.

gcc/testsuite/ChangeLog:

* gdc.dg/pr106139a.d: New test.
* gdc.dg/pr106139b.d: New test.
* gdc.dg/pr106139c.d: New test.
* gdc.dg/pr106139d.d: New test.
* gdc.test/fail_compilation/ice20264.d: New test.

(cherry picked from commit 329bef49da30158d30fed1106002bb71674776bd)

23 months agoDaily bump.
GCC Administrator [Mon, 4 Jul 2022 00:18:10 +0000 (00:18 +0000)]
Daily bump.

23 months agoFortran: error recovery on invalid CLASS(), PARAMETER declarations [PR105243]
Harald Anlauf [Wed, 29 Jun 2022 19:36:17 +0000 (21:36 +0200)]
Fortran: error recovery on invalid CLASS(), PARAMETER declarations [PR105243]

gcc/fortran/ChangeLog:

PR fortran/103137
PR fortran/103138
PR fortran/103693
PR fortran/105243
* decl.c (gfc_match_data_decl): Reject CLASS entity declaration
when it is given the PARAMETER attribute.

gcc/testsuite/ChangeLog:

PR fortran/103137
PR fortran/103138
PR fortran/103693
PR fortran/105243
* gfortran.dg/class_58.f90: Fix test.
* gfortran.dg/class_73.f90: New test.

Co-authored-by: Steven G. Kargl <kargl@gcc.gnu.org>
(cherry picked from commit 4c233cabbe388a6b8957c1507e129090e9267ceb)

23 months agoFortran: improve error recovery for EXTENDS_TYPE_OF() [PR106121]
Harald Anlauf [Tue, 28 Jun 2022 20:29:28 +0000 (22:29 +0200)]
Fortran: improve error recovery for EXTENDS_TYPE_OF() [PR106121]

gcc/fortran/ChangeLog:

PR fortran/106121
* simplify.c (gfc_simplify_extends_type_of): Do not attempt to
simplify when one of the arguments is a CLASS variable that was
not properly declared.

gcc/testsuite/ChangeLog:

PR fortran/106121
* gfortran.dg/extends_type_of_4.f90: New test.

Co-authored-by: Steven G. Kargl <kargl@gcc.gnu.org>
(cherry picked from commit b8f284d3673004dffae714b56ed663467c2a52a7)

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

23 months agoDaily bump.
GCC Administrator [Sat, 2 Jul 2022 00:18:27 +0000 (00:18 +0000)]
Daily bump.

23 months agoFortran: handle explicit-shape specs with constant bounds [PR105954]
Harald Anlauf [Mon, 20 Jun 2022 18:59:55 +0000 (20:59 +0200)]
Fortran: handle explicit-shape specs with constant bounds [PR105954]

gcc/fortran/ChangeLog:

PR fortran/105954
* decl.c (variable_decl): Adjust upper bounds for explicit-shape
specs with constant bound expressions to ensure non-negative
extents.

gcc/testsuite/ChangeLog:

PR fortran/105954
* gfortran.dg/pr105954.f90: New test.

(cherry picked from commit a312407bd715647f7c11b67e0a52effc94d0f15d)

23 months agoFortran: fix simplification of INDEX(str1,str2) [PR105691]
Harald Anlauf [Tue, 21 Jun 2022 21:20:18 +0000 (23:20 +0200)]
Fortran: fix simplification of INDEX(str1,str2) [PR105691]

gcc/fortran/ChangeLog:

PR fortran/105691
* simplify.c (gfc_simplify_index): Replace old simplification
code by the equivalent of the runtime library implementation.  Use
HOST_WIDE_INT instead of int for string index, length variables.

gcc/testsuite/ChangeLog:

PR fortran/105691
* gfortran.dg/index_6.f90: New test.

(cherry picked from commit ff35dbc02092fbcd3d814fcd9fe8e871c3f741fd)

23 months agoFortran: fix checking of arguments to UNPACK when MASK is a variable [PR105813]
Harald Anlauf [Fri, 24 Jun 2022 20:21:39 +0000 (22:21 +0200)]
Fortran: fix checking of arguments to UNPACK when MASK is a variable [PR105813]

gcc/fortran/ChangeLog:

PR fortran/105813
* check.c (gfc_check_unpack): Try to simplify MASK argument to
UNPACK so that checking of the VECTOR argument can work when MASK
is a variable.

gcc/testsuite/ChangeLog:

PR fortran/105813
* gfortran.dg/unpack_vector_1.f90: New test.

(cherry picked from commit f21f17f95c0237f4f987a5fa9f1fa9c7e0db3c40)

23 months agoc++: dependent generic lambda template-id [PR106024]
Jason Merrill [Fri, 24 Jun 2022 03:14:35 +0000 (23:14 -0400)]
c++: dependent generic lambda template-id [PR106024]

We were wrongly looking up the generic lambda op() in a dependent scope, and
then trying to look up its instantiation at substitution time, but lambdas
aren't instantiated, so we crashed.  The fix is to not look into dependent
lambda scopes.

PR c++/106024

gcc/cp/ChangeLog:

* parser.c (cp_parser_lookup_name): Don't look in dependent lambda.

gcc/testsuite/ChangeLog:

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

23 months agoDaily bump.
GCC Administrator [Fri, 1 Jul 2022 00:18:30 +0000 (00:18 +0000)]
Daily bump.

23 months agoDaily bump.
GCC Administrator [Thu, 30 Jun 2022 00:18:25 +0000 (00:18 +0000)]
Daily bump.

23 months agoDaily bump.
GCC Administrator [Wed, 29 Jun 2022 00:18:36 +0000 (00:18 +0000)]
Daily bump.

23 months agoDaily bump.
GCC Administrator [Tue, 28 Jun 2022 00:18:41 +0000 (00:18 +0000)]
Daily bump.

23 months agoDaily bump.
GCC Administrator [Mon, 27 Jun 2022 00:18:17 +0000 (00:18 +0000)]
Daily bump.

23 months agoDaily bump.
GCC Administrator [Sun, 26 Jun 2022 00:18:05 +0000 (00:18 +0000)]
Daily bump.

23 months agoDaily bump.
GCC Administrator [Sat, 25 Jun 2022 00:18:29 +0000 (00:18 +0000)]
Daily bump.

23 months agotilegx: Fix infinite loop in gen-mul-tables generator
Iain Buclaw [Wed, 22 Jun 2022 17:11:20 +0000 (19:11 +0200)]
tilegx: Fix infinite loop in gen-mul-tables generator

Since around GCC 10, the condition `j < (INTMAX_MAX / 10)' will get
optimized into `j != 922337203685477580', which will result in an
infinite loop for certain inputs of `j'.

Copy the condition already used by the -DTILEPRO generator code, which
doesn't fall into this trap.

gcc/ChangeLog:

* config/tilepro/gen-mul-tables.cc (tilegx_emit): Adjust loop
condition to avoid overflow.

(cherry picked from commit c0ad48527c314a1e9354b7c26718b56ed4abc92c)

23 months agoc++: anon union designated init [PR105925]
Jason Merrill [Thu, 23 Jun 2022 20:04:02 +0000 (16:04 -0400)]
c++: anon union designated init [PR105925]

This testcase was failing because CONSTRUCTOR_IS_DESIGNATED_INIT wasn't
getting set on the introduced CONSTRUCTOR for the anonymous union, and
build_aggr_conv uses that flag to decide whether to pay attention to the
indexes of the CONSTRUCTOR.  So set the flag when we see a designator rather
than relying on copying it from another CONSTRUCTOR.

PR c++/105925

gcc/cp/ChangeLog:

* decl.c (reshape_init_array_1): Set
CONSTRUCTOR_IS_DESIGNATED_INIT here.
(reshape_init_class): And here.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/desig26.C: New test.

23 months agoDaily bump.
GCC Administrator [Fri, 24 Jun 2022 00:18:13 +0000 (00:18 +0000)]
Daily bump.

23 months agoipa-icf: skip variables with body_removed
Martin Liska [Wed, 18 May 2022 13:07:53 +0000 (15:07 +0200)]
ipa-icf: skip variables with body_removed

Similarly to cgraph_nodes, it may happen that body_removed is set
during merging of symbols.

PR ipa/105600

gcc/ChangeLog:

* ipa-icf.c (sem_item_optimizer::filter_removed_items):
Skip variables with body_removed.

(cherry picked from commit 31ce821a790caec8a2849dd67a9847e78a33d14c)

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

23 months agoDaily bump.
GCC Administrator [Wed, 22 Jun 2022 00:18:23 +0000 (00:18 +0000)]
Daily bump.

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

23 months agoalpha: Introduce target specific store_data_bypass_p function [PR105209]
Uros Bizjak [Fri, 17 Jun 2022 15:19:44 +0000 (17:19 +0200)]
alpha: Introduce target specific store_data_bypass_p function [PR105209]

This patch introduces alpha-specific version of store_data_bypass_p that
ignores TRAP_IF that would result in assertion failure (and internal
compiler error) in the generic store_data_bypass_p function.

While at it, also remove ev4_ist_c reservation, store_data_bypass_p
can handle the patterns with multiple sets since some time ago.

2022-06-17  Uroš Bizjak  <ubizjak@gmail.com>

gcc/ChangeLog:

PR target/105209
* config/alpha/alpha-protos.h (alpha_store_data_bypass_p): New.
* config/alpha/alpha.c (alpha_store_data_bypass_p): New function.
(alpha_store_data_bypass_p_1): Ditto.
* config/alpha/ev4.md: Use alpha_store_data_bypass_p instead
of generic store_data_bypass_p.
(ev4_ist_c): Remove insn reservation.

gcc/testsuite/ChangeLog:

PR target/105209
* gcc.target/alpha/pr105209.c: New test.

(cherry picked from commit cc378e655740e93743e7f43e14faaff707aef6c1)

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