OSDN Git Service

2008-09-18 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 18 Sep 2008 12:52:31 +0000 (12:52 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 18 Sep 2008 12:52:31 +0000 (12:52 +0000)
PR middle-end/37284
* tree-cfg.c (remove_useless_stmts_1): Remove
GIMPLE_CHANGE_DYNAMIC_TYPE if not optimizing.

* g++.dg/tree-ssa/pr37284.C: New testcase.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@140453 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/tree-ssa/pr37284.C [new file with mode: 0644]
gcc/tree-cfg.c

index 093f982..f680fd6 100644 (file)
@@ -1,3 +1,9 @@
+2008-09-18  Richard Guenther  <rguenther@suse.de>
+
+       PR middle-end/37284
+       * tree-cfg.c (remove_useless_stmts_1): Remove
+       GIMPLE_CHANGE_DYNAMIC_TYPE if not optimizing.
+
 2008-09-18  Nick Clifton  <nickc@redhat.com>
 
        * config/frv/frv.h (IRA_COVER_CLASSES): Define.
index e905405..477455e 100644 (file)
@@ -1,3 +1,8 @@
+2008-09-18  Richard Guenther  <rguenther@suse.de>
+
+       PR middle-end/37284
+       * g++.dg/tree-ssa/pr37284.C: New testcase.
+
 2008-09-18  Daniel Kraft  <d@domob.eu>
 
        PR fortran/37507
diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr37284.C b/gcc/testsuite/g++.dg/tree-ssa/pr37284.C
new file mode 100644 (file)
index 0000000..26ddc1a
--- /dev/null
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-fstrict-aliasing" } */
+
+void* operator new(__SIZE_TYPE__, void* __p) throw()
+{
+  return __p;
+}
+
+class PatternDriverTop;
+
+typedef const PatternDriverTop* _Tp;
+
+void construct(_Tp* __p, const _Tp& __val)
+{
+  ::new((void *)__p) _Tp(__val);
+}
+
index ef891e5..e9f315c 100644 (file)
@@ -1997,6 +1997,18 @@ remove_useless_stmts_1 (gimple_stmt_iterator *gsi, struct rus_data *data)
           }
           break;
 
+        case GIMPLE_CHANGE_DYNAMIC_TYPE:
+         /* If we do not optimize remove GIMPLE_CHANGE_DYNAMIC_TYPE as
+            expansion is confused about them and we only remove them
+            during alias computation otherwise.  */
+         if (!optimize)
+           {
+             data->last_was_goto = false;
+             gsi_remove (gsi, false);
+             break;
+           }
+         /* Fallthru.  */
+
         default:
           data->last_was_goto = false;
           gsi_next (gsi);