From: wilson Date: Thu, 15 Jul 2004 00:35:28 +0000 (+0000) Subject: Fix MIPS SPEC95 FP 146.wave5 -fprofile-generate failure. X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=commitdiff_plain;h=d529383ecd8208de3bc5df588a8615931312780b;ds=sidebyside Fix MIPS SPEC95 FP 146.wave5 -fprofile-generate failure. PR target/16325 * config/mips/mips.h (STARTING_FRAME_OFFSET): When flag_profile_value and ! TARGET_64BIT, include REG_PARM_STACK_SPACE. * gcc.dg/profile-generate-1.c: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@84727 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 675e22b5a6b..e9f8b71bc62 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2004-07-14 James E Wilson + + 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 * expr.c (expand_assignment): Reenable bitfield += optimizations. diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h index a4c7be938f1..c3c58278153 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 caec9d27bf0..b98486d19ae 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2004-07-14 James E Wilson + + PR target/16325 + * gcc.dg/profile-generate-1.c: New. + 2004-07-15 Jakub Jelinek * 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 00000000000..64ebb0e3a5e --- /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; +}