]> 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>
Thu, 28 Jun 2007 20:47:14 +0000 (20:47 +0000)
committerSeongbae Park <spark@gcc.gnu.org>
Thu, 28 Jun 2007 20:47:14 +0000 (20:47 +0000)
gcc/ChangeLog:

2007-06-28  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-28  Seongbae Park  <seongbae.park@gmail.com>

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

From-SVN: r126094

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

index 28989b2b174e4fe24eccd019c526fb58f1450149..050623a024065d76108c735845766213bea5d19a 100644 (file)
@@ -1,3 +1,9 @@
+2007-06-28  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-06-28  Jakub Jelinek  <jakub@redhat.com>
 
        * config/rs6000/rs6000.c (rs6000_function_ok_for_sibcall): Ensure
index 355e433cbf0a691f7978448b7469178906e33b49..a74d5139332e49d42fff27cb253daa5706ac21d2 100644 (file)
@@ -10453,6 +10453,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;
     }
 
@@ -13782,6 +13783,7 @@ thumb_expand_epilogue (void)
       amount = offsets->locals_base - offsets->saved_regs;
     }
 
+  gcc_assert (amount >= 0);
   if (amount)
     {
       if (amount < 512)
index 208e276029e50b5f811808bc7070486adf1b57da..e540725a14cac96dffeaa96b8e8037751fc65f6e 100644 (file)
@@ -1,3 +1,7 @@
+2007-06-28  Seongbae Park  <seongbae.park@gmail.com>
+
+       * gcc.target/arm/stack-corruption.c: New test.
+
 2007-06-21  Uros Bizjak  <ubizjak@gmail.com>
  
        PR target/32389
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" } } */