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

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


On Tue, Mar 30, 2004 at 06:14:26PM -0500, Jiri Pittner wrote:
> |orion:/home/jiri> cat test13.f
>        program maybe_bug
>        integer i
>        real x,y
>        equivalence(i,x)
>        common /important/ y
>        y=123.
>        x=456.
>        write(6,*)y
>        i=1234567890
>        write(6,*)y
>        end
> |orion:/home/jiri> g77 test13.f
> |orion:/home/jiri> a.out
>   123.
>   123.
> |orion:/home/jiri> g77_64 test13.f
> |orion:/home/jiri> a.out
>   123.
>   123.
> 
> This seems to work ok - the compiler will place i,x on stack and only y in common
> Of course, if both x,y would be in the common, then y will be overwritten,
> but this I think the user has to take care about, if he wants to enlarge integers.
> Actually, before I posted the announcement, I compiled already an application program
> consisting of approx. 300000 lines and it computes correct numbers. However, that
> program was written with 64-bit integers on mind (originally for Cray) and I ported it
> to 64-bit workstation (HP) a few years ago.
> 

I'm not saying that 64-bit default integers are a bad idea, but it
does require careful testing.  The Fortran 77 standard (as well as
the Fortran 90 and 95 standards) require sizeof(INTEGER) == sizeof(REAL),
sizeof(DOUBLE PRECISION) == 2*sizeof(REAL), and
sizeof(COMPLEX) == 2*sizeof(REAL).  The sticky places are EQUIVALENCE and
COMMON blocks.

-- 
Steve



More information about the Fortran mailing list