Thread View: gnu.gcc.bug
1 messages
1 total messages
Started by Brendan Kehoe
Tue, 14 Apr 1992 20:59
gcc 2.1 bug with frame ptr handling
Author: Brendan Kehoe
Date: Tue, 14 Apr 1992 20:59
Date: Tue, 14 Apr 1992 20:59
37 lines
1502 bytes
1502 bytes
The code below on a sparc produces bad code when no opimization is
turned on---note that it uses %fp *after* it's been zero'd out. A
similar program for the DecStation exhibits the same problem. I'm not
sure if this falls under the "gcc bug" section, or under the "really
nasty user trick". Should gcc recognize that you've altered fp and
compensate [if it can]?
This bug came out of the sun4 start.c in the GNU C library failing to
build properly without optimization.
--
/* For mips, change %sp to `sp', and %fp to `$fp'. */
register long int sp asm("%sp"), fp asm("%fp");
foo ()
{
int a;
/* mov 0, %fp */
fp = 0;
/* ld [%sp+16], %o0
st %o0, [%fp-20] */
a = ((int *)sp)[4];
/* ld [%fp-20], %i0 */
return a;
/* When optimized, all of the above becomes the single instruction
ld [%sp+16], %i0
which avoids the problem. */
}
--
Brendan Kehoe, Sun Network Manager brendan@cs.widener.edu
Widener University Chester, PA
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads