summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture
diff options
context:
space:
mode:
authoramacleod <amacleod@138bc75d-0d04-0410-961f-82ee72b054a4>2008-01-17 21:37:14 +0000
committeramacleod <amacleod@138bc75d-0d04-0410-961f-82ee72b054a4>2008-01-17 21:37:14 +0000
commitea5876d9652f9179392d414cb81898b8594ede3c (patch)
treee495590c621364970717dfc05ae84e3e64453da3 /gcc/testsuite/gcc.c-torture
parentd5f9ff99f6f17a9b76e049e9f64e3cf808098f33 (diff)
downloadgcc-ea5876d9652f9179392d414cb81898b8594ede3c.tar.gz
http://gcc.gnu.org/ml/gcc-patches/2008-01/msg00764.html
Teach SCCVN that throwing expressions are not to be regenerated. 2008-01-17 Andrew MacLeod <amacleod@redhat.com> * tree-ssa-sccvn.c (visit_use): Expressions which can throw are varying. * gcc.c-torture/compile/pr34648.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@131610 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.c-torture')
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr34648.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr34648.c b/gcc/testsuite/gcc.c-torture/compile/pr34648.c
new file mode 100644
index 00000000000..1f7472fe76d
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr34648.c
@@ -0,0 +1,39 @@
+/* PR tree-optimization/34648 */
+
+/* { dg-do compile } */
+/* { dg-options "-O2 -fexceptions" } */
+
+extern const unsigned short int **bar (void) __attribute__ ((const));
+const char *a;
+int b;
+char c;
+
+char
+foo (int *x)
+{
+ char r;
+
+ c = '\0';
+ if (!b)
+ {
+ while (((*bar ())[a[*x]] & 0x2000) != 0)
+ (*x)++;
+ if (a[++(*x)] == '-')
+ {
+ (*x)++;
+ if (a[*x] && !((*bar ())[a[*x]] & 0x2000))
+ return '?';
+ }
+ if (!a[*x] || ((*bar ())[a[*x]] & 0x2000))
+ {
+ while (((*bar ())[a[*x]] & 0x2000))
+ ++(*x);
+ return '\0';
+ }
+ }
+
+ r = a[*x];
+ b = a[*x] && !((*bar ())[a[*x]] & 0x2000);
+ return r;
+}
+