[gnu.gcc.bug] Combination of options causes gcc to get fatal signal

root@SUN.COM (Operator) (12/17/88)

Richard,
	Sorry about not including the MH file with gcc -E output.  Hopefully
this is better.  The problem is that, for this file, -O, -fstrength-reduce,
and -finline-functions appear to be mutually exclusive.  First, a transcript
of the attempted compilations, both unsuccessful and successful; then
followed by the gcc -E output at the end.  I squeezed as many blank lines as
I could ...

	- Greg Earle
	  Sun Los Angeles Consulting
	  earle@Sun.COM

Script started on Tue Dec  6 11:26:10 1988
poseur:2:21 # pwd
/usr/share/src/local/mh-6.6/uip
poseur:2:22 # make DESTDIR= CC=gcc sortm.o
gcc -O   -DMHE -DBSD42 -DBSD43 -DBERK -DRPATHS -DNETWORK -DMORE='"/usr/local/bin/less"' -DMSGPROT='"0600"' -DSBACKUP='"\043"' -DSENDMTS -traditional -v -fstrength-reduce -finline-functions -fcombine-regs -W  -sun3 -c  sortm.c
gcc version 1.31
 /usr/local/lib/gcc-cpp -v -DMHE -DBSD42 -DBSD43 -DBERK -DRPATHS -DNETWORK -DMORE="/usr/local/bin/less" -DMSGPROT="0600" -DSBACKUP="\043" -DSENDMTS -undef -D__GNU__ -D__GNUC__ -Dmc68000 -Dsun -Dunix -D__OPTIMIZE__ -traditional -D__HAVE_68881__ -Dmc68020 s

ortm.c /tmp/cca08435.cpp
GNU CPP version 1.31
 /usr/local/lib/gcc-cc1 /tmp/cca08435.cpp -quiet -dumpbase sortm.c -fstrength-reduce -finline-functions -fcombine-regs -O -W -traditional -version -o /tmp/cca08435.s
