This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: gcc 2.95 optimizer bug?
- To: ramey at csc dot ti dot com
- Subject: Re: gcc 2.95 optimizer bug?
- From: Mumit Khan <khan at xraylith dot wisc dot EDU>
- Date: Sun, 01 Aug 1999 11:44:22 -0500
- cc: gcc-bugs at gcc dot gnu dot org
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