🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #42444

Is this a bug or ... ?

#42444
From: Cecil Aswell
Date: Sun, 10 Dec 1995 00:00
85 lines
2724 bytes
In compiling the UC Berkeley OCTTOOLS (a large suite of VLSI CAD tools)
under linux/gcc (2.5.8) I ran into segmentation fault problems. I traced
these to a section of code which contains the problem and found a comment
about gcc failing (see below).  I have stripped and edited this code so 
that the problem can be easily replicated. 

This code fails on gcc 2.5.8 on my linux box.   It also fails when
compiled on netcom's Sun box using gcc.  It does not fail on the Sun
when using cc.  It also does not fail when compiled under dos using
Symmantic C++.

Not being a programmer (I'm a circuit designer) I'm not sure if this is
a compiler bug or a coding problem.  Any help would be appreciated.

Thanks in advance,

Cecil Aswell
aswell@netcom.com 


/*  -------------------- PROBLEM CODE STARTS HERE ------------------- */ 

/* from the header file */

#define OPT_PKG_NAME	"options"

typedef struct {
    char *optionLetters;
    char *argName;
    char *description;
} optionStruct;

#define OPT_UNIV_FLAG 0x80


/* call the problem */

void optAddUnivOptions();

main()  		
{
	optAddUnivOptions();
}


/* the problem code .... */

void optAddUnivOptions()
{
#ifndef _IBMR2
    static optionStruct univOptions[] = {
	{ "T",	"tech_root_dir","set the technology root directory" },
	{ "V",  0,              "disable tracing with design manager VOV" },
	{ "E",	"on_error",	"cause fatal errors to core dump (on_error = \"core\") or exit (on_error = \"exit\")" },
/* #ifdef notdef
	{ "M",	"mem_flags",	"adjust memory manager behavior:  mem_flags is comma-separated list of" },
	{ OPT_CONT,	0,	"\n    [no]trace   turn tracing on/off"	},
	{ OPT_CONT,	0,	"\n    [no]trash   do/don't trash freed memory" },
	{ OPT_CONT,	0,	"\n    pad=n       pad each block with `n' extra words" },
#endif
*/	{ 0,	0,			0				}
    };
    optionStruct *optPtr;
    char *cPtr;
    char *tapRootDirectory();


    for (optPtr = univOptions; optPtr->optionLetters; optPtr++) {
	for (cPtr = optPtr->optionLetters; *cPtr; cPtr++) {


			/* THE PROBLEM STATEMEMT! */

	    (*cPtr) |= OPT_UNIV_FLAG; /* This fails on a sun4 with gcc (June 91) */
	}
    }


/* stuff deleted... */

#endif

printf ("end of function\n");}

}
Technical Details
Message-ID: <gnusenetaswellDJC8AC.EpA@netcom.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,dca5c82cbaa4b12b,start
X-Google-Attributes: gid11318c,public
From: aswell@netcom.com (Cecil Aswell)
Subject: Is this a bug or ... ?
Date: 1995/12/10
Message-ID: <gnusenetaswellDJC8AC.EpA@netcom.com>
X-Deja-AN: 121483983
distribution: gnu
sender: daemon@cis.ohio-state.edu
organization: NETCOM On-line Communication Services (408 261-4700 guest)
newsgroups: gnu.gcc.help