cast to pointer from integer of different size

Steve Kargl sgk@troutmask.apl.washington.edu
Sun Sep 10 20:39:00 GMT 2006


On Sun, Sep 10, 2006 at 09:29:51PM +0200, Thomas Koenig wrote:
> On Sun, Sep 10, 2006 at 11:57:44AM -0700, Steve Kargl wrote:
> 
> > Why?  The code is casting to an int.  int and INTEGER are
> > corresponding types.  This is what g77's signal is documented
> > to return.
> 
> >From the g77 info file:
> 
> #      CALL Signal(NUMBER, HANDLER, STATUS)
> # 
> # NUMBER: `INTEGER'; scalar; INTENT(IN).
> # 
> # HANDLER: Signal handler (`INTEGER FUNCTION' or `SUBROUTINE') or
> # dummy/global `INTEGER(KIND=1)' scalar.
> # 
> # STATUS: `INTEGER(KIND=7)'; OPTIONAL; scalar; INTENT(OUT).
> 
> and
> 
> # `KIND=7'
> #      This is valid only as `INTEGER(KIND=7)' and denotes the `INTEGER'
> #      type that has the smallest storage size that holds a pointer on
> #      the system.
> 
> So, g77's STATUS argument is wide enough to hold a pointer.
> gfortran's isn't in all cases.  This is a bug.
> 

gfortran doesn't have an INTEGER(KIND=7), and after reading 
g77.info adding such a type would probably violate numerous
parts of the Fortran standard.

-- 
Steve



More information about the Fortran mailing list