]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
arm.c (arm_get_frame_offsets): Set offsets->locals_base to avoid negative stack size.
authorSeongbae Park <seongbae.park@gmail.com>
Tue, 19 Jun 2007 18:47:09 +0000 (18:47 +0000)
committerSeongbae Park <spark@gcc.gnu.org>
Tue, 19 Jun 2007 18:47:09 +0000 (18:47 +0000)
gcc/ChangeLog:

2007-06-19  Seongbae Park  <seongbae.park@gmail.com>

* config/arm/arm.c (arm_get_frame_offsets): Set
offsets->locals_base to avoid negative stack size.
(thumb1_expand_prologue): Assert on negative stack size.

gcc/testsuite/ChangeLog:

2007-06-19  Seongbae Park  <seongbae.park@gmail.com>

* gcc.target/arm/stack-corruption.c: New test.

From-SVN: r125856

gcc/ChangeLog
gcc/config/arm/arm.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/arm/stack-corruption.c [new file with mode: 0644]

index 7fcbe6c51af2d9c36c3bcf6dd799c40b18812031..8308ee683c7ed7494bdb62b76b8e1688b4e1b023 100644 (file)
@@ -1,3 +1,9 @@
+2007-06-19  Seongbae Park  <seongbae.park@gmail.com>
+
+       * config/arm/arm.c (arm_get_frame_offsets): Set
+       offsets->locals_base to avoid negative stack size.
+       (thumb1_expand_prologue): Assert on negative stack size.
+
 2007-04-11  Sebastian Pop  <sebpop@gmail.com>
 
        PR tree-optimization/32367
index e316f6a4ede071c77b8fd038d1b47b7c7a782322..7cd2cad6bf77ae42fef99fa10b6db7f61f8e6adc 100644 (file)
@@ -11101,6 +11101,7 @@ arm_get_frame_offsets (void)
   if (leaf && frame_size == 0)
     {
       offsets->outgoing_args = offsets->soft_frame;
+      offsets->locals_base = offsets->soft_frame;
       return offsets;
     }
 
@@ -14662,6 +14663,7 @@ thumb1_expand_epilogue (void)
       amount = offsets->locals_base - offsets->saved_regs;
     }
 
+  gcc_assert (amount >= 0);
   if (amount)
     {
       if (amount < 512)
index dd2a1a40e2b12b92fe82bf9f243c3791b59fba20..8afda7faf41b8fe63b4f0c375ef8c63626e9ad2a 100644 (file)
@@ -1,3 +1,7 @@
+2007-06-19  Seongbae Park  <seongbae.park@gmail.com>
+
+       * gcc.target/arm/stack-corruption.c: New test.
+
 2007-06-19  Richard Guenther  <rguenther@suse.de>
 
        * g++.dg/torture/pr30252.C: New testcase.
diff --git a/gcc/testsuite/gcc.target/arm/stack-corruption.c b/gcc/testsuite/gcc.target/arm/stack-corruption.c
new file mode 100644 (file)
index 0000000..3a63950
--- /dev/null
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-O -mthumb -fno-omit-frame-pointer" } */
+
+int main() {
+  return 0;
+}
+
+/* { dg-final { scan-assembler-not "\tadd\tr7, sp, #8\n" } } */