This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Long branches with egcs 2.91.66 on LinuxPPC with -O2
- To: gcc-bugs at gcc dot gnu dot org
- Subject: Long branches with egcs 2.91.66 on LinuxPPC with -O2
- From: "Rainer M. Schmid" <rms at trolltech dot com>
- Date: Fri, 27 Oct 2000 14:06:50 +0200
Hi,
there is a problem with egcs version 2.91.66 on LinuxPPC with optimization
-O2. This bug occurs if you try to complie Qt 2.2.1 (which can be
downloaded from ftp://ftp.trolltech.com/qt/source/qt-x11-2.2.1.tar.gz).
Below is a more detailed report by Eric Bischoff (two mails) since I don't
have access to a LinuxPPC. As an attachment there is also the *.ii file of
the problematic file.
If you need more information, please contact me.
Bye, Rainer.
From: Eric Bischoff <ebisch@cybercable.tm.fr>
If I compile the qxml.cpp file with:
g++ -c -I/usr/X11R6/include -I/opt/qt2/include -I/usr/X11R6/include
-pipe -O2 -fPIC -DQT_BUILTIN_GIF_READER=0 -DQT_NO_IMAGEIO_JPEG
-DQT_NO_IMAGEIO_MNG -I/opt/qt2/src/3rdparty/zlib
-I/opt/qt2/src/3rdparty/libpng -o xml/qxml.o
xml/qxml.cpp
on a LinuxPPC 1999 system (Macintosh G3) with egcs version 2.91.66, then
I get the following problem:
{standard input}: Assembler messages:
{standard input}:16492: Error: operand out of range (33172 not between
-32768 and 32767)
{standard input}:27370: Error: operand out of range (-33928 not between
-32768 and 32767)
{standard input}:27394: Error: operand out of range (-33948 not between
-32768 and 32767)
{standard input}:27418: Error: operand out of range (-33908 not between
-32768 and 32767)
but if I remove the optimization flag (-O2) from the command line then I
don't have the problem.
In the source code, the line number 2412 contains
if ( !contentHnd->endElement( "","",tags.pop() ) ) {
and if I change it into
if ( TRUE ) {
then the file compiles. If I just change
tags.pop()
into
0L
then the file does not compile. If I move the boolean expression outside
of the test, the file does not compile either. My conclusion is
a) The problem is in the expression
contentHnd->endElement
OR
b) The size of this whole instruction makes too big displacements in the
surrounding branch instructions (gotos, loop ends and breaks) that do
not fit in the 16 bits allowed by the O2 optimization.
OR
c) something else that is beyond my comprehension.
My instinct tells me that b) is the right solution, but I cannot prove
it.
--------------------------------------------------------------------------
From ebisch@cybercable.tm.fr Sat Oct 21 10:56:14 2000
Here is the extra information you needed. It allowed to find the real
problem.
bash-2.03$ g++ -v -save-temps -c -I/usr/X11R6/include -I/opt/qt2/include
-I/usr/X11R6/include -O2 -pipe -fPIC -DQT_BUILTIN_GIF_READER=0
-DQT_NO_IMAGEIO_JPEG -DQT_NO_IMAGEIO_MNG -I/opt/qt2/src/3rdparty/zlib
-I/opt/qt2/src/3rdparty/libpng -o xml/qxml.o xml/qxml.cpp
g++: Warning: -pipe ignored since -save-temps specified
Reading specs from /usr/lib/gcc-lib/ppc-redhat-linux/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314 (egcs-1.1.2 release)
/usr/lib/gcc-lib/ppc-redhat-linux/egcs-2.91.66/cpp -lang-c++ -v
-I/usr/X11R6/include -I/opt/qt2/include -I/usr/X11R6/include
-I/opt/qt2/src/3rdparty/zlib -I/opt/qt2/src/3rdparty/libpng -undef
-D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=91 -DPPC
-D__ELF__ -Dunix -Dlinux -Dpowerpc -D__PPC__ -D__ELF__ -D__unix__
-D__linux__ -D__powerpc__ -D__PPC -D__unix -D__linux -D__powerpc
-Asystem(unix) -Asystem(linux) -Acpu(powerpc) -Amachine(powerpc)
-D__EXCEPTIONS -D__CHAR_UNSIGNED__ -D__OPTIMIZE__ -D__PIC__=2
-D__pic__=2 -D_CALL_SYSV -D_BIG_ENDIAN -D__BIG_ENDIAN__
-Amachine(bigendian) -D_ARCH_PPC -D__unix__ -D__linux__ -Dunix -Dlinux
-Asystem(unix) -Asystem(linux) -DQT_BUILTIN_GIF_READER=0
-DQT_NO_IMAGEIO_JPEG -DQT_NO_IMAGEIO_MNG xml/qxml.cpp qxml.ii
GNU CPP version egcs-2.91.66 19990314 (egcs-1.1.2 release) (PowerPC
GNU/Linux)
#include "..." search starts here:
#include <...> search starts here:
/usr/X11R6/include
/opt/qt2/include
/usr/X11R6/include
/opt/qt2/src/3rdparty/zlib
/opt/qt2/src/3rdparty/libpng
/usr/include/g++-2
/usr/local/include
/usr/ppc-redhat-linux/include
/usr/lib/gcc-lib/ppc-redhat-linux/egcs-2.91.66/include
/usr/include
End of search list.
/usr/lib/gcc-lib/ppc-redhat-linux/egcs-2.91.66/cc1plus qxml.ii -quiet
-dumpbase qxml.cc -O2 -version -fPIC -o qxml.s
GNU C++ version egcs-2.91.66 19990314 (egcs-1.1.2 release)
(ppc-redhat-linux) compiled by GNU C version egcs-2.91.66 19990314
(egcs-1.1.2 release).
as -mppc -V -Qy -K PIC -o xml/qxml.o qxml.s
GNU assembler version 990418 (ppc-redhat-linux) using BFD version 990418
qxml.s: Assembler messages:
qxml.s:16492: Error: operand out of range (33212 not between -32768 and
32767)
qxml.s:27381: Error: operand out of range (-33968 not between -32768 and
32767)
qxml.s:27405: Error: operand out of range (-33988 not between -32768 and
32767)
qxml.s:27429: Error: operand out of range (-33948 not between -32768 and
32767)
The qxml.ii and qxml.s files are attached. In qxml.s, the guilty
assembly language lines are:
16492: bc 12,2,.L26033
27381: bc 4,2,.L19184
27405: bc 4,2,.L19182
27429: bc 4,2,.L19293
Four branch instructions! We guessed right: the -O2 optimization flag
provokes an attempt to use short branches to labels that are too far
away.
Another test tells me the first branch matches the "goto" instruction a
few lines above. The three other ones might correspond to "break"
instructions below, but I'm not sure.
So here are the options we have:
WORKAROUNDS:
a) find the way to compile this single file without the -O2 flag
b) use function calls or other tricks to make the "case" instructions
smaller
FIXES:
c) forward this detailed description of the bug
qxml.ii.bz2