]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
4 years agomiddle-end/101009 - fix distance vector recording
Richard Biener [Fri, 11 Jun 2021 07:33:58 +0000 (09:33 +0200)] 
middle-end/101009 - fix distance vector recording

This fixes recording of distance vectors in case the DDR has just
constant equal indexes.  In that case we expect distance vectors
with zero distances to be recorded which is what was done when
any distance was computed for affine indexes.

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

PR middle-end/101009
* tree-data-ref.c (build_classic_dist_vector_1): Make sure
to set *init_b to true when we encounter a constant equal
index pair.
(compute_affine_dependence): Also dump the actual DR_REF.

* gcc.dg/torture/pr101009.c: New testcase.

(cherry picked from commit 336c41dbcb21740f8964021e157bc69ca547059b)

4 years agotree-optimization/100981 - fix SLP patterns involving reductions
Richard Biener [Wed, 9 Jun 2021 12:48:35 +0000 (14:48 +0200)] 
tree-optimization/100981 - fix SLP patterns involving reductions

The following fixes the SLP FMA patterns to preserve reduction
info and the reduction vectorization to consider internal function
call defs for the reduction stmt.

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

PR tree-optimization/100981
gcc/
* tree-vect-loop.c (vect_create_epilog_for_reduction): Use
gimple_get_lhs to also handle calls.
* tree-vect-slp-patterns.c (complex_pattern::build): Transfer
reduction info.

gcc/testsuite/
* gfortran.dg/vect/pr100981-1.f90: New testcase.

libgomp/
* testsuite/libgomp.fortran/pr100981-2.f90: New testcase.

4 years agotree-optimization/100934 - properly mark irreducible regions for DOM
Richard Biener [Mon, 14 Jun 2021 12:57:26 +0000 (14:57 +0200)] 
tree-optimization/100934 - properly mark irreducible regions for DOM

The jump threading code requires marked irreducible regions for the
purpose of validating jump threading paths but DOM fails to provide
that resulting in mised number of iteration upper bounds clearing.

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

PR tree-optimization/100934
* tree-ssa-dom.c (pass_dominator::execute): Properly
mark irreducible regions.

* gcc.dg/torture/pr100934.c: New testcase.

(cherry picked from commit 788bb7edb3975b80c4cb16323e7a5e55a2471e46)

4 years agoipa/100791 - copy fntype when processing __builtin_va_arg_pack
Richard Biener [Fri, 28 May 2021 11:31:35 +0000 (13:31 +0200)] 
ipa/100791 - copy fntype when processing __builtin_va_arg_pack

This missing copying exposed a type mismatch in the IL.

2021-05-28  Richard Biener  <rguenther@suse.de>

PR ipa/100791
* tree-inline.c (copy_bb): When processing __builtin_va_arg_pack
copy fntype from original call.

* gcc.dg/pr100791.c: New testcase.

(cherry picked from commit 359c0a86e2974a9f3036bc05b6e6c661f2c463cf)

4 years agoFortran: Fix double function call with -fcheck=pointer [PR]
José Rui Faustino de Sousa [Wed, 16 Jun 2021 00:53:06 +0000 (00:53 +0000)] 
Fortran: Fix double function call with -fcheck=pointer [PR]

gcc/fortran/ChangeLog:

PR fortran/82376
* trans-expr.c (gfc_conv_procedure_call): Evaluate function result
and then pass a pointer.

gcc/testsuite/ChangeLog:

PR fortran/82376
* gfortran.dg/PR82376.f90: New test.

4 years agoDaily bump.
GCC Administrator [Wed, 16 Jun 2021 00:18:43 +0000 (00:18 +0000)] 
Daily bump.

4 years agoDaily bump.
GCC Administrator [Tue, 15 Jun 2021 00:18:19 +0000 (00:18 +0000)] 
Daily bump.

4 years agocombine patterns for add-add fusion
Aaron Sawdey [Tue, 26 Jan 2021 03:11:52 +0000 (21:11 -0600)] 
combine patterns for add-add fusion

This patch adds a function to genfusion.pl to add a couple
more patterns so combine can do fusion of pairs of add and
vaddudm instructions.

Backport from mainline (rolled in a bugfix patch that followed
the original one).

gcc/ChangeLog:

* config/rs6000/genfusion.pl (gen_addadd): New function.
* config/rs6000/fusion.md: Regenerate file.
* config/rs6000/rs6000-cpus.def: Add
OPTION_MASK_P10_FUSION_2ADD to masks.
* config/rs6000/rs6000.c (rs6000_option_override_internal):
Handle default value of OPTION_MASK_P10_FUSION_2ADD.
* config/rs6000/rs6000.opt: Add -mpower10-fusion-2add.

gcc/testsuite/ChangeLog:

* gcc.target/powerpc/fusion-p10-addadd.c: New file.

4 years agoDo not check if SMS succeeds on powerpc
Aaron Sawdey [Fri, 11 Jun 2021 18:49:18 +0000 (13:49 -0500)] 
Do not check if SMS succeeds on powerpc

Backported from trunk.

These tests have become unstable and SMS either succeeds or doesn't
depending on things like changes in instruction latency. Removing
the scan-rtl-dump-times checks for powerpc*-*-*.

gcc/testsuite

* gcc.dg/sms-1.c: Remove scan-rtl-dump-times check.
* gcc.dg/sms-2.c: Remove scan-rtl-dump-times check.
* gcc.dg/sms-3.c: Remove scan-rtl-dump-times check.
* gcc.dg/sms-4.c: Remove scan-rtl-dump-times check.
* gcc.dg/sms-6.c: Remove scan-rtl-dump-times check.
* gcc.dg/sms-8.c: Remove scan-rtl-dump-times check.
* gcc.dg/sms-10.c: Remove scan-rtl-dump-times check.

4 years agolibstdc++: Fix common_reference for non-reference results [PR100894]
Jonathan Wakely [Mon, 14 Jun 2021 19:31:00 +0000 (20:31 +0100)] 
libstdc++: Fix common_reference for non-reference results [PR100894]

The result of COMMON-REF(A&, B&&) where they have no common reference
type should be ill-formed. Our implementation fails to check that the
COMMON-REF result is a reference, so is well-formed when it shouldn't
be. This means that common_reference uses that result when it shouldn't
do.

The fix is to reject the result of COMMON-REF(A, B) if it's not a
reference, so that common_reference falls through to the next case,
which uses COND-RES, which yields the correct non-reference result.

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

PR libstdc++/100894
* include/std/type_traits (__common_ref_impl<X&, Y&>): Only
use the type if it's a reference.
* testsuite/20_util/common_reference/100894.cc: New test.

(cherry picked from commit c37b5ddcc88e0cc0f6a4ad609eda51021df0f6bb)

4 years agolibstdc++: Do not use static_assert without message in C++11
Jonathan Wakely [Thu, 20 May 2021 20:12:15 +0000 (21:12 +0100)] 
libstdc++: Do not use static_assert without message in C++11

libstdc++-v3/ChangeLog:

* include/bits/random.tcc (__representable_as_double)
(__p1_representable_as_double): Add "" to static asserts.

(cherry picked from commit 64ba45c76e831914764b70207d69a06f800b43a4)

4 years agolibstdc++: Only run Filesystem TS test if supported
Jonathan Wakely [Mon, 14 Jun 2021 13:22:07 +0000 (14:22 +0100)] 
libstdc++: Only run Filesystem TS test if supported

libstdc++-v3/ChangeLog:

* testsuite/experimental/filesystem/path/native/conv_c++23.cc:
Add dg-require-filesystem-ts directive.

(cherry picked from commit a40d2293a7a417fc7711f8f4e52dbd4c48c2a43f)

4 years agolibstdc++: Fix std::any constraints [PR101034]
Jonathan Wakely [Mon, 14 Jun 2021 13:18:33 +0000 (14:18 +0100)] 
libstdc++: Fix std::any constraints [PR101034]

PR libstdc++/101034

libstdc++-v3/ChangeLog:

* include/std/any (any(in_place_t<T>, initializer_list<U>, A&&...))
(any::emplace<T>(initializer_list<U>, A&&...)): Fix constraint
to use lvalue.
* testsuite/20_util/any/cons/101034.cc: New test.

(cherry picked from commit 14f26c75d255ef05b706a12d25b003da8a2f5b45)

4 years agolibstdc++: Add explicit -std=gnu++17 option to test
Jonathan Wakely [Mon, 14 Jun 2021 12:17:40 +0000 (13:17 +0100)] 
libstdc++: Add explicit -std=gnu++17 option to test

This test has no -std option so when the testsuite is run with
-std=gnu++20 or later, this test will use that. The recent addition of
no_unique_address will cause it to FAIL, because that's a reserved word
after C++17. Add an explicit option, so that this test alays uses
exactly C++17.

libstdc++-v3/ChangeLog:

* testsuite/17_intro/headers/c++2017/all_attributes.cc: Add
-std=gnu++17 option.

(cherry picked from commit 45fb3d45a4d4b79a00c56fa93e9e69d9d7762ca0)

4 years agolibstdc++: Use reserved name for attribute [PR101055]
Jonathan Wakely [Mon, 14 Jun 2021 09:58:15 +0000 (10:58 +0100)] 
libstdc++: Use reserved name for attribute [PR101055]

The no_unique_address attribute is not a reserved name until C++20, so
to use it in C++11/14/17 modes we should use the __no_unique_address_
form. We already use that form when using the attribute, but not in the
__has_cpp_attribute check.

libstdc++-v3/ChangeLog:

PR libstdc++/101055
* include/std/tuple: Use reserved form of attribute name.
* testsuite/17_intro/headers/c++2011/all_attributes.cc: Add
check for no_unique_address.
* testsuite/17_intro/headers/c++2014/all_attributes.cc:
Likewise.
* testsuite/17_intro/headers/c++2017/all_attributes.cc:
Likewise.

(cherry picked from commit 917efba2dd4ff34336d0d3aa55285ae22503e4aa)

4 years agolibstdc++: Fix up semiregular-box partial specialization [PR100475]
Patrick Palka [Tue, 18 May 2021 04:28:44 +0000 (00:28 -0400)] 
libstdc++: Fix up semiregular-box partial specialization [PR100475]

