This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the EGCS project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: gcc 2.95 optimizer bug?


   cc: gcc-bugs@gcc.gnu.org
   Date: Sat, 31 Jul 1999 20:39:23 -0500
   From: Mumit Khan <khan@xraylith.wisc.EDU>

   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

Thanks for the quick reply.

The mistake is mine.  I made the bad mistake of trying to take a large
program like Metafont and cutting out the code fragment which exhibits
the problem.  I didn't do a very good job of it I'm afraid.  I will
check more carefully before I resubmit this report.

Sorry to trouble you.

Joe


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]