gcc 2.95 optimizer bug?
Mumit Khan
khan@xraylith.wisc.EDU
Sun Aug 1 10:55:00 GMT 1999
Joe Ramey <ramey@csc.ti.com> writes:
>
> Ok, here's a fixed version of the program that no longer has these
> illegal accesses, but still dumps core with a Bus Error. I took your
> suggestion and ran the code under a memory debugger (Purify). It
> found 6 problems with the version of the code that I sent in before,
> but this version comes through cleanly. Again, the program gets a Bus
> Error if I compile with -O2, but with -O1 it runs with no error, and
> compiling with gcc 2.8.1 -O2 also produces code that runs with no
> error.
>
> FYI I also compiled with -O2 -g and then ran the program under gdb.
> It dies here:
>
> Program received signal SIGBUS, Bus error.
> 0x10c98 in inittab () at trybug.c:120
> 120 hashused = 9757 ;
> (gdb)
>
> That was my first clue that something very strange is going on, since
> it's not dying on a line that looks like the typical bus error point
> (dereference a null pointer, divide by zero maybe, stuff like that).
>
> So again here's the C code (the fixed version) that seems to
> demonstrate the problem.
Thanks. I can reproduce it on a sparc-sun-solaris2.5.1, but not on
a i686-pc-linux-gnu. Perhaps a platform specific bug? I'll take a
look at the assembly later to see if I can spot anything.
The only workaround I see is to use -fno-gcse.
Regards,
Mumit
More information about the Gcc-bugs
mailing list