GNU C version 1.31 (68k, MIT syntax) compiled by GNU C version 1.31.
[ Warnings deleted ]
gcc: Program cc1 got fatal signal 11.
*** Error code 1
make: Fatal error: Command failed for target `sortm.o'
poseur:2:23 # dbx -I/usr/share/src/local/gcc-1.31 /usr/local/lib/gcc-cc1
Reading symbolic information...
Read 47504 symbols
(dbx) where
record_giv(v = 0xeffccba, insn = 0xa6730, src_regno = 58, dest_regno = 136, mult_val = 0xa6a14, add_val = 0x87a3c, benefit = 2, forces = (nil), forces2 = (nil), type = DEST_REG, maybe_never = 1, location = (nil)), line 2766 in "loop.c"
strength_reduce(scan_start = 0xa3832, end = 0xa65b0, loop_top = 0xa64f8, insn_count = 160, loop_start = 0xa38a2, loop_end = 0xa65b0, nregs = 141), line 2274 in "loop.c"
scan_loop(loop_start = 0xa38a2, end = 0xa65b0, nregs = 141), line 714 in "loop.c"
loop_optimize(f = 0x1, dumpfile = (nil)), line 272 in "loop.c"
rest_of_compilation(decl = 0xa6730), line 1223 in "toplev.c"
finish_function(), line 3331 in "c-decl.c"
yyparse(), line 245 in "c-parse.y"
compile_file(name = 0xa6a14 ""), line 919 in "toplev.c"
main(argc = 555580, argv = 0xa6730, envp = 0xefff9dc), line 1640 in "toplev.c"
(dbx) quit
poseur:2:25 # rm -rf sortm.o
poseur:2:26 # make DESTDIR= CC=gcc sortm.o
gcc -O   -DMHE -DBSD42 -DBSD43 -DBERK -DRPATHS -DNETWORK -DMORE='"/usr/local/bin/less"' -DMSGPROT='"0600"' -DSBACKUP='"\043"' -DSENDMTS -v -fstrength-reduce -finline-functions -fcombine-regs -W  -sun3 -c  sortm.c
gcc version 1.31
 /usr/local/lib/gcc-cpp -v -DMHE -DBSD42 -DBSD43 -DBERK -DRPATHS -DNETWORK -DMORE="/usr/local/bin/less" -DMSGPROT="0600" -DSBACKUP="\043" -DSENDMTS -undef -D__GNU__ -D__GNUC__ -Dmc68000 -Dsun -Dunix -D__OPTIMIZE__ -D__HAVE_68881__ -Dmc68020 sortm.c /tmp/c

ca08455.cpp
GNU CPP version 1.31
../h/mh.h:20: warning: garbage at end of #ifndef argument
 /usr/local/lib/gcc-cc1 /tmp/cca08455.cpp -quiet -dumpbase sortm.c -fstrength-reduce -finline-functions -fcombine-regs -O -W -version -o /tmp/cca08455.s
GNU C version 1.31 (68k, MIT syntax) compiled by GNU C version 1.31.
[ More warnings deleted ]
gcc: Program cc1 got fatal signal 11.
*** Error code 1
make: Fatal error: Command failed for target `sortm.o'
poseur:2:28 # rm -rf sortm.o
poseur:2:29 # make DESTDIR= CC=gcc sortm.o
gcc -O   -DMHE -DBSD42 -DBSD43 -DBERK -DRPATHS -DNETWORK -DMORE='"/usr/local/bin/less"' -DMSGPROT='"0600"' -DSBACKUP='"\043"' -DSENDMTS -v -fstrength-reduce -finline-functions -W  -sun3 -c  sortm.c
gcc version 1.31
 /usr/local/lib/gcc-cpp -v -DMHE -DBSD42 -DBSD43 -DBERK -DRPATHS -DNETWORK -DMORE="/usr/local/bin/less" -DMSGPROT="0600" -DSBACKUP="\043" -DSENDMTS -undef -D__GNU__ -D__GNUC__ -Dmc68000 -Dsun -Dunix -D__OPTIMIZE__ -D__HAVE_68881__ -Dmc68020 sortm.c /tmp/c

ca08470.cpp
GNU CPP version 1.31
../h/mh.h:20: warning: garbage at end of #ifndef argument
 /usr/local/lib/gcc-cc1 /tmp/cca08470.cpp -quiet -dumpbase sortm.c -fstrength-reduce -finline-functions -O -W -version -o /tmp/cca08470.s
