aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/opt/emptyunion.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/opt/emptyunion.C')
-rw-r--r--gcc/testsuite/g++.dg/opt/emptyunion.C13
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/opt/emptyunion.C b/gcc/testsuite/g++.dg/opt/emptyunion.C
new file mode 100644
index 00000000000..105faed5844
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/emptyunion.C
@@ -0,0 +1,13 @@
+// PR optimization/11059
+// This testcase ICEd because clear_by_pieces was called with zero length.
+// { dg-do compile }
+// { dg-options "-O2" }
+
+union uni {};
+
+int main() {
+ uni *h;
+
+ h = (uni *)new uni();
+}
+