public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/11753] New: %o7 register being used immediately in the delay slot before a call with -O2
@ 2003-07-31 18:51 warren_baird at cimmetry dot com
  2003-07-31 18:53 ` [Bug optimization/11753] " warren_baird at cimmetry dot com
                   ` (17 more replies)
  0 siblings, 18 replies; 19+ messages in thread
From: warren_baird at cimmetry dot com @ 2003-07-31 18:51 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11753

           Summary: %o7 register being used immediately in the delay slot
                    before a call with -O2
           Product: gcc
           Version: 3.2.2
            Status: UNCONFIRMED
          Severity: critical
          Priority: P1
         Component: optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: warren_baird at cimmetry dot com
                CC: gcc-bugs at gcc dot gnu dot org

gcc -v output:
Reading specs from /usr/local/gcc-3.2.2/lib/gcc-lib/sparc-sun-solaris2.8/3.2.2/specs
Configured with: ../gcc-3.2.2/configure --prefix=/usr/local/gcc-3.2.2
--with-gnu-as --with-gnu-ld --with-gnu-nm
--with-as=/usr/local/binutils-2.13.2.1/bin/as
--with-ld=/usr/local/binutils-2.13.2.1/bin/ld
--with-nm=/usr/local/binutils-2.13.2.1/bin/nm
Thread model: posix
gcc version 3.2.2


if you compile the attached .i file with -O2 optimization:

    gcc -c -O2 -S bug_o7.i

And you look around line 414 of the bug_o7.s file you should see code
like this:

	mov	1, %i0
	call	free, 0
	add	%o7, (.LL1-.-4), %o7


The problem here is that on a sparc system register %o7 is used to
pass the return address to a function, and since we're modifying it in
the delay slot, %o7 is modified just before the call to free, and when
free tries to return it jumps back to a different piece of code and
crashes almost immediately.

If I compile with -O1 it doesn't generate this construct.  Also, if I
try to remove almost any code from the function it doesn't generate
this construct.  It looks to me like it is only under fairly rare
circumstances that the optimizer produces this particular error.


^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2003-12-09 20:26 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-31 18:51 [Bug optimization/11753] New: %o7 register being used immediately in the delay slot before a call with -O2 warren_baird at cimmetry dot com
2003-07-31 18:53 ` [Bug optimization/11753] " warren_baird at cimmetry dot com
2003-07-31 19:05 ` pinskia at physics dot uc dot edu
2003-08-01  7:26 ` ebotcazou at gcc dot gnu dot org
2003-08-01  7:28 ` ebotcazou at gcc dot gnu dot org
2003-08-01  7:29 ` ebotcazou at gcc dot gnu dot org
2003-08-01 13:28 ` warren_baird at cimmetry dot com
2003-09-05 14:17 ` ebotcazou at gcc dot gnu dot org
2003-09-05 22:10 ` warren_baird at cimmetry dot com
2003-09-06 11:38 ` ebotcazou at gcc dot gnu dot org
2003-09-08 22:26 ` warren_baird at cimmetry dot com
2003-09-10 14:37 ` ebotcazou at gcc dot gnu dot org
2003-09-17 16:18 ` warren_baird at cimmetry dot com
2003-10-01  6:08 ` cvs-commit at gcc dot gnu dot org
2003-10-01  6:15 ` cvs-commit at gcc dot gnu dot org
2003-10-01  6:20 ` pinskia at gcc dot gnu dot org
2003-10-01  6:23 ` ebotcazou at gcc dot gnu dot org
2003-12-09 18:14 ` dhazeghi at yahoo dot com
2003-12-09 20:26 ` ebotcazou at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).