This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the EGCS project.
gcc 2.95 optimizer bug?
- To: gcc-bugs@gcc.gnu.org
- Subject: gcc 2.95 optimizer bug?
- From: Joe Ramey <ramey@csc.ti.com>
- Date: Sat, 31 Jul 1999 19:41:56 -0500 (CDT)
- Reply-to: ramey@csc.ti.com
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.
I was able to simplify it down to the following code fragment. If I
compile this code fragment with:
gcc -O2 -o trybug trybug.c
then the resulting program dumps core. If I compile with
gcc -O1 -o trybug trybug.c
then the program does not dump core.
Please let me know what else I can send you to help with debugging
this problem.
Joe Ramey
Texas Instruments
ramey@ti.com
------------------------------------------------------------------------------
#include <malloc.h>
typedef long integer;
typedef integer halfword ;
typedef unsigned char quarterword ;
typedef integer strnumber ;
typedef struct
{
struct
{
quarterword B0, B1, B2, B3;
} u;
} fourquarters;
typedef union
{
struct
{
halfword RH, LH;
} v;
struct
{
halfword junk;
short B0, B1;
} u;
} twohalves;
typedef union
{
twohalves hhfield;
integer cint;
fourquarters qqqq;
} memoryword;
integer memtop ;
halfword memend ;
integer varused ;
memoryword * mem ;
halfword hashused ;
halfword himemmin ;
twohalves eqtb[9770] ;
halfword rover ;
twohalves hash[9770] ;
strnumber intname[( 300 ) + 1] ;
halfword lomemmax ;
void inittab();
main()
{
mem= calloc(100, sizeof (memoryword));
inittab();
}
void
inittab ( )
{
integer k ;
rover = 23 ;
mem [rover ].hhfield .v.RH = 268435455L ;
mem [rover ].hhfield .v.LH = 1000 ;
mem [rover + 1 ].hhfield .v.LH = rover ;
mem [rover + 1 ].hhfield .v.RH = rover ;
lomemmax = rover + 1000 ;
mem [lomemmax ].hhfield .v.RH = 0 ;
mem [lomemmax ].hhfield .v.LH = 0 ;
{register integer for_end; k = memtop - 2 ;for_end = memtop ; if ( k <=
for_end) do
mem [k ]= mem [lomemmax ];
while ( k++ < for_end ) ;}
memend = memtop ;
himemmin = memtop - 2 ;
varused = 23 ;
intname [1 ]= 408 ;
intname [2 ]= 409 ;
intname [3 ]= 410 ;
intname [4 ]= 411 ;
intname [5 ]= 412 ;
intname [6 ]= 413 ;
intname [7 ]= 414 ;
intname [8 ]= 415 ;
intname [9 ]= 416 ;
intname [10 ]= 417 ;
intname [11 ]= 418 ;
intname [12 ]= 419 ;
intname [13 ]= 420 ;
intname [14 ]= 421 ;
intname [15 ]= 422 ;
intname [16 ]= 423 ;
intname [17 ]= 424 ;
intname [18 ]= 425 ;
intname [19 ]= 426 ;
intname [20 ]= 427 ;
intname [21 ]= 428 ;
intname [22 ]= 429 ;
intname [23 ]= 430 ;
intname [24 ]= 431 ;
intname [25 ]= 432 ;
intname [26 ]= 433 ;
intname [27 ]= 434 ;
intname [28 ]= 435 ;
intname [29 ]= 436 ;
intname [30 ]= 437 ;
intname [31 ]= 438 ;
intname [32 ]= 439 ;
intname [33 ]= 440 ;
intname [34 ]= 441 ;
intname [35 ]= 442 ;
intname [36 ]= 443 ;
intname [37 ]= 444 ;
intname [38 ]= 445 ;
intname [39 ]= 446 ;
intname [40 ]= 447 ;
intname [41 ]= 448 ;
hashused = 9757 ;
hash [9768 ].v.RH = 450 ;
hash [9766 ].v.RH = 451 ;
hash [9767 ].v.RH = 452 ;
hash [9765 ].v.RH = 453 ;
hash [9764 ].v.RH = 454 ;
hash [9763 ].v.RH = 59 ;
hash [9762 ].v.RH = 58 ;
hash [9761 ].v.RH = 47 ;
hash [9760 ].v.RH = 91 ;
hash [9759 ].v.RH = 41 ;
hash [9757 ].v.RH = 455 ;
eqtb [9759 ].v.LH = 62 ;
mem [19 ].hhfield .v.LH = 9770 ;
mem [19 ].hhfield .v.RH = 0 ;
mem [memtop ].hhfield .v.LH = 268435455L ;
mem [3 ].hhfield .v.LH = 0 ;
mem [3 ].hhfield .v.RH = 0 ;
mem [4 ].hhfield .v.LH = 1 ;
mem [4 ].hhfield .v.RH = 0 ;
{register integer for_end; k = 5 ;for_end = 11 ; if ( k <= for_end) do
mem [k ]= mem [4 ];
while ( k++ < for_end ) ;}
}