summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/opt/crash1.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/opt/crash1.C')
-rw-r--r--gcc/testsuite/g++.dg/opt/crash1.C14
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/opt/crash1.C b/gcc/testsuite/g++.dg/opt/crash1.C
new file mode 100644
index 00000000000..3526df1ddc9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/crash1.C
@@ -0,0 +1,14 @@
+// PR opt/13681
+// Here we have an out-of-range array index. We should not abort
+// trying to resolve the indirection back to an object.
+
+struct X {
+ double values[1];
+ double & foo (const unsigned int index) { return values[index]; }
+};
+
+void foo() {
+ double d;
+ X h1;
+ h1.foo(1) = d;
+}