aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2011-05-25 11:00:14 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2011-05-25 11:00:14 +0000
commita11e0df4da7c987c9627724748fe727183e9379f (patch)
tree8f263f60484dabe77a13c389e9ce210b121dbc56 /gcc/testsuite
parente7cfe2413fe50e22eb2c013415cec9e154d3c391 (diff)
downloadgcc-a11e0df4da7c987c9627724748fe727183e9379f.zip
gcc-a11e0df4da7c987c9627724748fe727183e9379f.tar.gz
gcc-a11e0df4da7c987c9627724748fe727183e9379f.tar.bz2
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) <OPT_Wstack_usage_>: New case. <OPT_fstack_usage>: 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
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/stack-usage-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/stack-usage-2.c33
3 files changed, 39 insertions, 1 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index af20a3e..7e18785 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2011-05-25 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc.dg/stack-usage-1.c: Adjust comment.
+ * gcc.dg/stack-usage-2.c: New test.
+
2011-05-25 Jakub Jelinek <jakub@redhat.com>
PR c++/49136
diff --git a/gcc/testsuite/gcc.dg/stack-usage-1.c b/gcc/testsuite/gcc.dg/stack-usage-1.c
index 321fec7..f55168e 100644
--- a/gcc/testsuite/gcc.dg/stack-usage-1.c
+++ b/gcc/testsuite/gcc.dg/stack-usage-1.c
@@ -2,7 +2,7 @@
/* { dg-options "-fstack-usage" } */
/* This is aimed at testing basic support for -fstack-usage in the back-ends.
- See the SPARC back-end for an example (grep flag_stack_usage in sparc.c).
+ See the SPARC back-end for example (grep flag_stack_usage_info in sparc.c).
Once it is implemented, adjust SIZE below so that the stack usage for the
function FOO is reported as 256 or 264 in the stack usage (.su) file.
Then check that this is the actual stack usage in the assembly file. */
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" } */