This makes the in-place constructor of our partial specialization of
__box for already-semiregular types perform direct-non-list-initialization
(in accordance with the specification of the primary template), and
additionally makes the member function data() use std::__addressof.

libstdc++-v3/ChangeLog:

PR libstdc++/100475
* include/std/ranges (__box::__box): Use non-list-initialization
in member initializer list of in-place constructor of the
partial specialization for semiregular types.
(__box::operator->): Use std::__addressof.
* testsuite/std/ranges/adaptors/detail/semiregular_box.cc
(test02): New test.
* testsuite/std/ranges/single_view.cc (test04): New test.

(cherry picked from commit fe993b469c528230d9a01e1ae2208610f960dd9f)

4 years agoDaily bump.
GCC Administrator [Mon, 14 Jun 2021 00:18:13 +0000 (00:18 +0000)] 
Daily bump.

4 years agoDaily bump.
GCC Administrator [Sun, 13 Jun 2021 00:18:13 +0000 (00:18 +0000)] 
Daily bump.

4 years agoDaily bump.
GCC Administrator [Sat, 12 Jun 2021 00:18:14 +0000 (00:18 +0000)] 
Daily bump.

4 years agolibstdc++: Fix filesystem::path comparisons for C++23
Jonathan Wakely [Fri, 11 Jun 2021 18:18:11 +0000 (19:18 +0100)] 
libstdc++: Fix filesystem::path comparisons for C++23

In C++23 there is a basic_string_view(Range&&) constructor, which is
constrained to take a range (specifically, a contiguous_range). When the
filesystem::path comparison operators call lhs.compare(rhs) the overload
taking a string_view is considered, which means checking whether path
satisfies the range concept. That satisfaction result changes depending
whether path::iterator is complete, which is ill-formed; no diagnostic
required. To avoid the problem, this change ensures that the overload
resolution is performed in a context where path::iterator is complete
and the range concept is satisfied. (The result of overload resolution
is always that the compare(const path&) overload is the best match, but
we still have to consider the compare(basic_string_view<value_type>) one
to decide if it even participates in overload resolution).

For std::filesystem::path we can't define the comparison operators later
in the file, because they are hidden friends, so a new helper is
introduced that gets defined when everything else is complete.

For std::experimental::filesystem::path we can just move the definitions
of the comparison operators later in the file.

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

* include/bits/fs_path.h (operator==, operator<=>): Use new
_S_compare function.
(path::_S_compare): New function to call path::compare in a
context where path::iterator is complete.
* include/experimental/bits/fs_path.h (operator<, operator==):
Define after path::iterator is complete.
* testsuite/27_io/filesystem/path/native/conv_c++23.cc: New
test.
* testsuite/experimental/filesystem/path/native/conv_c++23.cc:
New test.

(cherry picked from commit 1e690757d30775ed340a368b9a9463b2ad68de01)

4 years agolibstdc++: Finish implementing LWG 3413 for propagate_const
Jonathan Wakely [Tue, 8 Jun 2021 13:56:57 +0000 (14:56 +0100)] 
libstdc++: Finish implementing LWG 3413 for propagate_const

We already have conditional noexcept so this just constrains the
non-member swap overload.

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

* include/experimental/propagate_const (swap): Constrain.
* testsuite/experimental/propagate_const/swap/lwg3413.cc: New test.

(cherry picked from commit d319517e809ee50496db29e552f86a83a14c837c)

4 years agolibstdc++: Fix constraint on std::optional assignment [PR 100982]
Jonathan Wakely [Wed, 9 Jun 2021 10:03:15 +0000 (11:03 +0100)] 
libstdc++: Fix constraint on std::optional assignment [PR 100982]

libstdc++-v3/ChangeLog:

PR libstdc++/100982
* include/std/optional (optional::operator=(const optional<U>&)):
Fix value category used in is_assignable check.
* testsuite/20_util/optional/assignment/100982.cc: New test.

(cherry picked from commit b3fce1bd45f72cc9e55fb7431762e92e30fefcf1)

4 years agolibstdc++: Constrain three-way comparison for std::optional [PR 98842]
Jonathan Wakely [Mon, 7 Jun 2021 12:02:15 +0000 (13:02 +0100)] 
libstdc++: Constrain three-way comparison for std::optional [PR 98842]

The operator<=>(const optional<T>&, const U&) operator is supposed to be
constrained with three_way_comparable_with<U, T> so that it can only be
used when T and U are weakly-equality-comparable and also three-way
comparable.

Adding that constrain completely breaks std::optional comparisons,
because it causes constraint recursion. To avoid that, an additional
check that U is not a specialization of std::optional is needed. That
appears to be a defect in the standard and should be reported to LWG.

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

PR libstdc++/98842
* include/std/optional (operator<=>(const optional<T>& const U&)):
Add missing constraint and add workaround for template
recursion.
* testsuite/20_util/optional/relops/three_way.cc: Check that
type without equality comparison cannot be compared when wrapped
in std::optional.

(cherry picked from commit adec14811714e22a6c1f7f0199adc05370f0d8b0)

4 years agolibstdc++: Fix return type of ranges::ssize for 128-bit integer [PR 100824]
Jonathan Wakely [Sat, 5 Jun 2021 10:42:01 +0000 (11:42 +0100)] 
libstdc++: Fix return type of ranges::ssize for 128-bit integer [PR 100824]

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

PR libstdc++/100824
* include/bits/ranges_base.h (_SSize): Return signed type.
* testsuite/std/ranges/access/ssize.cc: Check with __int128.

(cherry picked from commit 96963713f6a648a0ed890450e02ebdd8ff583b14)

4 years agolibstdc++: Implement LWG 3403 for std::ranges::ssize
Jonathan Wakely [Fri, 4 Jun 2021 19:28:04 +0000 (20:28 +0100)] 
libstdc++: Implement LWG 3403 for std::ranges::ssize

I already changed the constraints for ranges::ssize to use ranges::size,
this implements the rest of LWG 3403, so that the returned type is the
signed type corresponding to the result of ranges::size.

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

* include/bits/ranges_base.h (_SSize): Return the result of
ranges::size converted to the wider of make-signed-like-t<S> and
ptrdiff_t, rather than the ranges different type.
* testsuite/std/ranges/access/ssize.cc: Adjust expected result
for an iota_view that uses an integer class type for its
difference_type.

(cherry picked from commit 621ea10ca060ba19ec693aa73b5e29d553cca849)

4 years agolibstdc++: Fix helper concept for ranges::data [PR 100824]
Jonathan Wakely [Fri, 4 Jun 2021 19:25:39 +0000 (20:25 +0100)] 
libstdc++: Fix helper concept for ranges::data [PR 100824]

We need to decay the result of t.data() before checking if it's a
pointer.

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

PR libstdc++/100824
* include/bits/ranges_base.h (__member_data): Use __decay_copy.
* testsuite/std/ranges/access/data.cc: Add testcase from PR.

(cherry picked from commit 3e5f2425f80aedd00f28235022a2755eb46f310d)

4 years agolibstdc++: Fix value categories used by ranges access CPOs [PR 100824]
Jonathan Wakely [Fri, 4 Jun 2021 14:59:38 +0000 (15:59 +0100)] 
libstdc++: Fix value categories used by ranges access CPOs [PR 100824]

The implementation of P2091R0 was incomplete, so that some range access
CPOs used perfect forwarding where they should not. This fixes it by
consistently operating on lvalues.

Some additional changes that are not necessary to fix the bug:

Modify the __as_const helper to simplify its usage. Instead of deducing
the value category from its argument, and requiring callers to forward
the argument as the correct category, add a non-deduced template
parameter which is used for the value category and accept the argument
as an lvalue. This means callers say __as_const<T>(t) instead of
__as_const(std::forward<T>(t)).

Always use an lvalue reference type as the template argument for the
_S_noexcept helpers, so that we only instantiate one specialization for
lvalues and rvalues of the same type.

Move some helper concepts and functions from namespace std::__detail
to ranges::__cust_access, to be consistent with the ranges::begin CPO.
This ensures that the __adl_begin concept and the _Begin::operator()
function are in the same namespace, so unqualified lookup is consistent
and the poison pills for begin are visible to both.

Simplified static assertions for arrays, because the expression a+0 is
already ill-formed for an array of incomplete type.

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

PR libstdc++/100824
* include/bits/iterator_concepts.h (__detail::__decay_copy)
(__detail::__member_begin, __detail::__adl_begin): Move to
namespace ranges::__cust_access.
(__detail::__ranges_begin): Likewise, and rename to __begin.
Remove redundant static assertion.
* include/bits/ranges_base.h (_Begin, _End, _RBegin, _REnd):
Use lvalue in noexcept specifier.
(__as_const): Add non-deduced parameter for value category.
(_CBegin, _CEnd, _CRBegin, _CREnd, _CData): Adjust uses of
__as_const.
(__member_size, __adl_size, __member_empty, __size0_empty):
(__eq_iter_empty, __adl_data): Use lvalue objects in
requirements.
(__sentinel_size): Likewise. Add check for conversion to
unsigned-like.
(__member_data): Allow non-lvalue types to satisfy the concept,
but use lvalue object in requirements.
(_Size, _SSize): Remove forwarding to always use an lvalue.
(_Data): Likewise. Add static assertion for arrays.
* testsuite/std/ranges/access/cdata.cc: Adjust expected
behaviour for rvalues. Add negative tests for ill-formed
expressions.
* testsuite/std/ranges/access/data.cc: Likewise.
* testsuite/std/ranges/access/empty.cc: Adjust expected
behaviour for rvalues.
* testsuite/std/ranges/access/size.cc: Likewise.

(cherry picked from commit ee9548b36a7f17e8a63585b58f340c93dcba95d8)

4 years agolibstdc++: Add feature test macro for heterogeneous lookup in unordered containers
Jonathan Wakely [Fri, 4 Jun 2021 14:59:37 +0000 (15:59 +0100)] 
libstdc++: Add feature test macro for heterogeneous lookup in unordered containers

Also update the C++20 status docs.

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

