[Patch, Fortran] PR32980 - Add GAMMA and LGAMMA intrinsics

Steve Kargl sgk@troutmask.apl.washington.edu
Tue Aug 21 23:20:00 GMT 2007


On Tue, Aug 21, 2007 at 10:32:05PM +0200, Tobias Schl?ter wrote:
> Tobias Burnus wrote:
> >Tobias Schl?ter wrote:
> >>I'm worried that this will lead to surprising results for people that
> >>have their own GAMMA functions defined.  Maybe a new std class is
> >>appropriate?  What's the opposite of "legacy"?  Maybe "incompatible",
> >>as in "even incompatible extensions"?
> >
> >Are you suggest that GAMMA is only available with -std=f2008 and
> >-std=incompatible? I would find it extremely surprising if -std=f2003
> >and -std=gnu give a different result than -std=f2008! (Not that we have
> >Fortran 2008 yet, but it will come rather sooner than later.)
> >
> >A proper Fortran program already uses "EXTERNAL GAMMA" or better an
> >explicit interface for nonintrinsic functions. Additionally, GAMMA is
> >present in several other compilers such as IBM lf95, g95 or openf95,
> >which thus have the same problem.
> >
> >(When we have whole-file checks, one should put in a check whether a
> >user routine has the same name as an intrinsic procedure when no
> >intrinsic or external has been used, in which case a warning should be
> >printed.)
> 
> Ok, since you and Steve agree on this, I have a suggestion that I think 
> we all could live with: if the user defines a function that has the same 
> name as an intrinsic available with the selected standard, issue a 
> warning, perhaps only with -Wall.  Bonus points for a command line 
> option that allows disabling intrinsics by name.
> 

Harald and I had a long bugzilla exchange about INTRINSIC/EXTERNAL
and etime (or iargc?).  This is a similar problem.  Ah, here it is
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20248

I'd have to go review the name mangling code.  AFAIK, gfortran assumes
any procedure that is not specifically listed in an INTRINSIC/EXTERNAL
statement is an intrinsic procedure, so the name is mangled and 
_gfortran_XXXX_ is looked up.  If it exists, gfortran keeps going.  If
it does not exist, then gfortran will mangle the name to XXXX_ and 
assume the user will supply the XXXX_ routine.  It seems that you
are proposing the opposite.

BTW, there is -Wnonstd-intrinsics.

-- 
Steve



More information about the Fortran mailing list