Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ARIZONA.EDU!olson%modular.UUCP From: olson%modular.UUCP@ARIZONA.EDU (Jon Olson) Newsgroups: gnu.gcc.bug Subject: (none) Message-ID: <8903261747.AA13844@> Date: 26 Mar 89 17:47:25 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 154 To whom it may concern, Here's a bit of code which causes GCC V1.34 to abort during optimization. This bug did not occur in V1.33 and only occurs in V1.34 when the -O switch is given. Below are the relevant statistics for the compilation: 1) GCC Version: 1.34 2) Processor Type: 68020 (SUN-3) 3) Operating System: SUNOS 4.0 4) Command Line: gcc -O bug.c 5) md: m68k.h 6) tm.h: tm-sun3.h 7) Problem: abort() in insn-extract.c line 2750 if (INSN_CODE (insn) == -1) abort (); -------------------------------cut here-------------------------------- #define MAXID 20 #define MAXBUFFER 50000 #define EOF (-1) typedef char ID[20]; typedef unsigned char BYTE; typedef unsigned long LINK; typedef unsigned short WORD; struct LNODE /* local directory node structure */ { BYTE fd; /* file number */ WORD rsize; /* record size */ WORD minsize; /* minimum record size */ WORD maxsize; /* maximum record size */ ID dirid; /* name of directory */ }; struct GNODE { LINK frec; LINK lrec; LINK free; WORD rsize; ID dirid; BYTE maxid; int version; }; struct DBDSC { LINK recno; /* DB address of current record */ LINK rnext; /* DB address of next record */ WORD rsize; /* Record size (bytes) */ struct LNODE *pdir; /* DISPATCH DB directory linked list */ struct RECORD *prec; /* USER record buffer */ struct RECORD *pget; /* Record contents at last DBGET */ }; union ANYBUFFER { struct RECORD { LINK rlast; LINK rnext; unsigned version; ID recid; } rec; struct RECORDHDR { LINK rlast; LINK rnext; unsigned version; }; char buf[ MAXBUFFER ]; }; struct GINFO_TBL /* misc information about the gnodes */ { ID gnode_id; /* gnode name */ char *val_init; /* ptr to val init structure from templates.c */ int size; /* size of the val init structure */ LINK frec; /* 1st record in the new version */ LINK lrec; /* last record in the new version */ }; static struct GINFO_TBL *getginfo(); static cleancopy( pdirto, pdirfrom ) struct LNODE *pdirto, *pdirfrom; { struct GINFO_TBL *g; struct DBDSC dbufto; int copy_flag, i, nb, nrecs = 0, nbytes = 0, (*pconvert)(); LINK link, linkfrom, linklast; union ANYBUFFER buffrom, bufto; struct GNODE *dbgetgnode(); register struct GNODE *gnode = dbgetgnode(pdirfrom->fd); g = getginfo( pdirto->dirid ); makedsc( &dbufto, &bufto, pdirto ); linkfrom = linklast = gnode ? gnode->frec : EOF; for(;;) { if( dlseek( pdirfrom->fd, linkfrom, 0 ) != EOF ) { nb = dread( pdirfrom->fd, &buffrom, sizeof( buffrom ) ); if( nb < sizeof( struct RECORD ) - MAXID ) { printform( " Can't read record %06d in %s.\n", linkfrom, pdirfrom->dirid ); break; } } else { /* Done if last record is end of list */ if( !gnode || gnode->lrec == linklast || dlseek( pdirfrom->fd, gnode->lrec, 0 ) == EOF || dread( pdirfrom->fd, &buffrom, sizeof( buffrom ) ) < sizeof( struct RECORD ) - MAXID ) break; nb = 0; for( linkfrom = gnode->lrec; ( link = dlseek( pdirfrom->fd, buffrom.rec.rlast, 0 ) ) != EOF; linkfrom = link ) if( link == linklast || dread( pdirfrom->fd, &buffrom, sizeof( buffrom ) ) < sizeof( struct RECORD ) - MAXID ) break; else if( ++nb > 1000 || buffrom.rec.version != EOF ) { buffrom.rec.version = 0; break; } } if( buffrom.rec.version != EOF ) { printform( " Circular list at record '%a'(%08X) in %a\n", buffrom.rec.recid, linkfrom, pdirfrom->dirid ); break; } if( copy_flag ) dbcopy( &bufto, &buffrom, nb ); else { dbcopy( &bufto, g->val_init, g->size ); nb = dbconvert( &bufto, &buffrom, pdirfrom ); if( pconvert ) (*pconvert)( &bufto, &buffrom, pdirfrom ); } linklast = linkfrom; linkfrom = buffrom.rec.rnext; nrecs++; } }