8.0.1-0.22

This commit is contained in:
Jakub Jelinek 2018-04-24 23:04:58 +02:00
parent 3ae68fd84a
commit 0d6e9e6a5b
6 changed files with 388 additions and 56 deletions

1
.gitignore vendored
View File

@ -44,3 +44,4 @@
/gcc-8.0.1-20180317.tar.xz
/gcc-8.0.1-20180324.tar.xz
/gcc-8.0.1-20180410.tar.xz
/gcc-8.0.1-20180424.tar.xz

View File

@ -1,10 +1,10 @@
%global DATE 20180410
%global SVNREV 259284
%global DATE 20180424
%global SVNREV 259617
%global gcc_version 8.0.1
%global gcc_major 8
# Note, gcc_release must be integer, if you want to add suffixes to
# %%{release}, append them after %%{gcc_release} on Release: line.
%global gcc_release 0.21
%global gcc_release 0.22
%global nvptx_tools_gitrev c28050f60193b3b95a18866a96f03334e874e78f
%global nvptx_newlib_gitrev aadc8eb0ec43b7cd0dd2dfb484bae63c8b05ef24
%global _unpackaged_files_terminate_build 0
@ -244,7 +244,8 @@ Patch8: gcc8-no-add-needed.patch
Patch9: gcc8-foffload-default.patch
Patch10: gcc8-Wno-format-security.patch
Patch11: gcc8-rh1512529-aarch64.patch
Patch12: gcc8-pr85300.patch
Patch12: gcc8-pr85437.patch
Patch13: gcc8-mcet.patch
Patch1000: nvptx-tools-no-ptxas.patch
Patch1001: nvptx-tools-build.patch
@ -803,7 +804,8 @@ to NVidia PTX capable devices if available.
%patch9 -p0 -b .foffload-default~
%patch10 -p0 -b .Wno-format-security~
%patch11 -p0 -b .rh1512529-aarch64~
%patch12 -p0 -b .pr85300~
%patch12 -p0 -b .pr85437~
%patch13 -p0 -b .mcet~
cd nvptx-tools-%{nvptx_tools_gitrev}
%patch1000 -p1 -b .nvptx-tools-no-ptxas~
@ -3069,6 +3071,36 @@ fi
%endif
%changelog
* Tue Apr 24 2018 Jakub Jelinek <jakub@redhat.com> 8.0.1-0.22
- update from the trunk
- PRs c++/69560, c++/70808, c++/80290, c++/84463, c++/84611, c++/84630,
c++/85032, c++/85039, c++/85112, c++/85258, c++/85356, c++/85385,
c++/85462, c++/85464, c++/85470, c/85365, debug/83157, debug/84637,
debug/85302, fortran/81773, fortran/83606, fortran/85387, ipa/84149,
ipa/85329, ipa/85391, ipa/85421, jit/85384, libgcc/85334,
libgcc/85379, libgomp/85463, libstdc++/84442, libstdc++/85442,
lto/71991, lto/81968, lto/85339, lto/85371, lto/85391, lto/85405,
middle-end/81657, middle-end/84955, middle-end/85414,
middle-end/85455, middle-end/85475, middle-end/85496, objc/85476,
rtl-optimization/79916, rtl-optimization/83852,
rtl-optimization/84566, rtl-optimization/84659,
rtl-optimization/85342, rtl-optimization/85354,
rtl-optimization/85376, rtl-optimization/85393,
rtl-optimization/85423, rtl-optimization/85431, sanitizer/85230,
sanitizer/85389, target/81084, target/83402, target/83660,
target/84301, target/84331, target/85080, target/85238, target/85261,
target/85281, target/85287, target/85291, target/85293, target/85296,
target/85321, target/85328, target/85347, target/85388, target/85397,
target/85403, target/85404, target/85417, target/85424, target/85430,
target/85445, target/85456, target/85469, target/85485, target/85489,
target/85491, target/85503, target/85508, target/85511,
testsuite/85326, testsuite/85346, testsuite/85483,
tree-optimization/82965, tree-optimization/83991,
tree-optimization/84737, tree-optimization/85331,
tree-optimization/85446, tree-optimization/85467,
tree-optimization/85478
- temporarily readd -mcet as alias to -mshstk
* Tue Apr 10 2018 Jakub Jelinek <jakub@redhat.com> 8.0.1-0.21
- update from the trunk
- PRs c++/24314, c++/64095, c++/65923, c++/80026, c++/80956, c++/82152,