* doc/xml/manual/status_cxx2020.xml:
* doc/html/*: Regenerate.
* include/bits/hashtable.h (__cpp_lib_generic_unordered_lookup):
Define.
* include/std/version (__cpp_lib_generic_unordered_lookup):
Define.
* testsuite/23_containers/unordered_map/operations/1.cc: Check
feature test macro.
* testsuite/23_containers/unordered_set/operations/1.cc:
Likewise.

(cherry picked from commit f78f25f43864f38ae5a6a9fcce8f26c94fe45bcd)

4 years agod: foreach over a tuple doesn't work on 16-bit targets (PR100999)
Iain Buclaw [Fri, 11 Jun 2021 17:33:07 +0000 (19:33 +0200)] 
d: foreach over a tuple doesn't work on 16-bit targets (PR100999)

Improves semantic passes in the front-end around the `foreach' and
`static foreach' statements to be more resilient to compiling in a
minimal D runtime environment.  Checking of the index type has been
improved as well so now there won't be needless compiler errors when
using 8 or 16-bit integers as index types when the size fits the
expected loop range.

gcc/d/ChangeLog:

PR d/100999
* dmd/cond.c (lowerArrayAggregate): Run CTFE interpret on foreach
input range.
(createTupleType): Don't generate typeinfo when disabled.
(lowerNonArrayAggregate): Suppress errors when running type semantic.
(staticForeachPrepare): Don't run CTFE interpret from here.
* dmd/dinterpret.c (ctfeInterpret): Add more shortcut cases.
* dmd/expression.c (Expression::checkPostblit): Don't generate
typeinfo when type is missing from library.
* dmd/expressionsem.c (resolvePropertiesX): Remove early error.
* dmd/statementsem.c (StatementSemanticVisitor::declareVariable):
Don't override index type.
(StatementSemanticVisitor::makeTupleForeachBody): Check index type is
integral and index range fits type size.
(StatementSemanticVisitor::visit (ForeachStatement*)): Adjust index
range before testing.

libphobos/ChangeLog:

PR d/100999
* src/std/typecons.d (template Proxy): Check for field or property
functions as the else branch.

gcc/testsuite/ChangeLog:

PR d/100999
* gdc.test/compilable/staticforeach.d: Add new tests.
* gdc.test/fail_compilation/diag16976.d: Likewise.
* gdc.test/fail_compilation/fail117.d: Likewise.
* gdc.test/fail_compilation/fail238_m32.d: Likewise.
* gdc.test/fail_compilation/fail238_m64.d: Likewise.
* gdc.test/fail_compilation/fail7424b.d: Likewise.
* gdc.test/fail_compilation/fail7424c.d: Likewise.
* gdc.test/fail_compilation/fail7424d.d: Likewise.
* gdc.test/fail_compilation/fail7424e.d: Likewise.
* gdc.test/fail_compilation/fail7424f.d: Likewise.
* gdc.test/fail_compilation/fail7424g.d: Likewise.
* gdc.test/fail_compilation/fail7424h.d: Likewise.
* gdc.test/fail_compilation/fail7424i.d: Likewise.
* gdc.test/fail_compilation/fail9766.d: Likewise.
* gdc.test/fail_compilation/ice9406.d: Likewise.
* gdc.test/compilable/extra-files/minimal/object.d: New file.
* gdc.test/compilable/interpret5.d: New test.
* gdc.test/compilable/minimal3.d: New test.
* gdc.test/compilable/test21742.d: New test.
* gdc.test/compilable/test22006.d: New test.
* gdc.test/fail_compilation/b12504.d: New test.
* gdc.test/fail_compilation/fail22006.d: New test.
* gdc.test/fail_compilation/test21927.d: New test.
* gdc.test/fail_compilation/test21939.d: New test.

(cherry picked from commit 68f46862d33707450bdf70cfddd91ae2a12527a8)

4 years agoDaily bump.
GCC Administrator [Fri, 11 Jun 2021 09:11:15 +0000 (09:11 +0000)] 
Daily bump.

4 years agoTest cases for p10 fusion patterns
Aaron Sawdey [Fri, 11 Dec 2020 19:47:12 +0000 (13:47 -0600)] 
Test cases for p10 fusion patterns

This adds some test cases to make sure that the combine patterns for p10
fusion are working.

Backport from trunk.

gcc/testsuite/ChangeLog:
* gcc.target/powerpc/fusion-p10-ldcmpi.c: New file.
* gcc.target/powerpc/fusion-p10-2logical.c: New file.

(cherry picked from commit bdc716235143aafaae1056188fcadacda560303c)

4 years agoAdd insn types for fusion pairs
Aaron Sawdey [Tue, 2 Mar 2021 23:50:52 +0000 (17:50 -0600)] 
Add insn types for fusion pairs

This adds new values for insn attr type for p10 fusion. The genfusion.pl
script is modified to use them, and fusion.md regenerated to capture
the new patterns. There are also some formatting only changes to
fusion.md that apparently weren't captured after a previous commit
of genfusion.pl.

Backport from trunk.

gcc/
* config/rs6000/rs6000.md (define_attr "type"): Add types for fusion.
* config/rs6000/genfusion.pl (gen_ld_cmpi_p10): Use new fusion types.
(gen_2logical): Use new fusion types.
* config/rs6000/fusion.md: Regenerate.

gcc/testsuite/

* gcc.dg/sms-4.c: Xfail for powerpc because changes in
instruction latency cause SMS to work or fail.

4 years agoc++: normalization of non-templated return-type-req [PR100946]
Patrick Palka [Thu, 10 Jun 2021 22:31:18 +0000 (18:31 -0400)] 
c++: normalization of non-templated return-type-req [PR100946]

Here the satisfaction cache is conflating the satisfaction value of the
two return-type-requirements because the corresponding constrained
'auto's have level 2, but they capture an empty current_template_parms.
This ultimately causes the satisfaction cache to think the type
constraint doesn't depend on the deduced type of the expression.

When normalizing the constraints on an 'auto', the assumption made by
normalize_placeholder_type_constraints is that the level of the 'auto'
is one greater than the depth of the captured current_template_parms, an
assumption which is not holding here.  So this patch just makes n_p_t_c
adjust the normalization context appropriately in this situation.

PR c++/100946

gcc/cp/ChangeLog:

* constraint.cc (normalize_placeholder_type_constraints): When
normalizing a non-templated return-type-requirement, add a dummy
level to initial_parms.

gcc/testsuite/ChangeLog:

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

(cherry picked from commit 206db06ee380f490db0293af4ea7a4d590abd78c)

4 years agolibgo: update to Go1.16.5 release
Ian Lance Taylor [Thu, 10 Jun 2021 21:42:17 +0000 (14:42 -0700)] 
libgo: update to Go1.16.5 release

4 years agolibstdc++: Simplify range adaptors' forwarding of bound args [PR100577]
Patrick Palka [Thu, 3 Jun 2021 13:49:30 +0000 (09:49 -0400)] 
libstdc++: Simplify range adaptors' forwarding of bound args [PR100577]

r11-8053 rewrote the range adaptor implementation in conformance with
P2281R1, making partial application act like a SFINAE-friendly perfect
forwarding call wrapper.  Making SFINAE-friendliness coexist with
perfect forwarding here requires adding fallback deleted operator()
overloads (as described in e.g. section 5.5 of P0847R6).  But
unfortunately, as reported in PR100577, this necessary technique of
using of deleted overloads regresses diagnostics for ill-formed calls to
partially applied range adaptors in GCC.

Although GCC's diagnostics can arguably be improved here by having the
compiler explain why the other candidates weren't viable when overload
resolution selects a deleted candidate, we can also largely work around
this on the library side (and achieve more concise diagnostics than by
a frontend-side improvement alone) if we take advantage of the
observation that not all range adaptors need perfect forwarding call
wrapper semantics, in fact only views::split currently needs it, because
all other range adaptors either take no extra arguments or only
arguments that are expected to be freely/cheaply copyable, e.g. function
objects and integer-like types.  (The discussion section in P2281R1 goes
into detail about why views::split is special.)

To that end, this introduces opt-in flags for denoting a range adaptor
as having "simple" extra arguments (in the case of a range adaptor
non-closure) or having a "simple" call operator (in the case of a range
adaptor closure).  These flags are then used to conditionally simplify
the operator() for the generic _Partial and _Pipe class templates, down
from needing three overloads thereof (including one defined as deleted)
to just needing a single overload.  The end result is that diagnostic
quality is restored for all adaptors except for views::split, and
diagnostics for the adaptors are generally made more concise since
there's only a single _Partial/_Pipe overload to diagnose instead of
three of them.

libstdc++-v3/ChangeLog:

PR libstdc++/100577
* include/std/ranges (_RangeAdaptorClosure): Document
_S_has_simple_call_op mechanism.
(_RangeAdaptor): Document _S_has_simple_extra_args mechanism.
(__closure_has_simple_call_op): New concept.
(__adaptor_has_simple_extra_args): Likewise.
(_Partial<_Adaptor, _Args...>): New partial specialization.
(_Partial<_Adaptor, _Arg>): Likewise.
(_Pipe<_Lhs, _Rhs>): Likewise.
(views::_All::_S_has_simple_call_op): Define to true.
(views::_Filter::_S_has_simple_extra_args): Likewise.
(views::_Transform::_S_has_simple_extra_args): Likewise.
(views::_Take::_S_has_simple_extra_args): Likewise.
(views::_TakeWhile::_S_has_simple_extra_args): Likewise.
(views::_Drop::_S_has_simple_extra_args): Likewise.
(views::_DropWhile::_S_has_simple_extra_args): Likewise.
(views::_Join::_S_has_simple_call_op): Likewise.
(views::_Split): Document why we don't define
_S_has_simple_extra_args to true for this adaptor.
(views::_Common::_S_has_simple_call_op): Define to true.
(views::_Reverse::_S_has_simple_call_op): Likewise.
(views::_Elements::_S_has_simple_call_op): Likewise.
* testsuite/std/ranges/adaptors/100577.cc: New test.

(cherry picked from commit 57ed620ebfa4275d04efeec973e88f506b0e3ba8)

4 years agolibstdc++: Avoid hard error in ranges::unique_copy [PR100770]
Patrick Palka [Thu, 3 Jun 2021 16:30:29 +0000 (12:30 -0400)] 
libstdc++: Avoid hard error in ranges::unique_copy [PR100770]

Here, in the constexpr if condition within ranges::unique_copy, when
input_iterator<_Out> isn't satisfied we must avoid substituting into
iter_value_t<_Out> because the latter isn't necessarily well-formed
then.  To that end, this patch factors out the condition into a concept
and uses it throughout.

This patch also makes the definition of our testsuite
output_iterator_wrapper more minimal by setting its value_type, pointer
and reference member types to void.  This means our existing tests for
unique_copy already exercise the fix for this bug, so we don't need
to add another test.  The only other fallout of this testsuite iterator
change appears in std/ranges/range.cc, where the use of range_value_t
on a test_output_range is now ill-formed.

PR libstdc++/100770

libstdc++-v3/ChangeLog:

* include/bits/ranges_algo.h (__detail::__can_reread_output):
Factor out this concept from ...
(__unique_copy_fn::operator()): ... here.  Use the concept
throughout.
* testsuite/std/ranges/range.cc: Remove now ill-formed use
of range_value_t on an output_range.
* testsuite/util/testsuite_iterators.h (output_iterator_wrapper):
Define value_type, pointer and reference member types to void.

(cherry picked from commit 0614bbbe59c6953e088cffa39dfe63d86fc1fa96)

4 years agolibstdc++: Fix access issue in iota_view::_Sentinel [PR100690]
Patrick Palka [Fri, 21 May 2021 03:39:05 +0000 (23:39 -0400)] 
libstdc++: Fix access issue in iota_view::_Sentinel [PR100690]

libstdc++-v3/ChangeLog:

PR libstdc++/100690
* include/std/ranges (iota_view::_Sentinel::_M_distance_from):
Split out this member function from ...
(iota_view::_Sentinel::operator-): ... here, for sake of access
control.
* testsuite/std/ranges/iota/iota_view.cc (test05): New test.

(cherry picked from commit 317a38cd468d565dc8ce45c6da0dbccf38808f70)

4 years agolibstdc++: Implement LWG 3533 changes to foo_view::iterator::base()
Patrick Palka [Thu, 6 May 2021 13:11:44 +0000 (09:11 -0400)] 
libstdc++: Implement LWG 3533 changes to foo_view::iterator::base()

libstdc++-v3/ChangeLog:

* include/std/ranges (filter_view::_Iterator::base): Make the
const& overload unconstrained and return a const reference as
per LWG 3533.  Make unconditionally noexcept.
(transform_view::_Iterator::base): Likewise.
(elements_view::_Iterator::base): Likewise.

(cherry picked from commit eb1aa9ad2afbcd8f3e939310d5785ff8563a8c5c)

4 years agolibstdc++: Implement LWG 3391 changes to move/counted_iterator::base()
Patrick Palka [Thu, 6 May 2021 13:11:42 +0000 (09:11 -0400)] 
libstdc++: Implement LWG 3391 changes to move/counted_iterator::base()

libstdc++-v3/ChangeLog:

* include/bits/stl_iterator.h (move_iterator::base): Make the
const& overload unconstrained and return a const reference as
per LWG 3391.  Make unconditionally noexcept.
(counted_iterator::base): Likewise.
* testsuite/24_iterators/move_iterator/lwg3391.cc: New test.
* testsuite/24_iterators/move_iterator/move_only.cc: Adjust
has_member_base concept to decay-copy the result of base().

(cherry picked from commit 08f3287eefea1d7c244db795d018870e8148d1c8)

4 years agolibstdc++: Fix access issue in elements_view::_Sentinel [PR100631]
Patrick Palka [Tue, 18 May 2021 14:21:27 +0000 (10:21 -0400)] 
libstdc++: Fix access issue in elements_view::_Sentinel [PR100631]

In the earlier commit r12-854 I forgot to also rewrite the other operator-
overload in terms of the split-out member function _M_distance_from.

libstdc++-v3/ChangeLog:

PR libstdc++/100631
* include/std/ranges (elements_view::_Sentinel::operator-): Use
_M_distance_from in the other operator- overload too.
* testsuite/std/ranges/adaptors/elements.cc (test06): Augment test.

(cherry picked from commit 38751c4d5e15bd1c682ac4c868a2c4ce48ca5503)

4 years agolibstdc++: Fix miscellaneous issues with elements_view::_Sentinel [PR100631]
Patrick Palka [Tue, 18 May 2021 04:26:07 +0000 (00:26 -0400)] 
libstdc++: Fix miscellaneous issues with elements_view::_Sentinel [PR100631]

libstdc++-v3/ChangeLog:

PR libstdc++/100631
* include/std/ranges (elements_view::_Iterator): Also befriend
_Sentinel<!_Const>.
(elements_view::_Sentinel::_M_equal): Templatize.
(elements_view::_Sentinel::_M_distance_from): Split out from ...
(elements_view::_Sentinel::operator-): ... here.  Depend on
_Base2 instead of _Base in the return type.
* testsuite/std/ranges/adaptors/elements.cc (test06, test07):
New tests.

(cherry picked from commit 2e2eef80ac0c21f9533e6791ccf5e29458cbb77c)

4 years agolibstdc++: Implement missing P0896R4 changes to reverse_iterator [PR100639]
Patrick Palka [Thu, 20 May 2021 18:08:17 +0000 (14:08 -0400)] 
libstdc++: Implement missing P0896R4 changes to reverse_iterator [PR100639]

This implements the P0896R4 changes to reverse_iterator's member types
value_type, difference_type and reference in C++20 mode, which fixes
taking the reverse_iterator of an iterator with a non-integral
difference_type (such as iota_view<long long>).

libstdc++-v3/ChangeLog:

PR libstdc++/100639
* include/bits/stl_iterator.h (reverse_iterator::difference_type):
In C++20 mode, define in terms of iter_difference_t as per P0896R4.
(reverse_iterator::reference): Likewise, but with iter_reference_t.
(reverse_iterator::value_type): Likewise, but with iter_value_t.
* testsuite/std/ranges/adaptors/reverse.cc (test08): New test.
* testsuite/24_iterators/reverse_iterator/100639.cc: New test.

(cherry picked from commit d5cbe0f0d4b7bc11f80b2236521f90ec94e95767)

4 years agod: Fix ICE in TypeInfoDeclaration, at dmd/declaration.c (PR100967)
Iain Buclaw [Thu, 10 Jun 2021 17:59:23 +0000 (19:59 +0200)] 
d: Fix ICE in TypeInfoDeclaration, at dmd/declaration.c (PR100967)

Generate a stub TypeInfo class even if the root Object class is missing.
The front-end will take care of issuing an error and abort the
compilation when running semantic on constructed TypeInfo objects.

The errors issued by the code generation pass relating to missing or
disabled RTTI has been consolidated into a single function, so that a
meaningful error will be emitted before the front-end terminates.

gcc/d/ChangeLog:

PR d/100967
* d-frontend.cc (getTypeInfoType): Move TypeInfo checks to
check_typeinfo_type and call new function.
* d-tree.h (check_typeinfo_type): Declare.
* typeinfo.cc: Include dmd/scope.h.
(create_frontend_tinfo_types): Generate front-end types even if Object
is missing.
(build_typeinfo): Move TypeInfo checks to check_typeinfo_type and call
new function.
(check_typeinfo_type): New function.

gcc/testsuite/ChangeLog:

PR d/100967
* gdc.dg/pr100967.d: New test.

(cherry picked from commit 5ae4a73057dd26e7f09b5ba5190b84b1bbea4368)

4 years agoDaily bump.
GCC Administrator [Thu, 10 Jun 2021 00:18:12 +0000 (00:18 +0000)] 
Daily bump.

4 years agolibstd++: Only support atomic_ref::wait tests which are always lockfree
Thomas Rodgers [Wed, 9 Jun 2021 20:44:31 +0000 (13:44 -0700)] 
libstd++: Only support atomic_ref::wait tests which are always lockfree

Fixes a regression on arm32 targets.

libstdc++-v3/ChangeLog:
* testsuite/29_atomics/atomic_ref/wait_notify.cc: Guard
test logic with constexpr check for is_always_lock_free.

(cherry picked from commit eb3a3bb8ce4ce2420919d03a3e9f9a2a4297c4d3)

4 years agod: TypeInfo error when using slice copy on Structs (PR100964)
Iain Buclaw [Wed, 9 Jun 2021 17:39:28 +0000 (19:39 +0200)] 
d: TypeInfo error when using slice copy on Structs (PR100964)

Known limitation: does not work for struct with postblit or dtor.

gcc/d/ChangeLog:

PR d/100964
* dmd/expression.c (Expression::checkPostblit): Don't generate
TypeInfo when RTTI is disabled.

gcc/testsuite/ChangeLog:

PR d/100964
* gdc.test/compilable/betterCarray.d: Add test cases.

(cherry picked from commit 036e14ca44eaddf329a79d56d556862118b1f220)

4 years agod: Respect explicit align(N) type alignment (PR100935)
Iain Buclaw [Wed, 9 Jun 2021 17:37:22 +0000 (19:37 +0200)] 
d: Respect explicit align(N) type alignment (PR100935)

It was previously the natural type alignment, defined as the maximum of
the field alignments for an aggregate.  Make sure an explicit align(N)
overrides it.

gcc/d/ChangeLog:

PR d/100935
* dmd/mtype.c (Type::getProperty): Prefer explicit alignment over
natural alignment for alignof property.

gcc/testsuite/ChangeLog:

PR d/100935
* gdc.test/compilable/aggr_alignment.d: Add test cases.

(cherry picked from commit 04fea2d66bd680beb1a204e62f2f459307000813)

4 years agoc++: explicit() ignored on deduction guide [PR100065]
Marek Polacek [Mon, 7 Jun 2021 20:06:00 +0000 (16:06 -0400)] 
c++: explicit() ignored on deduction guide [PR100065]

When we have explicit() with a value-dependent argument, we can't
evaluate it at parsing time, so cp_parser_function_specifier_opt stashes
the argument into the decl-specifiers and grokdeclarator then stores it
into explicit_specifier_map, which is then used when substituting the
function decl.  grokdeclarator stores it for constructors and conversion
functions, but we also need to do it for deduction guides, otherwise
we'll forget that we've seen an explicit-specifier as in the attached
test.

PR c++/100065

gcc/cp/ChangeLog:

* decl.c (grokdeclarator): Store a value-dependent
explicit-specifier even for deduction guides.

gcc/testsuite/ChangeLog:

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

(cherry picked from commit 1afa4facb9348cac0349ff9c30066aa25a3608f7)

4 years agoFix old thinko in warning on pointer for storage order purposes
Eric Botcazou [Wed, 9 Jun 2021 10:37:47 +0000 (12:37 +0200)] 
Fix old thinko in warning on pointer for storage order purposes

gcc/c
PR c/100920
* c-typeck.c (convert_for_assignment): Test fndecl_built_in_p to
spot built-in functions. Do not warn on pointer assignment and
initialization for storage order purposes if the RHS is a call
to a DECL_IS_MALLOC function.
gcc/testsuite/
* gcc.dg/sso-14.c: New test.

4 years agoarc: Update doloop_end patterns
Claudiu Zissulescu [Wed, 9 Jun 2021 09:12:57 +0000 (12:12 +0300)] 
arc: Update doloop_end patterns

ARC processor can use LP instruction to implement zero overlay loops.
The current inplementation doesn't handle the unlikely situation when
the loop iterator is located in memory.  Refurbish the loop_end insn
pattern into a define_insn_and_split pattern.

gcc/
2021-07-09  Claudiu Zissulescu  <claziss@synopsys.com>

* config/arc/arc.md (loop_end): Change it to
define_insn_and_split.

Signed-off-by: Claudiu Zissulescu <claziss@synopsys.com>
(cherry picked from commit 174e75a210753b68de0f2c398a13ace0f512e35b)

4 years agoarc: Fix (u)maddhisi patterns
Claudiu Zissulescu [Wed, 9 Jun 2021 09:12:57 +0000 (12:12 +0300)] 
arc: Fix (u)maddhisi patterns

Rework the (u)maddhisi4 patterns and use VMAC2H(U) instruction instead
of the 64bit MAC(U) instruction.
This fixes the next execute.exp failures:
     arith-rand-ll.c   -O2  execution test
     arith-rand-ll.c   -O3  execution test
     pr78726.c   -O2  execution test
     pr78726.c   -O3  execution test

gcc/
2021-06-09  Claudiu Zissulescu  <claziss@synopsys.com>

* config/arc/arc.md (maddhisi4): Use VMAC2H instruction.
(machi): New pattern.
(umaddhisi4): Use VMAC2HU instruction.
(umachi): New pattern.

Signed-off-by: Claudiu Zissulescu <claziss@synopsys.com>
(cherry picked from commit dd4778a59b4693777c732075021375e19eee6a76)

4 years agoarc: Update 64bit move split patterns.
Claudiu Zissulescu [Wed, 9 Jun 2021 09:12:57 +0000 (12:12 +0300)] 
arc: Update 64bit move split patterns.

ARCv2HS can use a limited number of instructions to implement 64bit
moves. The VADD2 is used as a 64bit move, the LDD/STD are 64 bit loads
and stores. All those instructions are not baseline, hence we need to
provide alternatives when they are not available or cannot be generate
due to instruction restriction.

This patch is cleaning up those move patterns, and updates splits
instruction lengths.

This is a backport from mainline gcc.

gcc/
2021-06-09  Claudiu Zissulescu  <claziss@synopsys.com>

* config/arc/arc-protos.h (arc_split_move_p): New prototype.
* config/arc/arc.c (arc_split_move_p): New function.
(arc_split_move): Clean up.
* config/arc/arc.md (movdi_insn): Clean up, use arc_split_move_p.
(movdf_insn): Likewise.
* config/arc/simdext.md (mov<VWH>_insn): Likewise.

Signed-off-by: Claudiu Zissulescu <claziss@synopsys.com>
(cherry picked from commit c0ba7a8af5366c37241f20e8be41e362f7260389)

4 years agoDaily bump.
GCC Administrator [Wed, 9 Jun 2021 00:18:08 +0000 (00:18 +0000)] 
Daily bump.

4 years agolibstdc++: Fix Wrong param type in :atomic_ref<_Tp*>::wait [PR100889]
Thomas Rodgers [Tue, 8 Jun 2021 22:51:53 +0000 (15:51 -0700)] 
libstdc++: Fix Wrong param type in :atomic_ref<_Tp*>::wait [PR100889]

libstdc++-v3/ChangeLog:

PR libstdc++/100889
* include/bits/atomic_base.h (atomic_ref<_Tp*>::wait):
Change parameter type from _Tp to _Tp*.
* testsuite/29_atomics/atomic_ref/wait_notify.cc: Extend
coverage of types tested.

(cherry picked from commit 25e5ecdf82b49977e86bfaded236fb34af2705ed)

4 years ago[libstdc++] Remove unused hasher instance.
Thomas Rodgers [Tue, 8 Jun 2021 22:41:31 +0000 (15:41 -0700)] 
[libstdc++] Remove unused hasher instance.

This is a remnant of poorly executed refactoring.

libstdc++-v3/ChangeLog:

* include/std/barrier (__tree_barrier::_M_arrive): Remove
unnecessary hasher instantiation.

(cherry picked from commit 16a8e18858abdc877b14caf33dec24aada1a3308)

4 years agoc++: braced-list overload resolution [PR100963]
Jason Merrill [Tue, 8 Jun 2021 13:19:58 +0000 (09:19 -0400)] 
c++: braced-list overload resolution [PR100963]

My PR969626 patch made us ignore template candidates when there's a perfect
non-template candidate.  In this case, we were considering B(int) a perfect
match for B({0}), but the brace elision makes it imperfect.

PR c++/100963

gcc/cp/ChangeLog:

* call.c (perfect_conversion_p): Check check_narrowing.

gcc/testsuite/ChangeLog:

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

4 years ago Backported from master:
Pat Haugen [Tue, 8 Jun 2021 17:01:17 +0000 (12:01 -0500)] 
Backported from master:

2021-06-02  Pat Haugen  <pthaugen@linux.ibm.com>

* config/rs6000/rs6000-logue.c (rs6000_emit_prologue): Use
gen_frame_store.

4 years agoc++: alias with same name as base fn [PR91706]
Jason Merrill [Fri, 16 Apr 2021 15:13:40 +0000 (11:13 -0400)] 
c++: alias with same name as base fn [PR91706]

This is a bit complex.  Looking up c<T> in the definition of D::c finds
C::c, OK.  Looking up c in the definition of E finds D::c, OK.  Since the
alias is not dependent, we strip it from the template argument, leaving

using E = A<decltype(c<T>())>;

where 'c' still refers to C::c.  But instantiating E looks up 'c' again and
finds D::c, which isn't a function, and sadness ensues.

I think the bug here is looking up 'c' in D at instantiation time; the
declaration we found before is not dependent.  This seems to happen because
baselink_for_fns gets BASELINK_BINFO wrong; it is supposed to be the base
where lookup found the functions, C in this case.

gcc/cp/ChangeLog:

PR c++/91706
* semantics.c (baselink_for_fns): Fix BASELINK_BINFO.

gcc/testsuite/ChangeLog:

PR c++/91706
* g++.dg/template/lookup17.C: New test.

4 years agoc++: fix modules binfo merging
Jason Merrill [Mon, 7 Jun 2021 21:51:24 +0000 (17:51 -0400)] 
c++: fix modules binfo merging

My coming fix for PR91706 caused some regressions in the modules testsuite.
This turned out to be because the change to properly use the base subobject
BINFO as BASELINK_BINFO hit problems with the code for merging binfos.  The
tree reader needed a typo fix.  The duplicate_hash function was crashing on
the BINFO for a variadic base in <variant>.  I started fixing the hash
function, but then noticed that there's no ::equal function defined;
duplicate_hash just uses pointer equality, so we might as well also
use the normal pointer hash for the moment.

gcc/cp/ChangeLog:

* module.cc (duplicate_hash::hash): Comment out.
(trees_in::tree_value): Adjust loop counter.

4 years agoDaily bump.
GCC Administrator [Tue, 8 Jun 2021 00:18:24 +0000 (00:18 +0000)] 
Daily bump.

4 years agoc++: using-enum and access specifiers [PR100862]
Patrick Palka [Thu, 3 Jun 2021 13:37:11 +0000 (09:37 -0400)] 
c++: using-enum and access specifiers [PR100862]

When copying the enumerators imported by a class-scope using-enum
declaration, we need to override current_access_specifier so that
finish_member_declaration gives the copies the same access as the
using-enum decl.  (A class-scope using-enum is processed late, so
current_access_specifier at this point is otherwise set to the last
access specifier within the class.)  To that end, this patch makes
handle_using_decl call set_current_access_from_decl accordingly.

For consistency, this patch makes build_enumerator use
set_current_access_from_decl too.

PR c++/100862

gcc/cp/ChangeLog:

* pt.c (set_current_access_from_decl): Move to ...
* class.c (set_current_access_from_decl): ... here.
(handle_using_decl): Use it to propagate the access of the
using-enum decl to the copy of the imported enumerator.
* cp-tree.h (set_current_access_from_decl): Declare.
* decl.c (build_enumerator): Simplify using make_temp_override
and set_current_access_from_decl.

gcc/testsuite/ChangeLog:

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

(cherry picked from commit 69f517ac20566a645ff41a9bfca535822205a538)

4 years agoc++: tsubst_function_decl and excess arg levels [PR100102]
Patrick Palka [Fri, 4 Jun 2021 17:46:53 +0000 (13:46 -0400)] 
c++: tsubst_function_decl and excess arg levels [PR100102]

Here, when instantiating the dependent alias template
duration::__is_harmonic with args={{T,U},{int}}, we find ourselves
substituting the function decl _S_gcd.  Since we have more arg levels
than _S_gcd has parm levels, an old special case in tsubst_function_decl
causes us to unwantedly reduce args to its innermost level, yielding
args={int}, which leads to a nonsensical substitution into the decl
context and eventually a crash.

The comment for this special case refers to three examples for which we
ought to see more arg levels than parm levels here, but none of the
examples actually demonstrate this.  In the first example, when
defining S<int>::f(U) parms_depth is 2 and args_depth is 1, and
later when instantiating say S<int>::f<char> both depths are 2.  In the
second example, when substituting the template friend declaration
parms_depth is 2 and args_depth is 1, and later when instantiating f
both depths are 1.  Finally, the third example is invalid since we can't
specialize a member template of an unspecialized class template like
that.

Given that this reduction code seems no longer relevant for its
documented purpose and that it causes problems as in the PR, this patch
just removes it.  Note that as far as bootstrap/regtest is concerned,
this code is dead; the below two tests would be the first to reach it.

PR c++/100102

gcc/cp/ChangeLog:

* pt.c (tsubst_function_decl): Remove old code for reducing
args when it has excess levels.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/alias-decl-72.C: New test.
* g++.dg/cpp0x/alias-decl-72a.C: New test.

(cherry picked from commit 5357ab75dedef403b0eebf9277d61d1cbeb5898f)

4 years agolibstdc++: add missing typename for dependent type in ranges::elements_view [PR100900]
Avi Kivity [Mon, 7 Jun 2021 15:19:05 +0000 (11:19 -0400)] 
libstdc++: add missing typename for dependent type in ranges::elements_view [PR100900]

Clang complains about the missing typename. I believe it's not required
in a more complete implementation of C++, but it's nicer to support
less complete implementations.

PR libstdc++/100900

libstdc++-v3/ChangeLog:

* include/std/ranges (elements_view::__iter_cat::_S_iter_cat):
Add missing typename.

(cherry picked from commit 5e2e15f212e2458a1258b8c856895c755460bc6b)

4 years agox86: Update g++.target/i386/pr100885.C
H.J. Lu [Mon, 7 Jun 2021 14:29:31 +0000 (07:29 -0700)] 
x86: Update g++.target/i386/pr100885.C

Since long is 32 bits for x32, update g++.target/i386/pr100885.C to cast
__m64 to long long for x32.

PR target/100885
* g++.target/i386/pr100885.C (_mm_set_epi64): Cast __m64 to long
long.

(cherry picked from commit 52730540e83c81ee595a51feb7736ff753c98139)

4 years agoFix ICE of insn does not satisfy its constraints.
liuhongt [Thu, 3 Jun 2021 08:38:32 +0000 (16:38 +0800)] 
Fix ICE of insn does not satisfy its constraints.

evex encoding vpmovzxbx needs both AVX512BW and AVX512VL which means
constraint "Yw" should be used instead of constraint "v".

gcc/ChangeLog:

PR target/100885
* config/i386/sse.md (*sse4_1_zero_extendv8qiv8hi2_3): Refine
constraints.
(<insn>v4siv4di2): Delete constraints for define_expand.

gcc/testsuite/ChangeLog:

PR target/100885
* g++.target/i386/pr100885.C: New test.

4 years agoDaily bump.
GCC Administrator [Mon, 7 Jun 2021 00:17:57 +0000 (00:17 +0000)] 
Daily bump.

4 years agoPR fortran/98301 - random_init() is broken
Andre Vehreschild [Sun, 6 Jun 2021 10:06:31 +0000 (12:06 +0200)] 
PR fortran/98301 - random_init() is broken

Correct implementation of random_init() when -fcoarray=lib is given.
Backport from mainline.

2021-06-06  Andre Vehreschild  <vehre@gcc.gnu.org>
    Steve Kargl  <kargl@gcc.gnu.org>

gcc/fortran/ChangeLog:

PR fortran/98301
* trans-decl.c (gfc_build_builtin_function_decls): Move decl.
* trans-intrinsic.c (conv_intrinsic_random_init): Use bool for
lib-call of caf_random_init instead of logical (4-byte).
* trans.h: Add tree var for random_init.

libgfortran/ChangeLog:

PR fortran/98301
* caf/libcaf.h (_gfortran_caf_random_init): New function.
* caf/single.c (_gfortran_caf_random_init): New function.
* gfortran.map: Added fndecl.
* intrinsics/random_init.f90: Implement random_init.

4 years agoDaily bump.
GCC Administrator [Sun, 6 Jun 2021 00:18:08 +0000 (00:18 +0000)] 
Daily bump.

4 years agoDaily bump.
GCC Administrator [Sat, 5 Jun 2021 00:18:07 +0000 (00:18 +0000)] 
Daily bump.

4 years agod: Fix ICE in gimplify_var_or_parm_decl, at gimplify.c:2755 (PR100882)
Iain Buclaw [Fri, 4 Jun 2021 17:38:26 +0000 (19:38 +0200)] 
d: Fix ICE in gimplify_var_or_parm_decl, at gimplify.c:2755 (PR100882)

Constructor calls for temporaries were reusing the TARGET_EXPR_SLOT of a
TARGET_EXPR for an assignment, which later got passed to `build_assign',
which stripped away the outer TARGET_EXPR, leaving a reference to a lone
temporary with no declaration.

This stripping away of the TARGET_EXPR also discarded any cleanups that
may have been assigned to the expression as well.

So now the reuse of TARGET_EXPR_SLOT has been removed, and
`build_assign' now constructs assignments inside the TARGET_EXPR_INITIAL
slot.  This has also been extended to `return_expr', to deal with
possibility of a TARGET_EXPR being returned.

gcc/d/ChangeLog:

PR d/100882
* d-codegen.cc (build_assign): Construct initializations inside
TARGET_EXPR_INITIAL.
(compound_expr): Remove intermediate expressions that have no
side-effects.
(return_expr): Construct returns inside TARGET_EXPR_INITIAL.
* expr.cc (ExprVisitor::visit (CallExp *)): Remove useless assignment
to TARGET_EXPR_SLOT.

gcc/testsuite/ChangeLog:

PR d/100882
* gdc.dg/pr100882a.d: New test.
* gdc.dg/pr100882b.d: New test.
* gdc.dg/pr100882c.d: New test.
* gdc.dg/torture/pr100882.d: New test.

(cherry picked from commit e8761d4c21b5f4cc1c5612be9bf952a07c8a2238)

4 years agoFortran - ICE in inline_matmul_assign
Harald Anlauf [Fri, 4 Jun 2021 17:23:48 +0000 (19:23 +0200)] 
Fortran - ICE in inline_matmul_assign

Restrict inlining of matmul to those cases where assignment to the
result array does not need special treatment.

gcc/fortran/ChangeLog:

PR fortran/99839
* frontend-passes.c (inline_matmul_assign): Do not inline matmul
if the assignment to the resulting array if it is not of canonical
type (real/integer/complex/logical).

gcc/testsuite/ChangeLog:

PR fortran/99839
* gfortran.dg/inline_matmul_25.f90: New test.

(cherry picked from commit bee8619ad0ac3bd27b7c8dc5819b83a5e8e147a0)

4 years agoDaily bump.
GCC Administrator [Fri, 4 Jun 2021 00:18:13 +0000 (00:18 +0000)] 
Daily bump.

4 years agoFix miscompilation of predicate on bit-packed array types
Eric Botcazou [Thu, 3 Jun 2021 11:29:32 +0000 (13:29 +0200)] 
Fix miscompilation of predicate on bit-packed array types

This is a regression present on the mainline and 11 branch in the form of a
miscompilation by the new mod/ref IPA pass of code that passes constrained
bit-packed array objets in a call to a subprograms taking unconstrained
bit-packed array parameters, which occurs for predicate on bit-packed array
types for example.

gcc/ada/
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Array_Type>: Add PAT
local constant and use it throughout.  If it is set, use a ref-all
pointer type for the pointer-to-array field of the fat pointer type.
<E_Array_Subtype>: Add PAT local constant and use it throughout.
gcc/testsuite/
* gnat.dg/bit_packed_array6.adb: New test.
* gnat.dg/bit_packed_array6_pkg.ads: New helper.

4 years agoTame fix for PR ipa/99122
Eric Botcazou [Thu, 3 Jun 2021 10:39:39 +0000 (12:39 +0200)] 
Tame fix for PR ipa/99122

The return part has a major performance impact in Ada where variable-sized
types are first-class citizens, but it turns out that it is not exercized
in the testsuite yet, so back it out for now.

gcc/
PR ipa/99122
* tree-inline.c (inline_forbidden_p): Remove test on return type.
gcc/testsuite/
* gnat.dg/inline22.adb: New test.

4 years agoRemove call to gcc_unreachable in range-op.cc
Eric Botcazou [Mon, 10 May 2021 15:41:01 +0000 (17:41 +0200)] 
Remove call to gcc_unreachable in range-op.cc

The Ada testcase happens to stumble on the call to gcc_unreachable in
operator_bitwise_xor::op1_range, but there is nothing wrong going on
and it's safe to let it go through.

gcc/
* range-op.cc (get_bool_state): Adjust head comment.
(operator_not_equal::op1_range): Fix comment.
(operator_bitwise_xor::op1_range): Remove call to gcc_unreachable.
gcc/testsuite/
* gnat.dg/specs/opt5.ads: New test.
* gnat.dg/specs/opt5_pkg.ads: New helper.

4 years agoarm: Fix ICE with CMSE nonsecure calls on Armv8.1-M [PR100333]
Alex Coplan [Wed, 19 May 2021 14:52:45 +0000 (15:52 +0100)] 
arm: Fix ICE with CMSE nonsecure calls on Armv8.1-M [PR100333]

As the PR shows, we ICE shortly after expanding nonsecure calls for Armv8.1-M.
For Armv8.1-M, we have TARGET_HAVE_FPCXT_CMSE. As it stands, the expander
(arm.md:nonsecure_call_internal) moves the callee's address to a register (with
copy_to_suggested_reg) only if !TARGET_HAVE_FPCXT_CMSE.

However, looking at the pattern which the insn appears to be intended to
match (thumb2.md:*nonsecure_call_reg_thumb2_fpcxt), it requires the
callee's address to be in a register.

This patch therefore just forces the callee's address into a register in
the expander.

gcc/ChangeLog:

PR target/100333
* config/arm/arm.md (nonsecure_call_internal): Always ensure
callee's address is in a register.

gcc/testsuite/ChangeLog:

PR target/100333
* gcc.target/arm/cmse/pr100333.c: New test.

(cherry picked from commit 5b953740da1976d90d974055c6d825c509c6e654)

4 years agoARC: gcc driver default to hs38_linux
Claudiu Zissulescu [Wed, 2 Jun 2021 11:31:00 +0000 (14:31 +0300)] 
ARC: gcc driver default to hs38_linux

arc700 is legacy and there's no active development for it, so switch to
latest hs38_linux as default

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Claudiu Zissulescu <claziss@synopsys.com>
gcc/
2021-06-02  Vineet Gupta  <vgupta@synopsys.com>

* config/arc/arc.h (TARGET_CPU_DEFAULT): Change to hs38_linux.

(cherry picked from commit 46d04271a4983b5430ed4830ab65ea26052176fb)

4 years agoDaily bump.
GCC Administrator [Thu, 3 Jun 2021 00:18:04 +0000 (00:18 +0000)] 
Daily bump.

4 years agolibstdc++: Use __builtin_unreachable for constexpr assertions [PR 100676]
Jonathan Wakely [Thu, 20 May 2021 15:39:06 +0000 (16:39 +0100)] 
libstdc++: Use __builtin_unreachable for constexpr assertions [PR 100676]

The current implementation of compile-time precondition checks causes
compilation to fail by calling a non-constexpr function declared at
block scope. This breaks the CUDA compiler, which wraps some libstdc++
headers in a pragma that declares everything as a __host__ __device__
function, but others are not wrapped and so everything is a __host__
function. The local declaration thus gets redeclared as two different
types of function, which doesn't work.

Just use __builtin_unreachable to make constant evaluation fail, instead
of the local function declaration. Also simplify the assertion macros,
which has the side effect of giving simpler compilation errors when
using Clang.

libstdc++-v3/ChangeLog:

PR libstdc++/100676
* include/bits/c++config (__glibcxx_assert_1): Rename to ...
(__glibcxx_constexpr_assert): ... this.
(__glibcxx_assert_impl): Use __glibcxx_constexpr_assert.
(__glibcxx_assert): Define as either __glibcxx_constexpr_assert
or __glibcxx_assert_impl.
(__glibcxx_assert_2): Remove
* include/debug/macros.h (_GLIBCXX_DEBUG_VERIFY_AT_F): Use
__glibcxx_constexpr_assert instead of __glibcxx_assert_1.
* testsuite/21_strings/basic_string_view/element_access/char/back_constexpr_neg.cc:
Adjust expected error.
* testsuite/21_strings/basic_string_view/element_access/char/constexpr_neg.cc:
Likewise.
* testsuite/21_strings/basic_string_view/element_access/char/front_constexpr_neg.cc:
Likewise.
Likewise.
* testsuite/21_strings/basic_string_view/element_access/wchar_t/back_constexpr_neg.cc:
Likewise.
* testsuite/21_strings/basic_string_view/element_access/wchar_t/constexpr_neg.cc:
Likewise.
* testsuite/21_strings/basic_string_view/element_access/wchar_t/front_constexpr_neg.cc:
Likewise.
* testsuite/23_containers/span/back_neg.cc: Likewise.
* testsuite/23_containers/span/front_neg.cc: Likewise.
* testsuite/23_containers/span/index_op_neg.cc: Likewise.

(cherry picked from commit 6b42b5a8a207de5e021a2916281f46bcd60b20d2)

4 years agolibstdc++: Fix return value of std::ranges::advance [PR 100833]
Jonathan Wakely [Tue, 1 Jun 2021 15:02:45 +0000 (16:02 +0100)] 
libstdc++: Fix return value of std::ranges::advance [PR 100833]

The three-argument form of ranges::advance is supposed to return the
difference between the second argument and the distance the iterator was
advanced. When a non-random-access iterator is not advanced (because it
already equals the sentinel) we were returning 0 rather than n - 0.

libstdc++-v3/ChangeLog:

PR libstdc++/100833
* include/bits/ranges_base.h (ranges::advance(iter, n, sentinel)):
Fix return value for no-op case.
* testsuite/24_iterators/range_operations/advance.cc: Test
return values of three-argument overload.

(cherry picked from commit d8326291695c0f13124c232ddf4fd34e3310e649)

4 years agolibstdc++: Change [range.iter.op] functions to function objects [PR 100768]
Jonathan Wakely [Wed, 26 May 2021 16:32:53 +0000 (17:32 +0100)] 
libstdc++: Change [range.iter.op] functions to function objects [PR 100768]

The standard specifies std::ranges::distance etc as function templates,
but it also requires them to not be found by ADL, and to suppress ADL
when normal unqualified lookup does find them. That means they need to
be function objects.

libstdc++-v3/ChangeLog:

PR libstdc++/100768
* include/bits/ranges_base.h (advance, distance, next, prev):
Replace function templates with function objects.
* testsuite/24_iterators/headers/iterator/synopsis_c++20.cc:
Adjust for changes to function objects.
* testsuite/std/ranges/adaptors/elements.cc: Add using
declarations for names from namespace ranges.
* testsuite/std/ranges/adaptors/transform.cc: Likewise.
* testsuite/24_iterators/range_operations/100768.cc: New test.

(cherry picked from commit a49a045b92f982f5617c3bbde97a33157237e25b)

4 years agolibstdc++: Fix installation of python hooks [PR 99453]
Jonathan Wakely [Tue, 1 Jun 2021 10:00:16 +0000 (11:00 +0100)] 
libstdc++: Fix installation of python hooks [PR 99453]

When no shared library is installed, the new code to determine the name
of the -gdb.py file yields an empty string. Use the name of the static
library in that case.

libstdc++-v3/ChangeLog:

PR libstdc++/99453
* python/Makefile.am: Use archive name for printer hook if no
dynamic library name is available.
* python/Makefile.in: Regenerate.

(cherry picked from commit 9f7bc160b4a0f27dce248d1226e3ae7104b0e67b)

4 years agoi386: Change abs<MMXMODEI:mode>2 to an expander.
Uros Bizjak [Wed, 2 Jun 2021 08:22:08 +0000 (10:22 +0200)] 
i386: Change abs<MMXMODEI:mode>2 to an expander.

2021-06-02  Uroš Bizjak  <ubizjak@gmail.com>

* config/i386/sse.md (abs<MMXMODEI:mode>2):
Change define_insn to define_expand.

4 years agoi386: Fix <any_extend:insn>v4qiv4di2 expander
Uros Bizjak [Tue, 18 May 2021 13:56:22 +0000 (15:56 +0200)] 
i386: Fix <any_extend:insn>v4qiv4di2 expander

Fix a mode mismatch.

2021-05-18  Uroš Bizjak  <ubizjak@gmail.com>

gcc/
* config/i386/sse.md (<any_extend:insn>v4qiv4di2):
Fix a mode mismatch with operand 1.

(cherry picked from commit 8b9484c54b4000209d4bfb270e22c9c8b9673fdb)

4 years agoDaily bump.
GCC Administrator [Wed, 2 Jun 2021 00:18:15 +0000 (00:18 +0000)] 
Daily bump.

4 years agoPR100750: Require ELFv2 ABI for ROP test
Bill Schmidt [Tue, 1 Jun 2021 20:47:22 +0000 (15:47 -0500)] 
PR100750: Require ELFv2 ABI for ROP test

2021-06-01  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/testsuite/
PR testsuite/100750
* gcc.target/powerpc/rop-5.c: Require ELFv2 ABI.

4 years agoc++: no clobber for C++20 destroying delete [PR91859]
Jason Merrill [Fri, 28 May 2021 21:05:23 +0000 (17:05 -0400)] 
c++: no clobber for C++20 destroying delete [PR91859]

Before C++20 added destroying operator delete, by the time we called
operator delete for a pointer, the object would already be gone.  But that
isn't true for destroying delete.  Since the optimizers' assumptions about
operator delete are based on either DECL_IS_REPLACEABLE_OPERATOR (which
already is not set) or CALL_FROM_NEW_OR_DELETE_P, let's avoid setting the
latter flag in this case.

PR c++/91859

gcc/ChangeLog:

* tree.h (CALL_FROM_NEW_OR_DELETE_P): Adjust comment.

gcc/cp/ChangeLog:

* call.c (build_op_delete_call): Don't set CALL_FROM_NEW_OR_DELETE_P
for destroying delete.
* init.c (build_delete): Don't clobber before destroying delete.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/destroying-delete5.C: New test.

4 years agoc++: 'this' adjustment for devirtualized call
Jason Merrill [Fri, 28 May 2021 03:54:52 +0000 (23:54 -0400)] 
c++: 'this' adjustment for devirtualized call

My patch for 95719 made us do a better job of finding the actual virtual
function we want to call, but didn't update the 'this' pointer adjustment to
match.

PR c++/100797
PR c++/95719

gcc/cp/ChangeLog:

* call.c (build_over_call): Adjust base_binfo in
resolves_to_fixed_type_p case.

gcc/testsuite/ChangeLog:

* g++.dg/inherit/virtual15.C: New test.

4 years agoDaily bump.
GCC Administrator [Tue, 1 Jun 2021 00:18:21 +0000 (00:18 +0000)] 
Daily bump.

4 years agoc++: Avoid -Wunused-value false positives on nullptr passed to ellipsis [PR100666]
Jakub Jelinek [Tue, 25 May 2021 15:24:38 +0000 (17:24 +0200)] 
c++: Avoid -Wunused-value false positives on nullptr passed to ellipsis [PR100666]

When passing expressions with decltype(nullptr) type with side-effects to
ellipsis, we pass (void *)0 instead, but for the side-effects evaluate them
on the lhs of a COMPOUND_EXPR.  Unfortunately that means we warn about it
if the expression is a call to nodiscard marked function, even when the
result is really used, just needs to be transformed.

Fixed by adding a warning_sentinel.

2021-05-25  Jakub Jelinek  <jakub@redhat.com>

PR c++/100666
* call.c (convert_arg_to_ellipsis): For expressions with NULLPTR_TYPE
and side-effects, temporarily disable -Wunused-result warning when
building COMPOUND_EXPR.

* g++.dg/cpp1z/nodiscard8.C: New test.
* g++.dg/cpp1z/nodiscard9.C: New test.

(cherry picked from commit ad52d89808a947264397e920d7483090d4108f7b)

4 years agoc++tools: Include <cstdlib> for exit [PR100731]
Jakub Jelinek [Tue, 25 May 2021 14:44:35 +0000 (16:44 +0200)] 
c++tools: Include <cstdlib> for exit [PR100731]

This TU uses exit, but doesn't include <stdlib.h> or <cstdlib> and relies
on some other header to include it indirectly, which apparently doesn't
happen on reporter's host.

The other <c*> headers aren't guarded either and we rely on a compiler
capable of C++11, so maybe we can rely on <cstdlib> being around
unconditionally.

2021-05-25  Jakub Jelinek  <jakub@redhat.com>

PR bootstrap/100731
* server.cc: Include <cstdlib>.

(cherry picked from commit 7a5e9a58fbe27d8b8f04cd18bc6e1dd736e3cd12)

4 years agolibcpp: Fix up -fdirectives-only handling of // comments on last line not terminated...
Jakub Jelinek [Thu, 20 May 2021 07:09:07 +0000 (09:09 +0200)] 
libcpp: Fix up -fdirectives-only handling of // comments on last line not terminated with newline [PR100646]

As can be seen on the testcases, before the -fdirectives-only preprocessing
rewrite the preprocessor would assume // comments are terminated by the
end of file even when newline wasn't there, but now we error out.
The following patch restores the previous behavior.

2021-05-20  Jakub Jelinek  <jakub@redhat.com>

PR preprocessor/100646
* lex.c (cpp_directive_only_process): Treat end of file as termination
for !is_block comments.

* gcc.dg/cpp/pr100646-1.c: New test.
* gcc.dg/cpp/pr100646-2.c: New test.

(cherry picked from commit d15a2d261b24adcbfe5e663b15dde3df5d2b3486)

4 years agobuiltins: Fix ICE with unprototyped builtin call [PR100576]
Jakub Jelinek [Wed, 19 May 2021 10:05:30 +0000 (12:05 +0200)] 
builtins: Fix ICE with unprototyped builtin call [PR100576]

For unprototyped builtins the checking we perform is only about whether
the used argument is integral, pointer etc., not the exact precision.
We emit a warning about the problem though:
pr100576.c: In function ‘foo’:
pr100576.c:9:11: warning: implicit declaration of function ‘memcmp’ [-Wimplicit-function-declaration]
    9 |   int n = memcmp (p, v, b);
      |           ^~~~~~
pr100576.c:1:1: note: include ‘<string.h>’ or provide a declaration of ‘memcmp’
  +++ |+#include <string.h>
    1 | /* PR middle-end/100576 */
