This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
gcc-2.95.2 crash when optimizing
- To: gnu-gcc-bug at moderators dot isc dot org
- Subject: gcc-2.95.2 crash when optimizing
- From: Kurt Skauen <kurt dot skauen at c2i dot net>
- Date: Wed, 12 Jan 2000 06:07:51 GMT
- Newsgroups: gnu.gcc.bug
- Organization: Tele2 Norway AS Public Access
Hi, I'm developing a new OS, and has used the gcc
C and C++ compiler during development. The first
version I used was 2.7, and has since upgraded
every now and then. Starting with egcs-1.1.2, I started
to get problems (egcs-1.1b worked fine). When I give both
-fPIC and -O[123456], the compiler generated (for some files,
both C and C++) assambly output that whould make the assambler
crash (binutils 2.9.1). I have know upgraded to gcc-2.95.2,
and the assambler crashes dissapered, and I was a happy man again.
The problem was not solved though, cause when trying to recompile
glibc-2.1.2 with the new compiler, it started to crash :( Not the
assembler this time, but the compiler itself (cc1). I then tried
to recompile the compiler with optimizing, and that failed to.
(First file that crashed it was fold-const.c in gcc.) I figured
that if I gave "-fno-inline -fno-default-inline" in addition to
-O3 it would not crash anymore. I suspect that the compiler work
fine on other OS's like linux :), so the problem is most likely
my in OS. Everything else seems to run just fine though so I
don't know where to start. Is there anyone out there that know
the compiler sources well enough that they can help me out on
this one? I know there is very little information in this post
(I don't have any fancy debugger tools available for the OS) but
if someone is willing too give it a shot I will try to fill in
the missing spots as they shows up.
Here is a snippet from the kernel log during a cc1 crash.
It gives a register dump and a stack trace:
This part is the register dump telling that it tried to read
address 0x00000e73 from user space (same value as in the EAX register)
This failed since all addresses below 2G is owned by the kernel.
1:cc1::cc1 : *** KERNEL AREA FOR ADDRESS 00000e73 ACCESSED FROM USER-SPACE
1:cc1::cc1 : Invalid pagefault at 00000e73 (PROTV:READ:USER)
1:cc1::cc1 : EAX = 00000e73 : EBX = 00000000 : ECX = 00003e94 : EDX = 806e7488
1:cc1::cc1 : ESI = 00000036 : EDI = 00000036 : EBP = ffffaaa8
1:cc1::cc1 : SS::ESP = 0023::ffffaa70
1:cc1::cc1 : CS::EIP = 0013::8010e171
1:cc1::cc1 : DS = 0023 : ES = 0023 : FS = 0023 : GS = 0070
1:cc1::cc1 : EFLAGS = 00213202 (IF RF ID )
1:cc1::cc1 : CPU ID = 1
Here is the stack trace (Applications are loaded at 0x80000000):
1:cc1::cc1 : 0 -> 8010e171
1:cc1::cc1 : cc1 + 0010e171 -> rtx_equal_p + 00000039
1:cc1::cc1 : 1 -> 801fbb0b
1:cc1::cc1 : cc1 + 001fbb0b -> validate_change + 00000027
1:cc1::cc1 : 2 -> 8014d442
1:cc1::cc1 : cc1 + 0014d442 -> subst_constants + 000003de
1:cc1::cc1 : 3 -> 8014d9f6
1:cc1::cc1 : cc1 + 0014d9f6 -> subst_constants + 00000992
1:cc1::cc1 : 4 -> 8014d56c
1:cc1::cc1 : cc1 + 0014d56c -> subst_constants + 00000508
1:cc1::cc1 : 5 -> 8014d9f6
1:cc1::cc1 : cc1 + 0014d9f6 -> subst_constants + 00000992
1:cc1::cc1 : 6 -> 8014d5dd
0:cc1::cc1 : cc1 + 0014d5dd -> subst_constants + 00000579
0:cc1::cc1 : 7 -> 8014d08c
0:cc1::cc1 : cc1 + 0014d08c -> try_constants + 00000028
0:cc1::cc1 : 8 -> 8014b616
0:cc1::cc1 : cc1 + 0014b616 -> expand_inline_function + 00001342
0:cc1::cc1 : 9 -> 800ead21
0:cc1::cc1 : cc1 + 000ead21 -> expand_call + 000003a9
0:cc1::cc1 : 10 -> 800dd8ec
0:cc1::cc1 : cc1 + 000dd8ec -> expand_expr + 00003134
0:cc1::cc1 : 11 -> 800c7f3a
0:cc1::cc1 : cc1 + 000c7f3a -> expand_return + 0000070a
0:cc1::cc1 : 12 -> 80266e01
0:cc1::cc1 : cc1 + 00266e01 -> c_expand_return + 000002c1
0:cc1::cc1 : 13 -> 8024a427
0:cc1::cc1 : cc1 + 0024a427 -> yyparse + 00004277
0:cc1::cc1 : 14 -> 8009d394
0:cc1::cc1 : cc1 + 0009d394 -> compile_file + 00000c88
0:cc1::cc1 : 15 -> 800a10fb
0:cc1::cc1 : cc1 + 000a10fb -> main + 00001237
0:cc1::cc1 : 16 -> 802eb378
0:cc1::cc1 : libc.so.1 + 00018378 -> __libc_start_main + 000000c0
0:cc1::cc1 : 17 -> 8009ac95
0:cc1::cc1 : cc1 + 0009ac95 -> _start + 00000025
Some info on the software involved:
gcc 2.95.2 (Tried both with and without the HAIFA scheduler)
binutils 2.9.1
glibc 2.1.2
Take a look at my web server for more info on the OS (http://altos.funcom.com)
I also tried to install gcc 2.95, but it did the same stunt as 2.95.2
I have compiled the compiler both with gcc 2.95/2.95.2 and egcs 1.1.2
with the same result.
I have figured out that if I replace the
#define errno (*__errno_location())
with
extern int errno;
in <errno.h> it will stop the compiler from crashing
on some files, but not all.
I have not (yet) been able to create a minimal source that will crash
the compiler, but if I do, I will post it here. Please ask if you need
some more info.
--
Kurt Skauen
Author of AltOS (http://altos.funcom.com/)