17
gcc8-mcet.patch Normal file
View File

@ -0,0 +1,17 @@
2018-04-24 Jakub Jelinek <jakub@redhat.com>
* config/i386/i386.opt (mcet): Remporarily re-add as alias to -mshstk.
--- gcc/config/i386/i386.opt (revision 259613)
+++ gcc/config/i386/i386.opt (revision 259612)
@@ -1006,6 +1006,10 @@ mgeneral-regs-only
Target Report RejectNegative Mask(GENERAL_REGS_ONLY) Var(ix86_target_flags) Save
Generate code which uses only the general registers.
+mcet
+Target Undocumented Alias(mshstk)
+;; Deprecated
+
mshstk
Target Report Mask(ISA_SHSTK) Var(ix86_isa_flags) Save
Enable shadow stack built-in functions from Control-flow Enforcement

View File

@ -1,50 +0,0 @@
2018-04-10 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/85300
* combine.c (subst): Handle subst of CONST_SCALAR_INT_P new_rtx also
into FLOAT and UNSIGNED_FLOAT like ZERO_EXTEND, return a CLOBBER if
simplify_unary_operation fails.
* gcc.dg/pr85300.c: New test.
--- gcc/combine.c.jj 2018-04-09 20:15:43.704632013 +0200
+++ gcc/combine.c 2018-04-10 09:06:25.826606396 +0200
@@ -5575,11 +5575,15 @@ subst (rtx x, rtx from, rtx to, int in_d
x = gen_rtx_CLOBBER (mode, const0_rtx);
}
else if (CONST_SCALAR_INT_P (new_rtx)
- && GET_CODE (x) == ZERO_EXTEND)
+ && (GET_CODE (x) == ZERO_EXTEND
+ || GET_CODE (x) == FLOAT
+ || GET_CODE (x) == UNSIGNED_FLOAT))
{
- x = simplify_unary_operation (ZERO_EXTEND, GET_MODE (x),
- new_rtx, GET_MODE (XEXP (x, 0)));
- gcc_assert (x);
+ x = simplify_unary_operation (GET_CODE (x), GET_MODE (x),
+ new_rtx,
+ GET_MODE (XEXP (x, 0)));
+ if (!x)
+ return gen_rtx_CLOBBER (VOIDmode, const0_rtx);
}
else
SUBST (XEXP (x, i), new_rtx);
--- gcc/testsuite/gcc.dg/pr85300.c.jj 2018-04-10 08:53:04.594782804 +0200
+++ gcc/testsuite/gcc.dg/pr85300.c 2018-04-10 08:53:04.594782804 +0200
@@ -0,0 +1,16 @@
+/* PR rtl-optimization/85300 */
+/* { dg-do compile } */
+/* { dg-options "-O1 -g -funroll-all-loops -fno-tree-ter -fno-web" } */
+
+void
+foo (double x, unsigned char y)
+{
+ while ((int) x < 1)
+ {
+ float a;
+
+ a = y | 0x100;
+ y = 0;
+ x = a;
+ }
+}

332
gcc8-pr85437.patch Normal file
View File

