[J3] Should all intrinsic functions be simple?
Shafran, Aury
aury.shafran at intel.com
Wed Dec 20 01:09:45 UTC 2023
> And they are not functions either, so that definition does not apply.
My bad, I restructured my message and left in the part about "All the functions are simple" when it was no longer necessary. The IEEE_GET/SET_* subroutines are explicitly stated to be simple.
> They are allowed in constant expressions, and constant expressions always have the same value...
Does the standard say anywhere that these two parameters, declared back to back, must have the same value?
Logical, Parameter :: a = IEEE_SUPPORT_INF()
Logical, Parameter :: b = IEEE_SUPPORT_INF()
Obviously, a and b should have the same value, but I can't find anything that says they must have the same value. I'm genuinely curious.
What about if used outside a constant expression? E.g.
Print *, IEEE_SUPPORT_INF(), IEEE_SUPPORT_INF()
> No they do not. Seriously.
True, one could imagine a compiler implementing those procedures as having a hard-coded result determined at compilation time.
Still, it seems to me the IEEE_GET/SET_* subroutines and the intrinsic procedures Brad listed violate intuition of what a simple procedure should be able to do, even if they fully comply with the constraints for simple procedures.
Thanks,
Aury
-----Original Message-----
From: J3 <j3-bounces at mailman.j3-fortran.org> On Behalf Of Malcolm Cohen via J3
Sent: Tuesday, December 19, 2023 7:07 PM
To: 'General J3 interest list' <j3 at mailman.j3-fortran.org>
Cc: Malcolm Cohen <malcolm at nag-j.co.jp>
Subject: Re: [J3] Should all intrinsic functions be simple?
Aury Shafran writes:
>I think the same issue exists for some of the procedures from the IEEE intrinsic module.
I disagree.
>F2023 says about 17.11 for the IEEE modules, "All the functions are simple ... unless otherwise stated." However, all the IEEE_GET/SET_* procedures are not conceptually simple
And they are not functions either, so that definition does not apply.
>There are also the IEEE_SUPPORT_* query procedures, COMPILER_VERSION, and COMPILER_OPTIONS, which are all simple but read global state.
No they do not. Seriously.
> However I think these aren’t much of an issue because the global state they access should be constant, so they should always return the same value. >(Though I don't think the standard requires them to always return the same value.)
They are allowed in constant expressions, and constant expressions always have the same value...
Cheers,
--
..............Malcolm Cohen, NAG Oxford/Tokyo.
More information about the J3
mailing list