[Bug c/64187] Writing to a char array cast from a char * causes a segmentation fault
brian.corriveau at ericsson dot com
gcc-bugzilla@gcc.gnu.org
Thu Dec 4 21:49:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64187
--- Comment #2 from Brian <brian.corriveau at ericsson dot com> ---
(In reply to Andrew Pinski from comment #1)
> char *test = "this is a test";
>
>
> This is a string literal so it stored in constant memory and which is why
> you are getting a segfault.
I was thinking "test" would be on the stack, but obviously not.
I did compile with the -Wall option before filing the bug, but I didn't get any
complaints. Maybe this is something that could be improved.
thanks for the speedy answer,
brian
More information about the Gcc-bugs
mailing list