This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the EGCS project.
Re: gcc 2.95 optimizer bug?
- To: ramey@csc.ti.com
- Subject: Re: gcc 2.95 optimizer bug?
- From: Mumit Khan <khan@xraylith.wisc.EDU>
- Date: Sat, 31 Jul 1999 20:39:23 -0500
- cc: gcc-bugs@gcc.gnu.org
Joe Ramey <ramey@csc.ti.com> writes:
> I am using gcc 2.95 on a Sun Ultra-2 workstation running Solaris
> 2.5.1. I was compiling the teTeX-1.0 package and found that the mf
> (MetaFont) program was dumping core. When I compiled with gcc 2.8.1 I
> did not have this problem. Also I found that it will dump core if
> compiled with gcc 2.95 using the -O2 option, but not when I am using
> the -O1 option.
Unless I'm missing something very obvious, this should bomb with any
compiler.
First of all, you allocate 100 entries for mem, but then access 1024'th
entry (lomemmax = rover + 1000).
lomemmax = rover + 1000 ;
mem [lomemmax ].hhfield .v.RH = 0 ;
Then, in the following snippet:
{register integer for_end; k = memtop - 2 ;for_end = memtop ; if ( k <=
for_end) do
mem [k ]= mem [lomemmax ];
while ( k++ < for_end ) ;}
k becomes -2 (memtop is initialized to 0), which is obviously a problem.
Did you run this code under a memory debugger?
Feel free to point out if I'm overlooking something fairly obvious here.
Regards,
Mumit