------- Additional Comments From Thomas dot Koenig at online dot de 2004-11-30 08:29 ------- (In reply to comment #3) > This is a target problem, most likely what is happening is that the memory where the variable is being > stored is not being marked as read only for the processor.
This appears to be the case for C, as well. "const" variables are not put into read-only memory. Here's a C equivalent. It is invalid as well, but it would be nice if this could segfault, as well. $ cat const.c const int answer=42; $ cat const2.c #include <stdio.h> extern int answer; int main() { answer = 3; printf("%d\n", answer); return 0; } $ ia64-unknown-linux-gnu-gcc-4.0.0 const.c const2.c $ ./a.out 3 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18566