aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Sandiford <rsandifo@redhat.com>2004-08-05 07:13:56 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2004-08-05 07:13:56 +0000
commitea5f7a19924085268110c3f0bfa01da3456b4e85 (patch)
tree6da5d9b96b65f4dc9716e0104c3010cbd6600df8 /gcc
parentfce731b52f63132ac56268b256b11acc4f652cbd (diff)
downloadgcc-ea5f7a19924085268110c3f0bfa01da3456b4e85.zip
gcc-ea5f7a19924085268110c3f0bfa01da3456b4e85.tar.gz
gcc-ea5f7a19924085268110c3f0bfa01da3456b4e85.tar.bz2
i386.c (ix86_expand_prologue): If the function uses a frame pointer, restore eax with an ebp-relative address.
* config/i386/i386.c (ix86_expand_prologue): If the function uses a frame pointer, restore eax with an ebp-relative address. From-SVN: r85595
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/config/i386/i386.c9
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20040805-1.c31
4 files changed, 48 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 47916a6..5df2195 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2004-08-05 Richard Sandiford <rsandifo@redhat.com>
+
+ * config/i386/i386.c (ix86_expand_prologue): If the function uses a
+ frame pointer, restore eax with an ebp-relative address.
+
2004-08-04 Geoffrey Keating <geoffk@apple.com>
PR 14516
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 5b37ea8..f05ff5e 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -5399,7 +5399,14 @@ ix86_expand_prologue (void)
if (eax_live)
{
- rtx t = plus_constant (stack_pointer_rtx, allocate);
+ rtx t;
+ if (frame_pointer_needed)
+ t = plus_constant (hard_frame_pointer_rtx,
+ allocate
+ - frame.to_allocate
+ - frame.nregs * UNITS_PER_WORD);
+ else
+ t = plus_constant (stack_pointer_rtx, allocate);
emit_move_insn (eax, gen_rtx_MEM (SImode, t));
}
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 94e6a79..3eadb5a 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2004-08-05 Richard Sandiford <rsandifo@redhat.com>
+
+ * gcc.c-torture/execute/20040805-1.c: New test.
+
2004-08-04 Andrew Pinski <pinskia@physics.uc.edu>
* gcc.dg/20020118-1.c: Declare abort.
diff --git a/gcc/testsuite/gcc.c-torture/execute/20040805-1.c b/gcc/testsuite/gcc.c-torture/execute/20040805-1.c
new file mode 100644
index 0000000..f09fc49
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20040805-1.c
@@ -0,0 +1,31 @@
+#if __INT_MAX__ < 32768 || (defined(STACK_SIZE) && STACK_SIZE < 0x12000)
+int main () { exit (0); }
+#else
+int a[2] = { 2, 3 };
+
+static int __attribute__((noinline))
+bar (int x, void *b)
+{
+ a[0]++;
+ return x;
+}
+
+static int __attribute__((noinline))
+foo (int x)
+{
+ char buf[0x10000];
+ int y = a[0];
+ a[1] = y;
+ x = bar (x, buf);
+ y = bar (y, buf);
+ return x + y;
+}
+
+int
+main ()
+{
+ if (foo (100) != 102)
+ abort ();
+ exit (0);
+}
+#endif