aboutsummaryrefslogtreecommitdiff
path: root/SingleSource/Regression/C/gcc-c-torture/execute/pr34415.c
diff options
context:
space:
mode:
Diffstat (limited to 'SingleSource/Regression/C/gcc-c-torture/execute/pr34415.c')
-rw-r--r--SingleSource/Regression/C/gcc-c-torture/execute/pr34415.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/SingleSource/Regression/C/gcc-c-torture/execute/pr34415.c b/SingleSource/Regression/C/gcc-c-torture/execute/pr34415.c
new file mode 100644
index 00000000..ec75394a
--- /dev/null
+++ b/SingleSource/Regression/C/gcc-c-torture/execute/pr34415.c
@@ -0,0 +1,34 @@
+const char *__attribute__((noinline))
+foo (const char *p)
+{
+ const char *end;
+ int len = 1;
+ for (;;)
+ {
+ int c = *p;
+ c = (c >= 'a' && c <= 'z' ? c - 'a' + 'A' : c);
+ if (c == 'B')
+ end = p;
+ else if (c == 'A')
+ {
+ end = p;
+ do
+ p++;
+ while (*p == '+');
+ }
+ else
+ break;
+ p++;
+ len++;
+ }
+ if (len > 2 && *p == ':')
+ p = end;
+ return p;
+}
+
+int
+main (void)
+{
+ const char *input = "Bbb:";
+ return foo (input) != input + 2;
+}