GNU C version 1.31 (68k, MIT syntax) compiled by GNU C version 1.31.
[ Warnings deleted again ... ]
gcc: Program cc1 got fatal signal 11.
*** Error code 1
make: Fatal error: Command failed for target `sortm.o'
poseur:2:32 # !make
make DESTDIR= CC=gcc sortm.o
gcc -O   -DMHE -DBSD42 -DBSD43 -DBERK -DRPATHS -DNETWORK -DMORE='"/usr/local/bin/less"' -DMSGPROT='"0600"' -DSBACKUP='"\043"' -DSENDMTS -v -fstrength-reduce -fcombine-regs -W  -sun3 -c  sortm.c
gcc version 1.31
 /usr/local/lib/gcc-cpp -v -DMHE -DBSD42 -DBSD43 -DBERK -DRPATHS -DNETWORK -DMORE="/usr/local/bin/less" -DMSGPROT="0600" -DSBACKUP="\043" -DSENDMTS -undef -D__GNU__ -D__GNUC__ -Dmc68000 -Dsun -Dunix -D__OPTIMIZE__ -D__HAVE_68881__ -Dmc68020 sortm.c /tmp/c

ca08485.cpp
GNU CPP version 1.31
../h/mh.h:20: warning: garbage at end of #ifndef argument
 /usr/local/lib/gcc-cc1 /tmp/cca08485.cpp -quiet -dumpbase sortm.c -fstrength-reduce -fcombine-regs -O -W -version -o /tmp/cca08485.s
GNU C version 1.31 (68k, MIT syntax) compiled by GNU C version 1.31.
 as -mc68020 /tmp/cca08485.s -o sortm.o		[ WORKED! ]
poseur:2:36 # rm -rf sortm.o
poseur:2:37 # !make
make DESTDIR= CC=gcc sortm.o
gcc -O   -DMHE -DBSD42 -DBSD43 -DBERK -DRPATHS -DNETWORK -DMORE='"/usr/local/bin/less"' -DMSGPROT='"0600"' -DSBACKUP='"\043"' -DSENDMTS -v -finline-functions -fcombine-regs -W  -sun3 -c  sortm.c
gcc version 1.31
 /usr/local/lib/gcc-cpp -v -DMHE -DBSD42 -DBSD43 -DBERK -DRPATHS -DNETWORK -DMORE="/usr/local/bin/less" -DMSGPROT="0600" -DSBACKUP="\043" -DSENDMTS -undef -D__GNU__ -D__GNUC__ -Dmc68000 -Dsun -Dunix -D__OPTIMIZE__ -D__HAVE_68881__ -Dmc68020 sortm.c /tmp/c

ca08503.cpp
GNU CPP version 1.31
../h/mh.h:20: warning: garbage at end of #ifndef argument
 /usr/local/lib/gcc-cc1 /tmp/cca08503.cpp -quiet -dumpbase sortm.c -finline-functions -fcombine-regs -O -W -version -o /tmp/cca08503.s
GNU C version 1.31 (68k, MIT syntax) compiled by GNU C version 1.31.
 as -mc68020 /tmp/cca08503.s -o sortm.o
poseur:2:38 # cat sortm.E
# 1 "sortm.c"
# 1 "../h/mh.h"







struct node {
    char   *n_name;		
    char   *n_field;		
    char    n_context;		
    struct node *n_next;	
};

struct swit {
    char   *sw;
    int     minchars;
};
extern struct swit  anoyes[];	

struct msgs {
    int     hghmsg;		
    int     nummsg;		
    int     lowmsg;		
    int     curmsg;		
    int     lowsel;		
    int     hghsel;		
    int     numsel;		
    char   *foldpath;		
    char    msgflags;		
    char    pad1[sizeof (int) - sizeof (char)];



    char   *msgattrs[10		 + 1];
    short   attrstats;		
    char    pad2[sizeof (int) - sizeof (short)];
    int	    lowoff;		
    int	    hghoff;		
    short   msgstats[1];	


				
				


};




extern int msg_count;		
extern int msg_style;		
extern char *msg_delim;		

extern char *components;
extern char *context;
extern char *current;
extern char *defalt;
extern char *digestcomps;
extern char *distcomps;
extern char *draft;
extern char *faceproc;
extern char *fileproc;
extern char *foldprot;
extern char *forwcomps;
extern char *incproc;
extern char *installproc;
extern char *lproc;
extern char *mailproc;
extern char *mh_defaults;
extern char *mh_profile;
extern char *mh_seq;
extern char *mhlformat;
extern char *mhlforward;
extern char *mhlproc;
extern char *moreproc;
extern char *msgprot;
extern char *mshproc;
extern char *nsequence;
extern char *packproc;
extern char *postproc;
extern char *pfolder;
extern char *psequence;
extern char *rcvdistcomps;
extern char *replcomps;
extern char *rmfproc;
extern char *rmmproc;
extern char *sendproc;
extern char *showproc;
extern char *slocalproc;
extern char *sysed;
extern char *usequence;
extern char *version;
extern char *vmhproc;
extern char *whatnowproc;
extern char *whomproc;


extern char ctxflags;




extern char *invo_name;		
extern char *mypath;		
extern char *defpath;		
extern char *ctxpath;		
extern struct node *m_defs;


char   *add ();
void	adios ();
void	admonish ();
void	advise ();
void	advertise ();
void	ambigsw ();
int     atooi ();
char  **brkstring ();
void	closefds ();
char   *concat ();
char   *copy ();
char  **copyip ();
void	cpydata ();
void	cpydgst ();
void	discard ();
void	done ();
int     fdcompare ();
int     gans ();
char  **getans ();
int	getanswer ();
char   *getcpy ();
void	help ();
char   *libpath ();
int     m_atoi ();
char   *m_backup ();
int     m_convert ();
int     m_delete ();
char   *m_draft ();
void	m_eomsbr ();
int     m_file ();
char   *m_find ();
void	m_fmsg ();
void    m_foil ();
void	m_getdefs ();
int     m_getfld ();
char   *m_getfolder ();
int     m_gmprot ();
struct msgs *m_gmsg ();
char   *m_maildir ();
char   *m_mailpath ();
char   *m_name ();
void	m_readefs ();
struct msgs *m_remsg ();
void	m_replace ();
char   *m_scratch ();
char   *m_seq ();
int	m_seqadd ();
char   *m_seqbits ();
int	m_seqdel ();
int	m_seqflag ();
int	m_seqnew ();
void	m_setcur ();
void	m_setseq ();
void	m_setvis ();
void    m_sync ();
char   *m_tmpfil ();
void	m_unknown ();
void	m_update ();
int	m_whatnow ();
int     makedir ();
char   *path ();
int     peekc ();
int     pidwait ();
int     pidstatus ();
void	printsw ();
void    push ();
int	putenv ();
char   *pwd ();
char   *r1bindex ();
int	refile ();
int	remdir ();
int     showfile ();
int     smatch ();
char   *sprintb();
int	ssequal ();
int	stringdex ();
char   *trimcpy ();
int     type ();
int     uleq ();
int	unputenv ();
int     uprf ();
int	vfgets ();

# 1 "../h/../h/strings.h"





char   *index ();
char   *mktemp ();
char   *rindex ();
char   *sprintf ();

char   *strcat ();
int     strcmp ();
char   *strcpy ();
int	strlen ();
char   *strncat ();
int     strncmp ();
char   *strncpy ();
char   *getenv ();
char   *calloc (), *malloc (), *realloc ();




# 327 "../h/mh.h"



typedef struct _iobuf  *FP;
FP   popen ();











# 3 "sortm.c"
# 1 "../zotnet/tws.h"

			
struct tws {
    int     tw_sec;
    int     tw_min;
    int     tw_hour;
    int     tw_mday;
    int     tw_mon;
    int     tw_year;
    int     tw_wday;
    int     tw_yday;
    int     tw_zone;
    long    tw_clock;
    int     tw_flags;



};
void    twscopy ();
int	twsort ();
long	twclock ();
char   *dasctime (), *dtimezone (), *dctime (), *dtimenow ();
struct tws *dgmtime(), *dlocaltime (), *dparsetime (), *dtwstime ();




extern char   *tw_dotw[], *tw_ldotw[], *tw_moty[];
# 4 "sortm.c"
# 1 "/usr/local/lib/gcc-include/stdio.h"


extern	struct	_iobuf {
	int	_cnt;
	unsigned char *_ptr;
	unsigned char *_base;
	int	_bufsiz;
	short	_flag;
	char	_file;		
} _iob[];



















extern struct _iobuf	*fopen();
extern struct _iobuf	*fdopen();
extern struct _iobuf	*freopen();
extern struct _iobuf	*popen();
extern struct _iobuf	*tmpfile();
extern long	ftell();
extern char	*fgets();
extern char	*gets();

extern char	*ctermid();
extern char	*cuserid();
extern char	*tempnam();
extern char	*tmpnam();



# 5 "sortm.c"


static struct swit switches[] = {
    "datefield field", 0,

    "verbose", 0,
    "noverbose", 0,

    "help", 4,
    0, 0
};

struct smsg {
    int     s_msg;
    struct tws  s_tws;
};
static struct smsg *smsgs;

int     msgsort ();
struct tws *getws ();

long	time ();


main (argc, argv)
int     argc;
char  **argv;
{
    int     verbosw = 0,
            msgp = 0,
	    i,
            msgnum;
    char   *cp,
           *maildir,
           *datesw = 0,
           *folder = 0,
            buf[100],
          **ap,
          **argp,
           *arguments[	1000	],
           *msgs[	1000	];
    struct msgs *mp;
    invo_name = r1bindex (argv[0], '/');
    if ((cp = m_find (invo_name)) != 0) {
	ap = brkstring (cp = getcpy (cp), " ", "\n");
	ap = copyip (ap, arguments);
    }
    else
	ap = arguments;
    (void) copyip (argv + 1, ap);
    argp = arguments;

    while (cp = *argp++) {
	if (*cp == '-')
	    switch (smatch (++cp, switches)) {
		case 	(-2)	: 
		    ambigsw (cp, switches);
		    done (1);
		case 	(-1)	: 
		    adios (	((char *) 0), "-%s unknown", cp);
		case 3: 
		    (void) sprintf (buf, "%s [+folder] [msgs] [switches]",
			    invo_name);
		    help (buf, switches);
		    done (1);

		case 0: 
		    if (datesw)
			adios (	((char *) 0), "only one date field at a time!");
		    if (!(datesw = *argp++) || *datesw == '-')
			adios (	((char *) 0), "missing argument to %s", argp[-2]);
		    continue;

		case 1: 
		    verbosw++;
		    continue;
		case 2: 
		    verbosw = 0;
		    continue;
	    }
	if (*cp == '+' || *cp == '@') {
	    if (folder)
		adios (	((char *) 0), "only one folder at a time!");
	    else
		folder = path (cp + 1, *cp == '+' ? 0		 : 2		);
	}
	else
	    msgs[msgp++] = cp;
    }



    if (!m_find ("path"))
	free (path ("./", 0		));
    if (!msgp)
	msgs[msgp++] = "all";
    if (!datesw)
	datesw = "Date";
    if (!folder)
	folder = m_getfolder ();
    maildir = m_maildir (folder);

    if (chdir (maildir) == 	(-1)	)
	adios (maildir, "unable to change directory to");
    if (!(mp = m_gmsg (folder)))
	adios (	((char *) 0), "unable to read folder %s", folder);
    if (mp -> hghmsg == 0)
	adios (	((char *) 0), "no messages in %s", folder);

    for (msgnum = 0; msgnum < msgp; msgnum++)
	if (!m_convert (mp, msgs[msgnum]))
	    done (1);
    m_setseq (mp);

    if ((i = read_dates (mp, datesw)) <= 0)
	adios (	((char *) 0), "no messages to sort");
    qsort ((char *) smsgs, i, sizeof *smsgs, msgsort);
    file_dates (mp, verbosw);

    m_replace (pfolder, folder);
    m_sync (mp);
    m_update ();

    done (0);
}



static int  read_dates (mp, datesw)
register struct  msgs *mp;
register char   *datesw;
{
    int     msgnum;
    struct tws  tb;
    register struct smsg *s;
    register struct tws *tw;

    twscopy (&tb, dtwstime ());

    smsgs = (struct smsg   *)
		calloc ((unsigned) (mp -> hghsel - mp -> lowsel + 2),
			sizeof *smsgs);
    if (smsgs == 0)
	adios (	((char *) 0), "unable to allocate sort storage");

    s = smsgs;
    for (msgnum = mp -> lowsel; msgnum <= mp -> hghsel; msgnum++) {
	tw = 0;
	if (mp -> msgstats[msgnum] & 0x0004	) {
	    if ((tw = getws (datesw, msgnum)) == 0)
		tw = msgnum != mp -> lowsel ? &((s - 1) -> s_tws) : &tb;
	}
	else
	    if (mp -> msgstats[msgnum] & 	0x0001	)
		tw = &tb;

	if (tw) {
	    s -> s_msg = msgnum;
	    twscopy (&s -> s_tws, tw);
	    s++;
	}
    }

    s -> s_msg = 0;
    return (s - smsgs);
}



static struct tws  *getws (datesw, msg)
register char   *datesw;
int     msg;
{
    int     compnum,
            state;
    register char  *hp,
                   *msgnam;
    char    buf[1024],
            nam[ 128		];
    register struct tws *tw;
    register    struct _iobuf *in;

    if ((in = fopen (msgnam = m_name (msg), "r")) == 0) {
	admonish (msgnam, "unable to read message");
	return 0;
    }



    for (compnum = 1, state =      0		, hp = 0;;) {
	switch (state = m_getfld (state, nam, buf, sizeof buf, in)) {
	    case      0		: 
	    case   2		: 
	    case  1		: 
		compnum++;
		if (hp != 0)
		    free (hp), hp = 0;
		hp = add (buf, 	((char *) 0));
		while (state ==  1		) {
		    state = m_getfld (state, nam, buf, sizeof buf, in);
		    hp = add (buf, hp);
		}
		if (uleq (nam, datesw))
		    break;
		if (state !=   2		)
		    continue;

	    case     3		: 
	    case  4		: 
	    case  5		: 
		admonish (	((char *) 0), "no %s field in message %d", datesw, msg);

	    case  (-2)		: 
	    case  (-3)		: 
		if (state ==  (-2)		 || state ==  (-3)		)
		    admonish (	((char *) 0),
			    "format error in message %d(header #%d)",
			    msg, compnum);
		if (hp != 0)
		    free (hp);
		(void) fclose (in);
		return 0;

	    default: 
		adios (	((char *) 0), "internal error -- you lose");
	}
	break;
    }

    if ((tw = dparsetime (hp)) == 0)
	admonish (	((char *) 0), "unable to parse %s field in message %d",
		datesw, msg);

    if (hp != 0)
	free (hp);
    (void) fclose (in);
    return tw;
}

static int  msgsort (a, b)
register struct smsg *a,
		     *b;
{
    return twsort (&a -> s_tws, &b -> s_tws);
}

static  file_dates (mp, verbosw)
register struct  msgs *mp;
int     verbosw;
{
    register int    i,
                    j,
                    k;
    short   stats;
    char    f1[1024],
            f2[1024],
            tmpfil[1024];

    (void) strcpy (tmpfil, m_scratch ("", invo_name));

    for (i = 0; j = smsgs[i++].s_msg;)
	if (i != j) {
	    (void) strcpy (f1, m_name (i));
	    (void) strcpy (f2, m_name (j));
	    if (mp -> msgstats[i] & 	0x0001	) {
		if (verbosw)
		    printf ("swap messages %s and %s\n", f2, f1);

		if (rename (f1, tmpfil) == 	(-1)	) {
		    admonish (tmpfil, "unable to rename %s to ", f1);
		    continue;
		}

		if (rename (f2, f1) == 	(-1)	) {
		    admonish (f1, "unable to rename %s to", f2);
		    continue;
		}

		if (rename (tmpfil, f2) == 	(-1)	) {
		    admonish (f2, "unable to rename %s to", tmpfil);
		    continue;
		}

		for (k = i; smsgs[k].s_msg; k++)
		    if (smsgs[k].s_msg == i) {
			smsgs[k].s_msg = j;
			break;
		    }
	    }
	    else {
		if (verbosw)
		    printf ("message %s becomes message %s\n", f2, f1);

		if (rename (f2, f1) == 	(-1)	) {
		    admonish (f1, "unable to rename %s to ", f2);
		    continue;
		}
	    }

	    smsgs[i - 1].s_msg = i;
	    stats = mp -> msgstats[i];
	    mp -> msgstats[i] = mp -> msgstats[j];
	    mp -> msgstats[j] = stats;
	    if (mp -> curmsg == j)
		m_setcur (mp, i);
	    mp -> msgflags |=   0x02		;
	}
}

poseur:2:41 # exit
poseur:2:42 # 
script done on Tue Dec  6 11:33:33 1988