Bug 25642 - optimizer bug: registers are clobbered but not restored
Summary: optimizer bug: registers are clobbered but not restored
Status: RESOLVED WORKSFORME
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.0.3
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2006-01-02 19:22 UTC by Wouter Verhelst
Modified: 2006-03-13 23:19 UTC (History)
1 user (show)

See Also:
Host: m68k-linux-gnu
Target: m68k-linux-gnu
Build: m68k-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:


Attachments
preprocessed source (118.47 KB, text/plain)
2006-01-02 19:27 UTC, Wouter Verhelst
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Wouter Verhelst 2006-01-02 19:22:19 UTC
Hi,

As explained in Debian bug#345574 (http://bugs.debian.org/345574), g++ fails to build cppunit due to a test suite failure. Debugging this, I found that the compiler produces code which assumes that no register inside the called function will clobber any register.

As it turns out, that's an incorrect assumption.

wouter@jazz:~$ g++ --version
g++ (GCC) 4.0.3 20051201 (prerelease) (Debian 4.0.2-5)
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
wouter@jazz:~$ g++ -v
Using built-in specs.
Target: m68k-linux-gnu
Configured with: ../src/configure -v --enable-languages=c,c++,java,f95,objc,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --program-suffix=-4.0 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-4.0-1.4.2.0/jre --enable-mpfr --disable-werror --enable-checking=release m68k-linux-gnu
Thread model: posix
gcc version 4.0.3 20051201 (prerelease) (Debian 4.0.2-5)

g++ -DHAVE_CONFIG_H -I. -I. -I../../config -I../../include -I../../include    -g3 -gdwarf-2 -O2 -MT XmlUniformiser.o -MD -MP -MF ".deps/XmlUniformiser.Tpo" -c -o XmlUniformiser.o XmlUniformiser.cpp
Comment 1 Wouter Verhelst 2006-01-02 19:27:19 UTC
Created attachment 10576 [details]
preprocessed source
Comment 2 Wouter Verhelst 2006-01-04 19:51:27 UTC
(In reply to comment #0)
> I found that the
> compiler produces code which assumes that no register inside the called
> function will clobber any register.

Uh -- for clarity, I meant to say "that no code inside the called function will clobber any register" here...
Comment 3 Andreas Schwab 2006-03-13 23:19:23 UTC
The ABI guarantees that register a5 is preserved across calls.  I can't see anything violating this assumption.