summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/compile/pr34648.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.c-torture/compile/pr34648.c')
-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;
+}
+