This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Bug Report !


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]