reworking intrinsic procedures

Steve Kargl sgk@troutmask.apl.washington.edu
Mon Mar 5 05:03:00 GMT 2007


On Mon, Mar 05, 2007 at 05:53:42AM +0100, FX Coudert wrote:
> >We have a code which supports using e.g. integer*8 as the "default"  
> >for many variables.  Requiring the user to convert arguments to the  
> >default integer kind first would be annoying.  Having the compiler  
> >convert the arguments to the default integer kind would be fine,  
> >since -- likely -- the implementation of the intrinsic would do  
> >that anyway internally.
> 
> I also agree with Erik that, from a practical point of view, we can't  
> just reject kinds other than
> 
> Maybe (since what we're talking about here is *integer* kinds) it is  
> worth doing the same choice as we already did for some of the I/O  
> parameters: define a integer kind k to be 8 if integer(8) is  
> available, and 4 otherwise. Then use k and convert from/to it for all  
> library GNU intrinsics, and convert to/from this.
> 

Well, I think we should do like you did in gfc_resolve_flush().

  ts.type = BT_INTEGER;
  ts.kind = gfc_default_integer_kind;
  n = c->ext.actual->expr;
  if (n != NULL && n->ts.kind != ts.kind)
    gfc_convert_type (n, &ts, 2);

  name = gfc_get_string (PREFIX ("flush_i%d"), ts.kind);
  c->resolved_sym = gfc_get_intrinsic_sub_symbol (name);

This properly handles -fdefault-integer-8 and it converts
the other integer kinds accordingly.  If I understand both
you and Erik, then the above should work in the majority
(all?) of cases nonstandard intrinsics.

-- 
Steve



More information about the Fortran mailing list