From a11e0df4da7c987c9627724748fe727183e9379f Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Wed, 25 May 2011 11:00:14 +0000 Subject: common.opt (flag_stack_usage_info): New variable. * common.opt (flag_stack_usage_info): New variable. (-Wstack-usage): New option. * doc/invoke.texi (Warning options): Document -Wstack-usage. * opts.c (common_handle_option) : New case. : Likewise. * toplev.c (output_stack_usage): Handle -Wstack-usage. * calls.c (expand_call): Test flag_stack_usage_info variable instead of flag_stack_usage. (emit_library_call_value_1): Likewise. * explow.c (allocate_dynamic_stack_space): Likewise. * function.c (instantiate_virtual_regs ): Likewise. (prepare_function_start): Likewise. (rest_of_handle_thread_prologue_and_epilogue): Likewise. * config/alpha/alpha.c (alpha_expand_prologue): Likewise. * config/arm/arm.c (arm_expand_prologue): Likewise. (thumb1_expand_prologue): Likewise. * config/avr/avr.c (expand_prologue): Likewise. * config/i386/i386.c (ix86_expand_prologue): Likewise. * config/ia64/ia64.c (ia64_expand_prologue): Likewise. * config/m68k/m68k.c (m68k_expand_prologue): Likewise. * config/mips/mips.c (mips_expand_prologue): Likewise. * config/pa/pa.c (hppa_expand_prologue): Likewise. * config/rs6000/rs6000.c (rs6000_emit_prologue): Likewise. * config/s390/s390.c (s390_emit_prologue): Likewise. * config/sh/sh.c (sh_expand_prologue): Likewise. * config/sparc/sparc.c (sparc_expand_prologue): Likewise. * config/spu/spu.c (spu_expand_prologue): Likewise. From-SVN: r174182 --- gcc/testsuite/gcc.dg/stack-usage-2.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/stack-usage-2.c (limited to 'gcc/testsuite/gcc.dg/stack-usage-2.c') diff --git a/gcc/testsuite/gcc.dg/stack-usage-2.c b/gcc/testsuite/gcc.dg/stack-usage-2.c new file mode 100644 index 0000000..d3c17a8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/stack-usage-2.c @@ -0,0 +1,33 @@ +/* { dg-do compile } */ +/* { dg-options "-Wstack-usage=512" } */ + +int foo1 (void) +{ + char arr[16]; + arr[0] = 1; + return 0; +} /* { dg-bogus "stack usage" } */ + +int foo2 (void) +{ + char arr[1024]; + arr[0] = 1; + return 0; +} /* { dg-warning "stack usage is \[0-9\]* bytes" } */ + +int foo3 (void) +{ + char arr[1024] __attribute__((aligned (512))); + arr[0] = 1; + /* Force dynamic realignment of argument pointer. */ + __builtin_apply ((void (*)()) foo2, 0, 0); + return 0; + +} /* { dg-warning "stack usage might be \[0-9\]* bytes" } */ + +int foo4 (int n) +{ + char arr[n]; + arr[0] = 1; + return 0; +} /* { dg-warning "stack usage might be unbounded" } */ -- cgit v1.1