Hi!
I've backported following patches to 6.x branch and committed
after bootstrapping/regtesting them on x86_64-linux and i686-linux.
Jakub
2016-06-14 Jakub Jelinek <[email protected]>
Backported from mainline
2016-06-04 Jakub Jelinek <[email protected]>
PR tree-optimization/71405
* tree-ssa.c (execute_update_addresses_taken): For clobber with
incompatible type, build a new clobber with the right type instead
of building a VIEW_CONVERT_EXPR around it.
* g++.dg/torture/pr71405.C: New test.
--- gcc/tree-ssa.c (revision 237090)
+++ gcc/tree-ssa.c (revision 237091)
@@ -1622,9 +1622,16 @@ execute_update_addresses_taken (void)
if (gimple_assign_lhs (stmt) != lhs
&& !useless_type_conversion_p (TREE_TYPE (lhs),
TREE_TYPE (rhs)))
- rhs = fold_build1 (VIEW_CONVERT_EXPR,
- TREE_TYPE (lhs), rhs);
-
+ {
+ if (gimple_clobber_p (stmt))
+ {
+ rhs = build_constructor (TREE_TYPE (lhs), NULL);
+ TREE_THIS_VOLATILE (rhs) = 1;
+ }
+ else
+ rhs = fold_build1 (VIEW_CONVERT_EXPR,
+ TREE_TYPE (lhs), rhs);
+ }
if (gimple_assign_lhs (stmt) != lhs)
gimple_assign_set_lhs (stmt, lhs);
--- gcc/testsuite/g++.dg/torture/pr71405.C (revision 0)
+++ gcc/testsuite/g++.dg/torture/pr71405.C (revision 237091)
@@ -0,0 +1,22 @@
+// PR tree-optimization/71405
+// { dg-do compile }
+
+struct C
+{
+ C () {}
+ int i;
+};
+
+void *
+operator new (__SIZE_TYPE__ x, void *y)
+{
+ return y;
+}
+
+int
+main ()
+{
+ int a;
+ new (&a) C;
+ return a;
+}
2016-06-14 Jakub Jelinek <[email protected]>
Backported from mainline
2016-06-08 Jakub Jelinek <[email protected]>
Richard Biener <[email protected]>
PR c++/71448
* fold-const.c (fold_comparison): Handle CONSTANT_CLASS_P (base0)
the same as DECL_P (base0) for indirect_base0. Use equality_code
in one further place.
* g++.dg/torture/pr71448.C: New test.
--- gcc/fold-const.c (revision 237211)
+++ gcc/fold-const.c (revision 237212)
@@ -8527,9 +8527,9 @@ fold_comparison (location_t loc, enum tr
if ((offset0 == offset1
|| (offset0 && offset1
&& operand_equal_p (offset0, offset1, 0)))
- && (code == EQ_EXPR
- || code == NE_EXPR
- || (indirect_base0 && DECL_P (base0))
+ && (equality_code
+ || (indirect_base0
+ && (DECL_P (base0) || CONSTANT_CLASS_P (base0)))
|| POINTER_TYPE_OVERFLOW_UNDEFINED))
{
@@ -8568,7 +8568,8 @@ fold_comparison (location_t loc, enum tr
6.5.6/8 and /9 with respect to the signed ptrdiff_t. */
else if (bitpos0 == bitpos1
&& (equality_code
- || (indirect_base0 && DECL_P (base0))
+ || (indirect_base0
+ && (DECL_P (base0) || CONSTANT_CLASS_P (base0)))
|| POINTER_TYPE_OVERFLOW_UNDEFINED))
{
/* By converting to signed sizetype we cover middle-end pointer
--- gcc/testsuite/g++.dg/torture/pr71448.C (revision 0)
+++ gcc/testsuite/g++.dg/torture/pr71448.C (revision 237212)
@@ -0,0 +1,27 @@
+// PR c++/71448
+// { dg-do compile }
+// { dg-additional-options "-std=c++11" }
+
+static constexpr const char foo[] = "foo";
+static constexpr const char *bar = "bar";
+
+static_assert ((foo + 3 - foo) == 3, "check");
+static_assert (foo + 2 != foo, "check");
+static_assert (foo + 2 >= foo, "check");
+static_assert (3 + foo >= foo, "check");
+static_assert (foo <= foo + 2, "check");
+static_assert (foo <= 3 + foo, "check");
+static_assert (foo + 2 > foo, "check");
+static_assert (3 + foo > foo, "check");
+static_assert (foo < 2 + foo, "check");
+static_assert (foo < foo + 3, "check");
+static_assert ((bar + 3 - bar) == 3, "check");
+static_assert (bar + 2 != bar, "check");
+static_assert (2 + bar >= bar, "check");
+static_assert (bar + 3 >= bar, "check");
+static_assert (bar <= bar + 2, "check");
+static_assert (bar <= 3 + bar, "check");
+static_assert (bar + 2 > bar, "check");
+static_assert (3 + bar > bar, "check");
+static_assert (bar < 2 + bar, "check");
+static_assert (bar < bar + 3, "check");
2016-06-14 Jakub Jelinek <[email protected]>
Backported from mainline
2016-06-10 Jakub Jelinek <[email protected]>
PR c/68657
* c.opt (Wpsabi): Add Warning flag.
* gcc.target/i386/pr68657.c: New test.
--- gcc/c-family/c.opt (revision 237315)
+++ gcc/c-family/c.opt (revision 237316)
@@ -265,7 +265,7 @@ C++ ObjC++ Var(warn_abi_tag) Warning
Warn if a subobject has an abi_tag attribute that the complete object type
does not have.
Wpsabi
-C ObjC C++ ObjC++ LTO Var(warn_psabi) Init(1) Undocumented LangEnabledBy(C
ObjC C++ ObjC++,Wabi)
+C ObjC C++ ObjC++ LTO Var(warn_psabi) Init(1) Warning Undocumented
LangEnabledBy(C ObjC C++ ObjC++,Wabi)
Waddress
C ObjC C++ ObjC++ Var(warn_address) Warning LangEnabledBy(C ObjC C++
ObjC++,Wall)
--- gcc/testsuite/gcc.target/i386/pr68657.c (revision 0)
+++ gcc/testsuite/gcc.target/i386/pr68657.c (revision 237316)
@@ -0,0 +1,15 @@
+/* PR c/68657 */
+/* { dg-options "-mno-avx512f -Werror=psabi" } */
+
+typedef int V __attribute__((vector_size (64)));
+
+void foo (V x, V *y) { /* { dg-error "AVX512F vector argument without AVX512F
enabled" } */
+ *y = x;
+}
+
+V bar (V *x) { /* { dg-error "AVX512F vector return without AVX512F
enabled" } */
+ return *x;
+}
+
+/* { dg-message "The ABI for passing parameters with 64-byte alignment has
changed" "" { target *-*-* } 6 } */
+/* { dg-message "some warnings being treated as errors" "" { target *-*-* } 0
} */
2016-06-14 Jakub Jelinek <[email protected]>
Backported from mainline
2016-06-10 Jakub Jelinek <[email protected]>
PR middle-end/71494
* tree-nested.c (convert_nonlocal_reference_stmt): For GIMPLE_GOTO
without LABEL_DECL, set *handled_ops_p to false instead of true.
* gcc.c-torture/execute/pr71494.c: New test.
--- gcc/tree-nested.c (revision 237316)
+++ gcc/tree-nested.c (revision 237317)
@@ -1347,7 +1347,7 @@ convert_nonlocal_reference_stmt (gimple_
{
wi->val_only = true;
wi->is_lhs = false;
- *handled_ops_p = true;
+ *handled_ops_p = false;
return NULL_TREE;
}
break;
--- gcc/testsuite/gcc.c-torture/execute/pr71494.c (revision 0)
+++ gcc/testsuite/gcc.c-torture/execute/pr71494.c (revision 237317)
@@ -0,0 +1,22 @@
+/* PR middle-end/71494 */
+
+int
+main ()
+{
+ void *label = &&out;
+ int i = 0;
+ void test (void)
+ {
+ label = &&out2;
+ goto *label;
+ out2:;
+ i++;
+ }
+ goto *label;
+ out:
+ i += 2;
+ test ();
+ if (i != 3)
+ __builtin_abort ();
+ return 0;
+}