Blame SOURCES/gcc48-pr68680.patch

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