modification of g77 for default 64-bit integers on x86-64

Steve Kargl sgk@troutmask.apl.washington.edu
Tue Mar 30 23:03:00 GMT 2004


On Tue, Mar 30, 2004 at 05:45:10PM -0500, Jiri Pittner wrote:
> 
> g95 is still not mature enough for applications, I am afraid.
> 
> My modified g77 works:
> |orion:/home/jiri> cat test12.f
>       program y
>          integer i
>          integer*8 j
>          print *, bit_size(i)
>          print *, bit_size(j)
>       end 
> |orion:/home/jiri> g77 test12.f;a.out
>  32
>  64
> |orion:/home/jiri> g77_64 test12.f;a.out
>  64
>  64
> 
> The sample program with equivalence compiled with g77_64 without error.
> Where the trouble should be? 
> Jiri

The problem will come with this program

     program maybe_bug
     integer i
     real x,y
     equivalence(i,x)
     common /important/ y
     ....
     end program

If you promote i from 32-bit to 64-bit and x and y are left as 32-bit
floating point numbers and x and y are contiguous in memory, you may
accidentally change y via the equivalance statement.

-- 
Steve



More information about the Fortran mailing list