This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Bug Report !
- To: Kiran-Krishna-Nadgir <c9913018 at ncb dot ernet dot in>
- Subject: Re: Bug Report !
- From: Alexandre Oliva <aoliva at cygnus dot com>
- Date: 08 May 2000 04:47:14 -0300
- Cc: egcs-bugs at egcs dot cygnus dot com
- Organization: Cygnus Solutions, a Red Hat Company
- References: <Pine.SOL.3.96.1000507104748.10363C-100000@adithya.ncb.ernet.in>
On May 7, 2000, Kiran-Krishna-Nadgir <c9913018@ncb.ernet.in> wrote:
> i ran the following program and got an internal compiler error.
> char* const ptr = "Its me";
> *ptr = 'i';
Do you mean you got a `Segmentation Fault'? You can't get an ICE
while you *run* a program, only while you compile it.
Your code assumes string literals are modifiable, but the ISO C
Standard says they shouldn't be assumed to be. GCC stores them in
read-only sections, so attempts to modify them cause the error you
observe. See -fwritable-strings.
--
Alexandre Oliva Enjoy Guaranį, see http://www.ic.unicamp.br/~oliva/
Cygnus Solutions, a Red Hat company aoliva@{redhat, cygnus}.com
Free Software Developer and Evangelist CS PhD student at IC-Unicamp
oliva@{lsd.ic.unicamp.br, gnu.org} Write to mailing lists, not to me