This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/18566] Can vary constants (undefined fortran)
- From: "Thomas dot Koenig at online dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 30 Nov 2004 08:29:38 -0000
- Subject: [Bug target/18566] Can vary constants (undefined fortran)
- References: <20041119132256.18566.Thomas.Koenig@online.de>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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