aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2016-06-04 16:50:57 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2016-06-04 16:50:57 +0200
commit1927a96372b003fe6217c64241bb69d838a67dc8 (patch)
treebefd4674cc10cc316c209d081ba0bcebdd77e8c8 /gcc
parent56812845490199b04123d9faf55cc2b338e6dfb9 (diff)
downloadgcc-1927a96372b003fe6217c64241bb69d838a67dc8.zip
gcc-1927a96372b003fe6217c64241bb69d838a67dc8.tar.gz
gcc-1927a96372b003fe6217c64241bb69d838a67dc8.tar.bz2
re PR tree-optimization/71405 (ICE on valid C++ code at -Os and above on x86_64-linux-gnu: verify_gimple failed)
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. From-SVN: r237091
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/torture/pr71405.C22
-rw-r--r--gcc/tree-ssa.c13
4 files changed, 44 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 3e11cb9..e07d2de 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2016-06-04 Jakub Jelinek <jakub@redhat.com>
+
+ 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.
+
2016-06-04 Oleg Endo <olegendo@gcc.gnu.org>
PR tree-optimization/52171
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 94b4a33..c272ade 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2016-06-04 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/71405
+ * g++.dg/torture/pr71405.C: New test.
+
2016-06-04 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/70202
diff --git a/gcc/testsuite/g++.dg/torture/pr71405.C b/gcc/testsuite/g++.dg/torture/pr71405.C
new file mode 100644
index 0000000..5260243
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr71405.C
@@ -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;
+}
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c
index a53322d..2f3caf3 100644
--- a/gcc/tree-ssa.c
+++ b/gcc/tree-ssa.c
@@ -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);