Blame SOURCES/gcc48-pr68680.patch

001c85
2015-12-04  Jakub Jelinek  <jakub@redhat.com>
001c85
001c85
	PR tree-optimization/68680
001c85
	* calls.c (special_function_p): Return ECF_MAY_BE_ALLOCA for
001c85
	BUILT_IN_ALLOCA{,_WITH_ALIGN}.
001c85
001c85
	* gcc.target/i386/pr68680.c: New test.
001c85
001c85
--- gcc/calls.c	(revision 231278)
001c85
+++ gcc/calls.c	(revision 231279)
001c85
@@ -564,6 +564,17 @@ special_function_p (const_tree fndecl, i
001c85
 	flags |= ECF_NORETURN;
001c85
     }
001c85
 
001c85
+  if (DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL)
001c85
+    switch (DECL_FUNCTION_CODE (fndecl))
001c85
+      {
001c85
+      case BUILT_IN_ALLOCA:
001c85
+      case BUILT_IN_ALLOCA_WITH_ALIGN:
001c85
+	flags |= ECF_MAY_BE_ALLOCA;
001c85
+	break;
001c85
+      default:
001c85
+	break;
001c85
+      }
001c85
+
001c85
   return flags;
001c85
 }
001c85
 
001c85
--- gcc/testsuite/gcc.target/i386/pr68680.c	(revision 0)
001c85
+++ gcc/testsuite/gcc.target/i386/pr68680.c	(revision 231279)
001c85
@@ -0,0 +1,15 @@
001c85
+/* PR tree-optimization/68680 */
001c85
+/* { dg-do compile } */
001c85
+/* { dg-options "-O2 -fstack-protector-strong" } */
001c85
+
001c85
+int foo (char *);
001c85
+
001c85
+int
001c85
+bar (unsigned long x)
001c85
+{
001c85
+  char a[x];
001c85
+  return foo (a);
001c85
+}
001c85
+
001c85
+/* Verify that this function is stack protected.  */
001c85
+/* { dg-final { scan-assembler "stack_chk_fail" } } */