https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71412

--- Comment #6 from relliott at umn dot edu ---
> Have you considered the SAVE attribute?
>
>  integer(c_int), pointer,save    :: val
>
> laptop-kargl:kargl[246] gmake
> gfc -O3 -g -Wall -pedantic  -c skeleton-f.F90
> ~/work/bin/gcc -O3 -g -Wall -ansi -pedantic  -c skeleton-c.c
> gfc -O3 -g -Wall skeleton*.o  -o skeleton
> laptop-kargl:kargl[247] ./skeleton
> -- in storePtr: pointer address --> 0x28621018 <-- value --> 0 <-- index --> 0
> -- just a print statement --> nothing <-- index -->           0
> -- in getPtr:   pointer address --> 0x28621018 <-- value --> 21 <-- index -->
> 0
> -- in storePtr: pointer address --> 0x28621020 <-- value --> 0 <-- index --> 1
> -- just a print statement --> nothing <-- index -->           1
> -- in getPtr:   pointer address --> 0x28621020 <-- value --> 12 <-- index -->
> 1
> -- value of 'val0' variable -->           21
> -- value of 'val1' variable -->           12

Thanks,

I'll look at SAVE more closely.


>
> PS: You probably do not want to use -pedantic with gfortran.

OK.

>
> PPS: bugzilla is not an appropriate forum to learn Fortran.  Try
> comp.lang.fortran.

Agreed.  I didn't get any response from fort...@gcc.gnu.org and I thought it 
was a bug, so I submitted to bugzilla.  I'll consider this closed now and look 
for other resources.

Many thanks for your interaction.

Ryan

Reply via email to