This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
MIPS branching too far
- To: gcc-bugs at gcc dot gnu dot org
- Subject: MIPS branching too far
- From: "Colin Burgess" <cburgess at qnx dot com>
- Date: Thu, 20 Sep 2001 16:23:03 -0400 (edt)
I think I've found a problem with the mips compiler (at least
in 2.95.2, and I think it's still in the latest as well).
There's a file in mozilla called nsPrefMigration.cpp that has a
method called ProcessPrefsCallback. This (at least on our
system, which is QNX Neutrino 6.1 using the Dinkum C++ headers)
tickles a nasty bug.
Basically, the problem is this...
Say you have a function of the form...
int func(void)
{
lots of objects created on stack
int ret;
ret = some_func_1();
if ( ret & condition ) return ret;
...
ret = some_func_n();
if ( ret & condition ) return ret;
return ret;
}
then the compiler (without optimising) produces something like
func prologue
run object constructors
call some_func_1
test and jump to label2
run object destructors
jmp to label1
label2:
call some_func_2
test and jump to label3
run object destructors
jmp to label1
...
label1:
func epilogue
Now the problem I'm seeing is that since I'm compiling this PIC,
then the jmp to label1 is being transformed by the assembler into
a branch, and the jump distance is just too long for a branch.
So my first question is: is this a bug in cc1plus, as or both?
And more to the point - has anyone got any good ideas about how
to fix this?
Thanks for any help,
Colin Burgess
--
cburgess@qnx.com