- To: egcs-bugs at cycnus dot com
- Subject: Inlining segfault
- From: Bill Currie <bill at taniwha dot tssc dot co dot nz>
- Date: Sun, 26 Jul 1998 16:25:39 +1200
Using a cvs snapshot from ~2100 25/7/98 NZST configured for
i486-pc-linux-gnu, I get an internal error from gcc using the following
command (in the build dir of gcc)
./xgcc -B./ -O2 -c foo.c -v
Reading specs from ./specs
gcc version egcs-2.91.51 19980725 (gcc2 ss-980609 experimental)
./cpp -lang-c -v -isystem ./include -undef -D__GNUC__=2
-D__GNUC_MINOR__=91 -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__
-D__linux__ -D__unix -D__linux -Asystem(posix) -D__OPTIMIZE__
-Asystem(unix) -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__
-Di486 -D__i486 -D__i486__ foo.c /tmp/ccXpzZFf.i
GNU CPP version egcs-2.91.51 19980725 (gcc2 ss-980609 experimental)
(i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
include
/usr/local/include
/usr/local/i486-pc-linux-gnu/include
/usr/include
End of search list.
./cc1 /tmp/ccXpzZFf.i -quiet -dumpbase foo.c -O2 -version -o
/tmp/ccMUZBy3.s
GNU C version egcs-2.91.51 19980725 (gcc2 ss-980609 experimental)
(i486-pc-linux-gnu) compiled by GNU C version egcs-2.91.47 19980709
(gcc2 ss-980609 experimental).
xgcc: Internal compiler error: program cc1 got fatal signal 11
---foo.c---
static __inline__ unsigned char BCD(unsigned char binval)
{
if (binval > 99) return 0x99;
return (((binval/10) << 4) | (binval%10));
}
void int1a(unsigned char i)
{
(*((unsigned char *)1)) = BCD(i);
}
-----------
If either line in BCD is commented out or the pointer/cast assignment is
changed to a variable (eg i), the error disappears. Also, the error
does not occur for optimisation levels less than 2 (ie -O0 and -O1
successfully compile the code).
Bill
--
Leave others their otherness.