pr100576.c:9:25: warning: ‘memcmp’ argument 3 type is ‘int’ where ‘long unsigned int’ is expected in a call to built-in function declared without prototype
+[-Wbuiltin-declaration-mismatch]
    9 |   int n = memcmp (p, v, b);
      |                         ^
It means in the testcase below where the user incorrectly called memcmp
with last argument int rather then size_t, the warning stuff in builtins.c
ICEs because it compares a wide_int from such a bound with another wide_int
which has precision of size_t/sizetype and wide_int asserts the compared
wide_ints are compatible.

Fixed by forcing the bound to have the right type.

2021-05-19  Jakub Jelinek  <jakub@redhat.com>

PR middle-end/100576
* builtins.c (check_read_access): Convert bound to size_type_node if
non-NULL.

* gcc.c-torture/compile/pr100576.c: New test.

(cherry picked from commit e6683450f4a26dae7774be735a3429f48aee9565)

4 years agoregcprop: Avoid DCE of asm goto [PR100590]
Jakub Jelinek [Tue, 18 May 2021 08:26:45 +0000 (10:26 +0200)] 
regcprop: Avoid DCE of asm goto [PR100590]

The following testcase ICEs, because copyprop_hardreg_forward_1 decides
to DCE asm goto with REG_UNUSED notes (because the output is unused and
asm isn't volatile).  But that DCE just removes the asm goto, leaving
a bb with two successors and no insn at the end that would allow that.

The following patch makes sure we drop that way only INSNs and not
JUMP_INSNs or CALL_INSNs.

2021-05-18  Jakub Jelinek  <jakub@redhat.com>

PR rtl-optimization/100590
* regcprop.c (copyprop_hardreg_forward_1): Only DCE dead sets if
they are NONJUMP_INSN_P.

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

(cherry picked from commit c81704b359283bb54696755ead881ab04136da94)

4 years agofunction: Set dummy DECL_ASSEMBLER_NAME in push_dummy_function [PR100580]
Jakub Jelinek [Tue, 18 May 2021 08:10:17 +0000 (10:10 +0200)] 
function: Set dummy DECL_ASSEMBLER_NAME in push_dummy_function [PR100580]

Last year I've added cgraph_node::get_create calls for the dummy
functions used for -fdump-passes, so that it interacts well with pass
disabling/enabling which is cgraph uid based.
Unfortunately, as the following testcase shows, when assembler hash
is present, that wants to compute DECL_ASSEMBLER_NAME and the C++ FE
is unprepared to handle it on the dummy functions which don't have
DECL_NAME etc.
The following patch fixes it by setting up a dummy DECL_ASSEMBLER_NAME
on these, so that the FEs don't need to compute it.

2021-05-18  Jakub Jelinek  <jakub@redhat.com>

PR c++/100580
* function.c (push_dummy_function): Set DECL_ARTIFICIAL and
DECL_ASSEMBLER_NAME on the fn_decl.

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

(cherry picked from commit 978b62e554ffb4b34844c72d259ce71fcbd87591)

4 years agoregcprop: Fix another cprop_hardreg bug [PR100342]
Jakub Jelinek [Sat, 15 May 2021 08:12:11 +0000 (10:12 +0200)] 
regcprop: Fix another cprop_hardreg bug [PR100342]

On Tue, Jan 19, 2021 at 04:10:33PM +0000, Richard Sandiford via Gcc-patches wrote:
> Ah, ok, thanks for the extra context.
>
> So AIUI the problem when recording xmm2<-di isn't just:
>
>  [A] partial_subreg_p (vd->e[sr].mode, GET_MODE (src))
>
> but also that:
>
>  [B] partial_subreg_p (vd->e[sr].mode, vd->e[vd->e[sr].oldest_regno].mode)
>
> For example, all registers in this sequence can be part of the same chain:
>
>     (set (reg:HI R1) (reg:HI R0))
>     (set (reg:SI R2) (reg:SI R1)) // [A]
>     (set (reg:DI R3) (reg:DI R2)) // [A]
>     (set (reg:SI R4) (reg:SI R[0-3]))
>     (set (reg:HI R5) (reg:HI R[0-4]))
>
> But:
>
>     (set (reg:SI R1) (reg:SI R0))
>     (set (reg:HI R2) (reg:HI R1))
>     (set (reg:SI R3) (reg:SI R2)) // [A] && [B]
>
> is problematic because it dips below the precision of the oldest regno
> and then increases again.
>
> When this happens, I guess we have two choices:
>
> (1) what the patch does: treat R3 as the start of a new chain.
> (2) pretend that the copy occured in vd->e[sr].mode instead
>     (i.e. copy vd->e[sr].mode to vd->e[dr].mode)
>
> I guess (2) would need to be subject to REG_CAN_CHANGE_MODE_P.
> Maybe the optimisation provided by (2) compared to (1) isn't common
> enough to be worth the complication.
>
> I think we should test [B] as well as [A] though.  The pass is set
> up to do some quite elaborate mode changes and I think rejecting
> [A] on its own would make some of the other code redundant.
> It also feels like it should be a seperate “if” or “else if”,
> with its own comment.

Unfortunately, we now have a testcase that shows that testing also [B]
is a problem (unfortunately now latent on the trunk, only reproduces
on 10 and 11 branches).

The comment in the patch tries to list just the interesting instructions,
we have a 64-bit value, copy low 8 bit of those to another register,
copy full 64 bits to another register and then clobber the original register.
Before that (set (reg:DI r14) (const_int ...)) we have a chain
DI r14, QI si, DI bp , that instruction drops the DI r14 from that chain, so
we have QI si, DI bp , si being the oldest_regno.
Next DI si is copied into DI dx.  Only the low 8 bits of that are defined,
the rest is unspecified, but we would add DI dx into that same chain at the
end, so QI si, DI bp, DI dx [*].  Next si is overwritten, so the chain is
DI bp, DI dx.  And then we see (set (reg:DI dx) (reg:DI bp)) and remove it
as redundant, because we think bp and dx are already equivalent, when in
reality that is true only for the lowpart 8 bits.
I believe the [*] marked step above is where the bug is.

The committed regcprop.c (copy_value) change (but only committed to
trunk/11, not to 10) added
  else if (partial_subreg_p (vd->e[sr].mode, GET_MODE (src))
           && partial_subreg_p (vd->e[sr].mode,
                                vd->e[vd->e[sr].oldest_regno].mode))
    return;
and while the first partial_subreg_p call returns true, the second one
doesn't; before the (set (reg:DI r14) (const_int ...)) insn it would be
true and we'd return, but as that reg got clobbered, si became the oldest
regno in the chain and so vd->e[vd->e[sr].oldest_regno].mode is QImode
and vd->e[sr].mode is QImode too, so the second partial_subreg_p is false.
But as the testcase shows, what is the oldest_regno in the chain is
something that changes over time, so relying on it for anything is
problematic, something could have a different oldest_regno and later
on get a different oldest_regno (perhaps with different mode) because
the oldest_regno got overwritten and it can change both ways.

The following patch effectively implements your (2) above.

2021-05-15  Jakub Jelinek  <jakub@redhat.com>

PR rtl-optimization/100342
* regcprop.c (copy_value): When copying a source reg in a wider
mode than it has recorded for the value, adjust recorded destination
mode too or punt if !REG_CAN_CHANGE_MODE_P.

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

(cherry picked from commit 425ad87dcfacbb326d8f448a0f2b4d6b53dcd98f)

4 years agoDaily bump.
GCC Administrator [Mon, 31 May 2021 00:18:12 +0000 (00:18 +0000)] 
Daily bump.

4 years agoDaily bump.
GCC Administrator [Sun, 30 May 2021 00:18:06 +0000 (00:18 +0000)] 
Daily bump.

4 years agoDaily bump.
GCC Administrator [Sat, 29 May 2021 00:18:08 +0000 (00:18 +0000)] 
Daily bump.

4 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.

(cherry picked from commit fb6b24c66ea5a2ccbf6fb9f299c20a69f962ac9b)