@ -0,0 +1,332 @@
2018-04-24 Nathan Sidwell <nathan@acm.org>
PR c++/85437
PR c++/49171
* cp-tree.h (REINTERPRET_CAST_P): New.
* constexpr.c (cxx_eval_constant_expression) <case NOP_EXPR>:
Reject REINTERPET_CAST_P conversions. Use cplus_expand_constant
for non-trivial PTRMEM_CST cases.
* typeck.c (build_nop_reinterpret): New.
(build_reinterpret_cast_1): Use it. Set REINTERPRET_CAST_P on
NOP_EXPRs returned by cp_convert.
2018-04-24 Jakub Jelinek <jakub@redhat.com>
PR c++/85437
PR c++/49171
* g++.dg/cpp0x/addressof1.C: Make reinterpret cases runtime checks.
* g++.dg/cpp0x/constexpr-cast.C: Remove xfails
* g++.dg/cpp0x/constexpr-nullptr-2.C: Likewise.
* g++.dg/cpp0x/constexpr-pmf1.C: Check when optimized.
* g++.dg/cpp0x/pr85437-1.C: New.
* g++.dg/cpp0x/pr85437-2.C: New.
* g++.dg/cpp0x/pr85437-3.C: New.
* g++.dg/cpp0x/pr85437-4.C: New.
--- gcc/cp/constexpr.c (revision 259592)
+++ gcc/cp/constexpr.c (working copy)
@@ -1822,8 +1822,8 @@ reduced_constant_expression_p (tree t)
}
/* Some expressions may have constant operands but are not constant
- themselves, such as 1/0. Call this function (or rather, the macro
- following it) to check for that condition.
+ themselves, such as 1/0. Call this function to check for that
+ condition.
We only call this in places that require an arithmetic constant, not in
places where we might have a non-constant expression that can be a
@@ -4579,9 +4579,18 @@ cxx_eval_constant_expression (const cons
non_constant_p, overflow_p);
break;
+ case NOP_EXPR:
+ if (REINTERPRET_CAST_P (t))
+ {
+ if (!ctx->quiet)
+ error_at (EXPR_LOC_OR_LOC (t, input_location),
+ "a reinterpret_cast is not a constant expression");
+ *non_constant_p = true;
+ return t;
+ }
+ /* FALLTHROUGH. */
case CONVERT_EXPR:
case VIEW_CONVERT_EXPR:
- case NOP_EXPR:
case UNARY_PLUS_EXPR:
{
tree oldop = TREE_OPERAND (t, 0);
@@ -4595,20 +4604,13 @@ cxx_eval_constant_expression (const cons
if (TREE_CODE (op) == PTRMEM_CST
&& !TYPE_PTRMEM_P (type))
op = cplus_expand_constant (op);
+
if (TREE_CODE (op) == PTRMEM_CST && tcode == NOP_EXPR)
{
- if (same_type_ignoring_top_level_qualifiers_p (type,
- TREE_TYPE (op))
- || can_convert_qual (type, op))
- return cp_fold_convert (type, op);
- else
- {
- if (!ctx->quiet)
- error_at (EXPR_LOC_OR_LOC (t, input_location),
- "a reinterpret_cast is not a constant expression");
- *non_constant_p = true;
- return t;
- }
+ if (!same_type_ignoring_top_level_qualifiers_p (type, TREE_TYPE (op))
+ && !can_convert_qual (type, op))
+ op = cplus_expand_constant (op);
+ return cp_fold_convert (type, op);
}
if (POINTER_TYPE_P (type) && TREE_CODE (op) == INTEGER_CST)
@@ -4653,14 +4655,17 @@ cxx_eval_constant_expression (const cons
return t;
}
}
+
if (op == oldop && tcode != UNARY_PLUS_EXPR)
/* We didn't fold at the top so we could check for ptr-int
conversion. */
return fold (t);
+
if (tcode == UNARY_PLUS_EXPR)
r = fold_convert (TREE_TYPE (t), op);
else
r = fold_build1 (tcode, type, op);
+
/* Conversion of an out-of-range value has implementation-defined
behavior; the language considers it different from arithmetic
overflow, which is undefined. */
--- gcc/cp/cp-tree.h (revision 259592)
+++ gcc/cp/cp-tree.h (working copy)
@@ -372,6 +372,7 @@ extern GTY(()) tree cp_global_trees[CPTI
TEMPLATE_TYPE_PARM_FOR_CLASS (TEMPLATE_TYPE_PARM)
DECL_NAMESPACE_INLINE_P (in NAMESPACE_DECL)
SWITCH_STMT_ALL_CASES_P (in SWITCH_STMT)
+ REINTERPRET_CAST_P (in NOP_EXPR)
ALIGNOF_EXPR_STD_P (in ALIGNOF_EXPR)
1: IDENTIFIER_KIND_BIT_1 (in IDENTIFIER_NODE)
TI_PENDING_TEMPLATE_FLAG.
@@ -632,6 +633,11 @@ typedef struct ptrmem_cst * ptrmem_cst_t
#define COND_EXPR_IS_VEC_DELETE(NODE) \
TREE_LANG_FLAG_0 (COND_EXPR_CHECK (NODE))
+/* Nonzero if this NOP_EXPR is a reinterpret_cast. Such conversions
+ are not constexprs. Other NOP_EXPRs are. */
+#define REINTERPRET_CAST_P(NODE) \
+ TREE_LANG_FLAG_0 (NOP_EXPR_CHECK (NODE))
+
/* Returns nonzero iff TYPE1 and TYPE2 are the same type, in the usual
sense of `same'. */
#define same_type_p(TYPE1, TYPE2) \
--- gcc/cp/typeck.c (revision 259592)
+++ gcc/cp/typeck.c (working copy)
@@ -7280,6 +7280,18 @@ convert_member_func_to_ptr (tree type, t
return build_nop (type, expr);
}
+/* Build a NOP_EXPR to TYPE, but mark it as a reinterpret_cast so that
+ constexpr evaluation knows to reject it. */
+
+static tree
+build_nop_reinterpret (tree type, tree expr)
+{
+ tree ret = build_nop (type, expr);
+ if (ret != expr)
+ REINTERPRET_CAST_P (ret) = true;
+ return ret;
+}
+
/* Return a representation for a reinterpret_cast from EXPR to TYPE.
If C_CAST_P is true, this reinterpret cast is being done as part of
a C-style cast. If VALID_P is non-NULL, *VALID_P is set to
@@ -7414,7 +7426,7 @@ build_reinterpret_cast_1 (tree type, tre
warning (OPT_Wcast_function_type,
"cast between incompatible function types"
" from %qH to %qI", intype, type);
- return build_nop (type, expr);
+ return build_nop_reinterpret (type, expr);
}
else if (TYPE_PTRMEMFUNC_P (type) && TYPE_PTRMEMFUNC_P (intype))
{
@@ -7425,7 +7437,7 @@ build_reinterpret_cast_1 (tree type, tre
warning (OPT_Wcast_function_type,
"cast between incompatible pointer to member types"
" from %qH to %qI", intype, type);
- return build_nop (type, expr);
+ return build_nop_reinterpret (type, expr);
}
else if ((TYPE_PTRDATAMEM_P (type) && TYPE_PTRDATAMEM_P (intype))
|| (TYPE_PTROBV_P (type) && TYPE_PTROBV_P (intype)))
@@ -7451,7 +7463,7 @@ build_reinterpret_cast_1 (tree type, tre
/* strict_aliasing_warning STRIP_NOPs its expr. */
strict_aliasing_warning (EXPR_LOCATION (expr), type, expr);
- return build_nop (type, expr);
+ return build_nop_reinterpret (type, expr);
}
else if ((TYPE_PTRFN_P (type) && TYPE_PTROBV_P (intype))
|| (TYPE_PTRFN_P (intype) && TYPE_PTROBV_P (type)))
@@ -7462,7 +7474,7 @@ build_reinterpret_cast_1 (tree type, tre
warning (OPT_Wconditionally_supported,
"casting between pointer-to-function and pointer-to-object "
"is conditionally-supported");
- return build_nop (type, expr);
+ return build_nop_reinterpret (type, expr);
}
else if (VECTOR_TYPE_P (type))
return convert_to_vector (type, expr);
@@ -7478,7 +7490,11 @@ build_reinterpret_cast_1 (tree type, tre
return error_mark_node;
}
- return cp_convert (type, expr, complain);
+ expr = cp_convert (type, expr, complain);
+ if (TREE_CODE (expr) == NOP_EXPR)
+ /* Mark any nop_expr that created as a reintepret_cast. */
+ REINTERPRET_CAST_P (expr) = true;
+ return expr;
}
tree
--- gcc/testsuite/g++.dg/cpp0x/addressof1.C (revision 259592)
+++ gcc/testsuite/g++.dg/cpp0x/addressof1.C (working copy)
@@ -18,9 +18,7 @@ static_assert (addressof (j) == &i, "");
struct S { int s; } s;
static_assert (__builtin_addressof (s) == &s, "");
-static_assert ((int *) __builtin_addressof (s) == &s.s, "");
static_assert (addressof (s) == &s, "");
-static_assert ((int *) addressof (s) == &s.s, "");
struct T
{
@@ -31,9 +29,7 @@ struct T
};
constexpr T t;
T T::tt;
-static_assert (__builtin_addressof (t) == (const T *) &t.p, "");
static_assert (&t == __builtin_addressof (T::tt), "");
-static_assert (addressof (t) == (const T *) &t.p, "");
static_assert (&t == addressof (T::tt), "");
struct S x, y;
@@ -76,8 +72,6 @@ constexpr int a = 1;
static_assert (__builtin_addressof (a) == &a, "");
static_assert (addressof (a) == &a, "");
constexpr int c[10] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
-static_assert ((const int *) __builtin_addressof (c) == &c[0], "");
-static_assert ((const int *) addressof (c) == &c[0], "");
void
baz ()
@@ -93,4 +87,15 @@ main ()
|| __builtin_addressof (baz) != baz
|| addressof (baz) != baz)
__builtin_abort ();
+
+ // reinterpret casts are not constexprs
+ if (! (((int *) __builtin_addressof (s) == &s.s)
+ && ((int *) addressof (s) == &s.s)
+ && (__builtin_addressof (t) == (const T *) &t.p)
+ && (addressof (t) == (const T *) &t.p)
+ && ((const int *) __builtin_addressof (c) == &c[0])
+ && ((const int *) addressof (c) == &c[0])))
+ __builtin_abort ();
+
+ return 0;
}
--- gcc/testsuite/g++.dg/cpp0x/constexpr-cast.C (revision 259592)
+++ gcc/testsuite/g++.dg/cpp0x/constexpr-cast.C (working copy)
@@ -4,8 +4,8 @@
int i;
-// The following is accepted due to bug 49171.
-constexpr void *q = reinterpret_cast<void*>(&i); // { dg-error "" "bug c++/49171" { xfail *-*-* } }
+// The following was accepted due to bug 49171.
+constexpr void *q = reinterpret_cast<void*>(&i); // { dg-error "not a constant expression" }
constexpr void *r0 = reinterpret_cast<void*>(1); // { dg-error "not a constant expression|reinterpret_cast from integer to pointer" }
constexpr void *r1 = reinterpret_cast<void*>(sizeof 'x'); // { dg-error ".reinterpret_cast<void\\*>\\(1\[ul\]\*\\). is not a constant expression" }
--- gcc/testsuite/g++.dg/cpp0x/constexpr-nullptr-2.C (revision 259592)
+++ gcc/testsuite/g++.dg/cpp0x/constexpr-nullptr-2.C (working copy)
@@ -99,9 +99,8 @@ constexpr const volatile void* pv3 = p0;
constexpr void* pv4 = static_cast<void*>(p0);
constexpr const void* pv5 = static_cast<const void*>(p0);
-// The following should be rejected but isn't because of bug c++/49171
-// - [C++0x][constexpr] Constant expressions support reinterpret_cast
-constexpr void* pv6 = reinterpret_cast<void*>(p0); // { dg-error "" "bug c++/49171" { xfail *-*-* } }
+// The following was accepted due to bug c++/49171
+constexpr void* pv6 = reinterpret_cast<void*>(p0); // { dg-error "not a constant expression" }
// Adding or subtracting zero from a null pointer is valid in C++.
constexpr int* p1 = p0 + 0;
--- gcc/testsuite/g++.dg/cpp0x/constexpr-pmf1.C (revision 259592)
+++ gcc/testsuite/g++.dg/cpp0x/constexpr-pmf1.C (working copy)
@@ -1,6 +1,6 @@
// PR c++/77775
-// { dg-options -fdump-tree-gimple }
-// { dg-final { scan-tree-dump "== viewAdded" "gimple" { target c++11 } } }
+// { dg-options "-fdump-tree-fre1 -O1" }
+// { dg-final { scan-tree-dump "== viewAdded" "fre1" { target c++11 } } }
namespace Sublime {
struct View;
--- gcc/testsuite/g++.dg/cpp0x/pr85437-1.C (revision 0)
+++ gcc/testsuite/g++.dg/cpp0x/pr85437-1.C (working copy)
@@ -0,0 +1,17 @@
+// PR c++/85437
+// { dg-do compile { target c++11 } }
+
+struct A { int a; constexpr A() : a(0) {} };
+struct B : A { int x; constexpr B() : x(0) {} };
+struct X { int z; constexpr X() : z(0) {} };
+struct C : X, B {};
+constexpr int C::*cbx = &B::x;
+constexpr int B::*bx = &B::x;
+constexpr int A::*abx = static_cast<int(A::*)>(&B::x); // { dg-bogus "not a constant expression" }
+
+constexpr const C y;
+constexpr const B& yb = y;
+constexpr const A& ya = y;
+constexpr int const *pcbx = &(y.*cbx);
+constexpr int const *pbx = &(y.*bx);
+constexpr int const *pabx = &(ya.*abx);
--- gcc/testsuite/g++.dg/cpp0x/pr85437-2.C (revision 0)
+++ gcc/testsuite/g++.dg/cpp0x/pr85437-2.C (working copy)
@@ -0,0 +1,8 @@
+// PR c++/85437
+// { dg-do compile { target c++11 } }
+
+struct A { };
+struct B : A { int x; };
+
+constexpr int A::*abx
+= reinterpret_cast<int(A::*)>(&B::x); // { dg-error "reinterpret.*constant" }
--- gcc/testsuite/g++.dg/cpp0x/pr85437-3.C (revision 0)
+++ gcc/testsuite/g++.dg/cpp0x/pr85437-3.C (working copy)
@@ -0,0 +1,8 @@
+// PR c++/85437
+// { dg-do compile { target c++11 } }
+
+struct A { int y; };
+struct B { int x; };
+struct C : A, B {};
+constexpr int C::*pci = &B::x;
+constexpr int A::*pai = static_cast<int A::*>(static_cast<int C::*>(&B::x)); // { dg-bogus "not a constant expression" }
--- gcc/testsuite/g++.dg/cpp0x/pr85437-4.C (revision 0)
+++ gcc/testsuite/g++.dg/cpp0x/pr85437-4.C (working copy)
@@ -0,0 +1,8 @@
+// PR c++/85437
+// { dg-do compile { target c++11 } }
+
+struct A { };
+struct B { int x; };
+struct C : A, B {};
+constexpr int C::*pci = &B::x;
+constexpr int A::*pai = static_cast<int A::*>(pci); // { dg-bogus "not a constant expression" }

View File

@ -1,3 +1,3 @@
SHA512 (gcc-8.0.1-20180410.tar.xz) = 395a62d85fa17b3f0c829172dee8c41b776514acc1bb2694308b8d4acc7553e2eed4a4c071c1e1cb4424e0d4c52fe6e3f7628f32e638edc550b0d96afce5aed9
SHA512 (gcc-8.0.1-20180424.tar.xz) = 8c7d9cbfaa616b5f9e2e8e82cedbf1fc259cff52e7c0bbb03ca72880c42133ff018fa679ce32b3c58b909d1dfd75af4668806d9a608d394afba219c40dd99f9f
SHA512 (nvptx-newlib-aadc8eb0ec43b7cd0dd2dfb484bae63c8b05ef24.tar.xz) = 94f7089365296f7dfa485107b4143bebc850a81586f3460fd896bbbb6ba099a00217d4042133424fd2183b352132f4fd367e6a60599bdae2a26dfd48a77d0e04
SHA512 (nvptx-tools-c28050f60193b3b95a18866a96f03334e874e78f.tar.xz) = a688cb12cf805950a5abbb13b52f45c81dbee98e310b7ed57ae20e76dbfa5964a16270148374a6426d177db71909d28360490f091c86a5d19d4faa5127beeee1