🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #688

Re: gcc 1.35 pointer bug

#688
From: Doug Schmidt
Date: Thu, 05 Oct 1989 22:25
27 lines
1790 bytes
In article <19949@princeton.Princeton.EDU>, drh@notecnirp (Dave Hanson) writes:
>In article <8910042003.AA19615@uhura.cc.rochester.edu> msir_ltd@UHURA.CC.ROCHESTER.EDU (Mark Sirota) writes:
>	This has already been reported to Joy Kendall and may have already been
>	reported through other channels, since we discovered this a few days ago.
>	Anyway, we are running gcc-1.35 on a Sun3 with an fpa, SunOS 4.0.3.
>	
>	The following program causes a segmentation fault:
>	main() {
>		char	*s = "foo";
>		*s = 'f';
>	}
>	This one seems pretty significant.  I have a hard time the compiler managed to
>	compile itself, and actually runs...
>
>and it should fault; the program attempts to change a constant.
>it worked in old C, but not in ANSI C...

Furthermore, if you have old C programs that depend on this behavior,
you can make gcc `do the right thing' by using the -fwritable-strings
option.

Doug
--
schmidt@ics.uci.edu (ARPA) |   Per me si va nella citta' dolente.
office: (714) 856-4043     |   Per me si va nell'eterno dolore.
                           |   Per me si va tra la perduta gente.
                           |   Lasciate ogni speranza o voi ch'entrate.
Technical Details
Message-ID: <1989Oct5.222512.7001@paris.ics.uci.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!ucsd!swrinde!cs.utexas.edu!ginosko!usc!ucla-cs!uci-ics!news
References: <19949@princeton.Princeton.EDU>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!ucsd!swrinde!cs.utexas.edu!ginosko!usc!ucla-cs!uci-ics!news
From: schmidt@zola.ics.uci.edu (Doug Schmidt)
Newsgroups: gnu.gcc.bug
Subject: Re: gcc 1.35 pointer bug
Message-ID: <1989Oct5.222512.7001@paris.ics.uci.edu>
Date: 5 Oct 89 22:25:12 GMT
References: <19949@princeton.Princeton.EDU>
Sender: news@paris.ics.uci.edu (Network News)
Reply-To: schmidt@zola.ics.uci.edu (Doug Schmidt)
Distribution: gnu
Organization: University of California, Irvine - Dept of ICS
Lines: 27
In-reply-to: drh@notecnirp.Princeton.EDU (Dave Hanson)