aboutsummaryrefslogtreecommitdiff
path: root/SingleSource/Regression/C/gcc-c-torture/execute/pr36321.c
diff options
context:
space:
mode:
Diffstat (limited to 'SingleSource/Regression/C/gcc-c-torture/execute/pr36321.c')
-rw-r--r--SingleSource/Regression/C/gcc-c-torture/execute/pr36321.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/SingleSource/Regression/C/gcc-c-torture/execute/pr36321.c b/SingleSource/Regression/C/gcc-c-torture/execute/pr36321.c
new file mode 100644
index 00000000..fd038a64
--- /dev/null
+++ b/SingleSource/Regression/C/gcc-c-torture/execute/pr36321.c
@@ -0,0 +1,26 @@
+/* { dg-skip-if "requires alloca" { ! alloca } { "-O0" } { "" } } */
+extern void abort (void);
+
+extern __SIZE_TYPE__ strlen (const char *);
+void foo(char *str)
+{
+ int len2 = strlen (str);
+ char *a = (char *) __builtin_alloca (0);
+ char *b = (char *) __builtin_alloca (len2*3);
+
+ if ((int) (a-b) < (len2*3))
+ {
+#ifdef _WIN32
+ abort ();
+#endif
+ return;
+ }
+}
+
+static char * volatile argp = "pr36321.x";
+
+int main(int argc, char **argv)
+{
+ foo (argp);
+ return 0;
+}