[Bug fortran/49993] arrays declared as parameter are not allocated in read-only memory
kargl at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Aug 8 15:05:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49993
kargl at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kargl at gcc dot gnu.org
--- Comment #2 from kargl at gcc dot gnu.org 2011-08-08 15:05:10 UTC ---
(In reply to comment #1)
> The equivalent "C" program results in the expected "segmentation fault".
>
> void a1(int *ia) {
> *ia = 1;
> }
> void a2(void) {
> static const int ia[] = { 2 };
> a1(ia);
> }
> int main(void) {
> a2();
> return 0;
> }
The programs aren't equivalent. You need to change a2 to
void a2(void) {
static int ia[] = { 2 };
a1(ia);
}
then the programs are equivalent.
More information about the Gcc-bugs
mailing list