*BSD News Article 13137


Return to BSD News archive

Xref: sserve comp.os.386bsd.questions:900 comp.os.386bsd.development:256
Newsgroups: comp.os.386bsd.questions,comp.os.386bsd.development
Path: sserve!newshost.anu.edu.au!munnari.oz.au!uunet!zaphod.mps.ohio-state.edu!uwm.edu!ux1.cso.uiuc.edu!news.cso.uiuc.edu!uxa.cso.uiuc.edu!rkb55989
From: rkb55989@uxa.cso.uiuc.edu (Rafal)
Subject: GCC 2.3.3 optimizer broken?
Date: Sat, 20 Mar 1993 21:57:51 GMT
Message-ID: <C47JoG.5v5@news.cso.uiuc.edu>
Sender: usenet@news.cso.uiuc.edu (Net Noise owner)
Organization: University of Illinois at Urbana
Lines: 42

I came accross a problem w/GCC 2.3.3's "-O -fstrength-reduce" combo while trying
to compile Seyon v1.8....

The code that caused the problem is in SeGeneric.c, and looks like:
[This is SeGeneric.c, lines 17-50, by the way, without comments]

> void ReadCommentedFile(fp, line)
> 	FILE           *fp;
>	char           *line[];
> {
> char            buffer[REG_BUF + 1],
>		  *bufPtr,
>		  ptr;
> int             i;
>
> for (i = 0; i < MAX_ENT && fgets(buffer, REG_BUF, fp) != NULL;) {
>	buffer[strlen(buffer) - 1] = '\0';
>	bufPtr = SSpc(buffer);
>
>	if (*bufPtr == '\0' || *bufPtr == '#')
>		continue;
>	if ((ptr = strrchr(bufPtr, '#')) != NULL)
>		*ptr = '\0';
>	
>	line[i++] = XtNewString(bufPtr);
>	}
> line[i] = NULL;
>}

	This code will compile fine and run fine if -O -fstrength-reduce is not
	fed to the compiler, but will barf with a SIGSEGV somewhere on the
	"if (*bufPtr == '\0' || *bufPtr == '#') " line....

	Now am I on drugs, or is there something wrong with this behavior??

								Rafal

/------------------------------------------------------------------------\
|Rafal Boni					       	  r-boni@uiuc.edu|
|"Me have a .sig?? I don't even have a clue!"	rkb55989@uxa.cso.uiuc.edu|
|                - Anonymous                 rb6775@caffeine.cen.uiuc.edu|
\------------------------------------------------------------------------/