aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/mips/mips.h16
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/profile-generate-1.c33
4 files changed, 58 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 675e22b..e9f8b71 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2004-07-14 James E Wilson <wilson@specifixinc.com>
+
+ PR target/16325
+ * config/mips/mips.h (STARTING_FRAME_OFFSET): When flag_profile_value
+ and ! TARGET_64BIT, include REG_PARM_STACK_SPACE.
+
2004-07-15 Jakub Jelinek <jakub@redhat.com>
* expr.c (expand_assignment): Reenable bitfield += optimizations.
diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h
index a4c7be9..c3c5827 100644
--- a/gcc/config/mips/mips.h
+++ b/gcc/config/mips/mips.h
@@ -2132,9 +2132,21 @@ extern enum reg_class mips_char_to_class[256];
#define STACK_GROWS_DOWNWARD
/* The offset of the first local variable from the beginning of the frame.
- See compute_frame_size for details about the frame layout. */
+ See compute_frame_size for details about the frame layout.
+
+ ??? If flag_profile_values is true, and we are generating 32-bit code, then
+ we assume that we will need 16 bytes of argument space. This is because
+ the value profiling code may emit calls to cmpdi2 in leaf functions.
+ Without this hack, the local variables will start at sp+8 and the gp save
+ area will be at sp+16, and thus they will overlap. compute_frame_size is
+ OK because it uses STARTING_FRAME_OFFSET to compute cprestore_size, which
+ will end up as 24 instead of 8. This won't be needed if profiling code is
+ inserted before virtual register instantiation. */
+
#define STARTING_FRAME_OFFSET \
- (current_function_outgoing_args_size \
+ ((flag_profile_values && ! TARGET_64BIT \
+ ? MAX (REG_PARM_STACK_SPACE(NULL), current_function_outgoing_args_size) \
+ : current_function_outgoing_args_size) \
+ (TARGET_ABICALLS && !TARGET_NEWABI \
? MIPS_STACK_ALIGN (UNITS_PER_WORD) : 0))
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index caec9d2..b98486d 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2004-07-14 James E Wilson <wilson@specifixinc.com>
+
+ PR target/16325
+ * gcc.dg/profile-generate-1.c: New.
+
2004-07-15 Jakub Jelinek <jakub@redhat.com>
* gcc.c-torture/execute/20040709-1.c: New test.
diff --git a/gcc/testsuite/gcc.dg/profile-generate-1.c b/gcc/testsuite/gcc.dg/profile-generate-1.c
new file mode 100644
index 0000000..64ebb0e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/profile-generate-1.c
@@ -0,0 +1,33 @@
+/* Bug 16325. */
+/* { dg-options "-O -fprofile-generate" } */
+
+int *p1;
+int *p2;
+int *p3;
+
+int ga = 100;
+
+int
+sub (int i, int j)
+{
+ int k;
+ int l;
+ int m;
+ int n;
+ p1 = &k;
+ p2 = &l;
+ p3 = &m;
+ k = 20;
+ l = 30;
+ m = 40;
+ n = i / j;
+ return n + ga;
+}
+
+int
+main(void)
+{
+ if (sub (99, 33) != 103)
+ abort ();
+ return 0;
+}