gcc/gcc/testsuite/gcc.dg/pr71585-2.c
Martin Liska 5c846a81ff Mark -fstack-protect as optimization flag.
PR middle-end/71585
	* common.opt (flag_stack_protect): Mark the flag as optimization
	flag.
	* ipa-inline-transform.c (inline_call): Remove unnecessary call
	of build_optimization_node.
	* gcc.dg/pr71585.c: New test.
	* gcc.dg/pr71585-2.c: New test.
	* gcc.dg/pr71585-3.c: New test.

From-SVN: r237845
2016-06-29 12:12:56 +00:00

24 lines
610 B
C

/* Test that stack protection is done on chosen functions. */
/* { dg-do compile { target i?86-*-* x86_64-*-* rs6000-*-* s390x-*-* } } */
/* { dg-options "-O2 -fstack-protector-all" } */
/* This test checks the presence of __stack_chk_fail function in assembler.
* Compiler generates _stack_chk_fail_local (wrapper) calls instead for PIC.
*/
/* { dg-require-effective-target nonpic } */
static int foo()
{
return 0;
}
#pragma GCC push_options
#pragma GCC optimize ("-fno-stack-protector")
int main() { foo (); }
#pragma GCC pop_options
/* { dg-final { scan-assembler-times "stack_chk_fail" 0 } } */