diff --git a/gcc.spec b/gcc.spec index 28f89b2..86f8247 100644 --- a/gcc.spec +++ b/gcc.spec @@ -1,5 +1,5 @@ -%global DATE 20210116 -%global gitrev d42629234e8a859ed1be99bf5e06bce1a4e3fb0c +%global DATE 20210119 +%global gitrev 4b9bffe2c626b87d403f11674a5bd63c6078c777 %global gcc_version 11.0.0 %global gcc_major 11 # Note, gcc_release must be integer, if you want to add suffixes to @@ -119,7 +119,7 @@ Summary: Various compilers (C, C++, Objective-C, ...) Name: gcc Version: %{gcc_version} -Release: %{gcc_release}.14%{?dist} +Release: %{gcc_release}.15%{?dist} # libgcc, libgfortran, libgomp, libstdc++ and crtstuff have # GCC Runtime Exception. License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+ and BSD @@ -272,6 +272,10 @@ Patch9: gcc11-Wno-format-security.patch Patch10: gcc11-rh1574936.patch Patch11: gcc11-d-shared-libphobos.patch Patch12: gcc11-pr98338-workaround.patch +Patch13: gcc11-pr98672.patch +Patch14: gcc11-pr98687.patch +Patch15: gcc11-pr98721.patch +Patch16: gcc11-pr98742.patch # On ARM EABI systems, we do want -gnueabi to be part of the # target triple. @@ -783,6 +787,12 @@ to NVidia PTX capable devices if available. %endif %patch11 -p0 -b .d-shared-libphobos~ %patch12 -p0 -b .pr98338-workaround~ +%patch13 -p0 -b .pr98672~ +%patch14 -p0 -b .pr98687~ +%patch15 -p0 -b .pr98721~ +%patch16 -p0 -b .pr98742~ + +rm -f libgomp/testsuite/*/*task-detach* echo 'Red Hat %{version}-%{gcc_release}' > gcc/DEV-PHASE @@ -3067,6 +3077,16 @@ end %endif %changelog +* Tue Jan 19 2021 Jakub Jelinek 11.0.0-0.15 +- update from trunk + - PRs debug/98708, debug/98716, ipa/98222, libstdc++/98725, target/97847, + testsuite/97299, testsuite/97494, testsuite/97987, + tree-optimization/96271 + - fix miscompilation of portable signed multiplication overflow check + (#1916576, PR tree-optimization/98727) + - switch to DWARF 5 by default +- fix PRs c++/98672, c++/98687, c++/98742, tree-optimization/98721 + * Sat Jan 16 2021 Jakub Jelinek 11.0.0-0.14 - update from trunk - PRs ada/98595, analyzer/98679, bootstrap/98696, c++/63707, c++/98231, diff --git a/gcc11-pr98672.patch b/gcc11-pr98672.patch new file mode 100644 index 0000000..b7ac680 --- /dev/null +++ b/gcc11-pr98672.patch @@ -0,0 +1,87 @@ +2021-01-15 Jakub Jelinek + + PR c++/98672 + * constexpr.c (potential_constant_expression_1) , + : If the condition isn't constant true, check if + the loop body can contain a return stmt. + + * g++.dg/cpp1y/constexpr-98672.C: New test. + +--- gcc/cp/constexpr.c.jj 2021-01-13 19:19:44.368469462 +0100 ++++ gcc/cp/constexpr.c 2021-01-14 12:02:27.347042704 +0100 +@@ -8190,7 +8190,17 @@ potential_constant_expression_1 (tree t, + /* If we couldn't evaluate the condition, it might not ever be + true. */ + if (!integer_onep (tmp)) +- return true; ++ { ++ /* Before returning true, check if the for body can contain ++ a return. */ ++ hash_set pset; ++ check_for_return_continue_data data = { &pset, NULL_TREE }; ++ if (tree ret_expr ++ = cp_walk_tree (&FOR_BODY (t), check_for_return_continue, ++ &data, &pset)) ++ *jump_target = ret_expr; ++ return true; ++ } + } + if (!RECUR (FOR_EXPR (t), any)) + return false; +@@ -8219,7 +8229,17 @@ potential_constant_expression_1 (tree t, + tmp = cxx_eval_outermost_constant_expr (tmp, true); + /* If we couldn't evaluate the condition, it might not ever be true. */ + if (!integer_onep (tmp)) +- return true; ++ { ++ /* Before returning true, check if the while body can contain ++ a return. */ ++ hash_set pset; ++ check_for_return_continue_data data = { &pset, NULL_TREE }; ++ if (tree ret_expr ++ = cp_walk_tree (&WHILE_BODY (t), check_for_return_continue, ++ &data, &pset)) ++ *jump_target = ret_expr; ++ return true; ++ } + if (!RECUR (WHILE_BODY (t), any)) + return false; + if (breaks (jump_target) || continues (jump_target)) +--- gcc/testsuite/g++.dg/cpp1y/constexpr-98672.C.jj 2021-01-14 12:19:24.842438847 +0100 ++++ gcc/testsuite/g++.dg/cpp1y/constexpr-98672.C 2021-01-14 12:07:33.935551155 +0100 +@@ -0,0 +1,35 @@ ++// PR c++/98672 ++// { dg-do compile { target c++14 } } ++ ++void ++foo () ++{ ++} ++ ++constexpr int ++bar () ++{ ++ for (int i = 0; i < 5; ++i) ++ return i; ++ foo (); ++ return 0; ++} ++ ++constexpr int ++baz () ++{ ++ int i = 0; ++ while (i < 5) ++ { ++ if (i == 3) ++ return i; ++ else ++ ++i; ++ } ++ foo (); ++ return 0; ++} ++ ++constexpr int i = bar (); ++constexpr int j = baz (); ++static_assert (i == 0 && j == 3, ""); diff --git a/gcc11-pr98687.patch b/gcc11-pr98687.patch new file mode 100644 index 0000000..d2e1ce0 --- /dev/null +++ b/gcc11-pr98687.patch @@ -0,0 +1,130 @@ +My recent patch that introduced push_using_decl_bindings didn't +handle USING_DECL redeclaration, therefore things broke. This +patch amends that. Note that I don't know if the other parts of +finish_nonmember_using_decl are needed (e.g. the binding->type +setting) -- I couldn't trigger it by any of my hand-made testcases. + +Sorry for not thinking harder about redeclarations in the original +patch :(. + +2021-01-15 Marek Polacek + + PR c++/98687 + * name-lookup.c (push_using_decl_bindings): If we found an + existing local binding, update it if it's not identical. + + * g++.dg/lookup/using64.C: New test. + * g++.dg/lookup/using65.C: New test. + +--- gcc/cp/name-lookup.c ++++ gcc/cp/name-lookup.c +@@ -9285,8 +9285,24 @@ push_operator_bindings () + void + push_using_decl_bindings (tree decl) + { +- push_local_binding (DECL_NAME (decl), USING_DECL_DECLS (decl), +- /*using*/true); ++ tree name = DECL_NAME (decl); ++ tree value = USING_DECL_DECLS (decl); ++ ++ cxx_binding *binding = find_local_binding (current_binding_level, name); ++ if (binding) ++ { ++ if (value == binding->value) ++ /* Redeclaration of this USING_DECL. */; ++ else if (binding->value && TREE_CODE (value) == OVERLOAD) ++ { ++ /* We already have this binding, so replace it. */ ++ update_local_overload (IDENTIFIER_BINDING (name), value); ++ IDENTIFIER_BINDING (name)->value = value; ++ } ++ } ++ else ++ /* Install the new binding. */ ++ push_local_binding (DECL_NAME (decl), value, /*using*/true); + } + + #include "gt-cp-name-lookup.h" +--- gcc/testsuite/g++.dg/lookup/using64.C ++++ gcc/testsuite/g++.dg/lookup/using64.C +@@ -0,0 +1,60 @@ ++// PR c++/98687 ++// { dg-do compile } ++ ++struct S { }; ++ ++namespace N { ++ template ++ bool operator==(T, int); ++ ++ template ++ void X(T); ++} ++ ++namespace M { ++ template ++ bool operator==(T, double); ++} ++ ++template ++bool fn1 (T t) ++{ ++ using N::operator==; ++ return t == 1; ++} ++ ++template ++bool fn2 (T t) ++{ ++ // Redeclaration. ++ using N::operator==; ++ using N::operator==; ++ return t == 1; ++} ++ ++template ++bool fn3 (T t) ++{ ++ // Need update_local_overload. ++ using N::operator==; ++ using M::operator==; ++ return t == 1; ++} ++ ++template ++void fn4 (T t) ++{ ++ struct X { }; ++ using N::X; ++ X(1); ++} ++ ++void ++g () ++{ ++ S s; ++ fn1 (s); ++ fn2 (s); ++ fn3 (s); ++ fn4 (s); ++} +--- gcc/testsuite/g++.dg/lookup/using65.C ++++ gcc/testsuite/g++.dg/lookup/using65.C +@@ -0,0 +1,17 @@ ++// PR c++/98687 ++// { dg-do compile } ++ ++extern "C" namespace std { ++ double log1p(double); ++} ++namespace std_fallback { ++ template void log1p(); ++} ++template struct log1p_impl { ++ static int run() { ++ using std::log1p; ++ using std_fallback::log1p; ++ return 0; ++ } ++}; ++void log1p() { log1p_impl::run(); } diff --git a/gcc11-pr98721.patch b/gcc11-pr98721.patch new file mode 100644 index 0000000..6459a9c --- /dev/null +++ b/gcc11-pr98721.patch @@ -0,0 +1,91 @@ +2021-01-19 Jakub Jelinek + + PR tree-optimization/98721 + * builtins.c (access_ref::inform_access): Don't assume + SSA_NAME_IDENTIFIER must be non-NULL. Print messages about + object whenever allocfn is NULL, rather than only when DECL_P + is true. Use %qE instead of %qD for that. Formatting fixes. + + * gcc.dg/pr98721-1.c: New test. + * gcc.dg/pr98721-2.c: New test. + +--- gcc/builtins.c.jj 2021-01-18 19:07:16.022895507 +0100 ++++ gcc/builtins.c 2021-01-19 11:56:52.247070923 +0100 +@@ -4414,8 +4414,8 @@ access_ref::inform_access (access_mode m + MAXREF on which the result is based. */ + const offset_int orng[] = + { +- offrng[0] - maxref.offrng[0], +- wi::smax (offrng[1] - maxref.offrng[1], offrng[0]), ++ offrng[0] - maxref.offrng[0], ++ wi::smax (offrng[1] - maxref.offrng[1], offrng[0]), + }; + + /* Add the final PHI's offset to that of each of the arguments +@@ -4493,12 +4493,15 @@ access_ref::inform_access (access_mode m + /* Strip the SSA_NAME suffix from the variable name and + recreate an identifier with the VLA's original name. */ + ref = gimple_call_lhs (stmt); +- ref = SSA_NAME_IDENTIFIER (ref); +- const char *id = IDENTIFIER_POINTER (ref); +- size_t len = strcspn (id, ".$"); +- if (!len) +- len = strlen (id); +- ref = get_identifier_with_length (id, len); ++ if (SSA_NAME_IDENTIFIER (ref)) ++ { ++ ref = SSA_NAME_IDENTIFIER (ref); ++ const char *id = IDENTIFIER_POINTER (ref); ++ size_t len = strcspn (id, ".$"); ++ if (!len) ++ len = strlen (id); ++ ref = get_identifier_with_length (id, len); ++ } + } + else + { +@@ -4557,13 +4560,13 @@ access_ref::inform_access (access_mode m + return; + } + +- if (DECL_P (ref)) ++ if (allocfn == NULL_TREE) + { + if (*offstr) +- inform (loc, "at offset %s into source object %qD of size %s", ++ inform (loc, "at offset %s into source object %qE of size %s", + offstr, ref, sizestr); + else +- inform (loc, "source object %qD of size %s", ref, sizestr); ++ inform (loc, "source object %qE of size %s", ref, sizestr); + + return; + } +--- gcc/testsuite/gcc.dg/pr98721-1.c.jj 2021-01-19 12:15:03.825600828 +0100 ++++ gcc/testsuite/gcc.dg/pr98721-1.c 2021-01-19 12:14:24.730045488 +0100 +@@ -0,0 +1,14 @@ ++/* PR tree-optimization/98721 */ ++/* { dg-do compile } */ ++/* { dg-options "-O2" } */ ++ ++int ++foo (int n) ++{ ++ if (n <= 0) ++ { ++ char vla[n]; /* { dg-message "source object 'vla' of size 0" } */ ++ return __builtin_strlen (vla); /* { dg-warning "'__builtin_strlen' reading 1 or more bytes from a region of size 0" } */ ++ } ++ return -1; ++} +--- gcc/testsuite/gcc.dg/pr98721-2.c.jj 2021-01-19 12:00:16.005742548 +0100 ++++ gcc/testsuite/gcc.dg/pr98721-2.c 2021-01-19 11:59:29.372275423 +0100 +@@ -0,0 +1,8 @@ ++/* PR tree-optimization/98721 */ ++/* { dg-do compile } */ ++ ++int ++foo (void) ++{ ++ return __builtin_strlen (__builtin_alloca_with_align (0, 16)); /* { dg-warning "'__builtin_strlen' reading 1 or more bytes from a region of size 0" } */ ++} /* { dg-message "source object '' of size 0" "" { target *-*-* } .-1 } */ diff --git a/gcc11-pr98742.patch b/gcc11-pr98742.patch new file mode 100644 index 0000000..1b76510 --- /dev/null +++ b/gcc11-pr98742.patch @@ -0,0 +1,42 @@ +2021-01-19 Jakub Jelinek + + PR c++/98742 + * semantics.c (finish_omp_clauses) : If + error_operand_p, remove clause without further checking. Check + for non-NULL TYPE_NAME. + + * c-c++-common/gomp/task-detach-2.c: New test. + +--- gcc/cp/semantics.c.jj 2021-01-16 22:52:33.608413922 +0100 ++++ gcc/cp/semantics.c 2021-01-19 10:53:07.979801786 +0100 +@@ -7430,12 +7430,18 @@ finish_omp_clauses (tree clauses, enum c + remove = true; + break; + } ++ else if (error_operand_p (t)) ++ { ++ remove = true; ++ break; ++ } + else + { + tree type = TYPE_MAIN_VARIANT (TREE_TYPE (t)); + if (!type_dependent_expression_p (t) + && (!INTEGRAL_TYPE_P (type) + || TREE_CODE (type) != ENUMERAL_TYPE ++ || TYPE_NAME (type) == NULL_TREE + || (DECL_NAME (TYPE_NAME (type)) + != get_identifier ("omp_event_handle_t")))) + { +--- gcc/testsuite/c-c++-common/gomp/task-detach-2.c.jj 2021-01-19 11:07:29.345948289 +0100 ++++ gcc/testsuite/c-c++-common/gomp/task-detach-2.c 2021-01-19 11:06:57.090317518 +0100 +@@ -0,0 +1,9 @@ ++/* PR c++/98742 */ ++/* { dg-do compile } */ ++ ++void ++foo () ++{ ++#pragma omp task detach(0) /* { dg-error "before numeric constant" } */ ++ ; ++}