[J3] Is this standard compliant
Ondřej Čertík
ondrej at certik.us
Thu Feb 3 21:11:51 UTC 2022
Hi Sidd,
On Thu, Feb 3, 2022, at 1:34 PM, Siddhartha Ghosh via J3 wrote:
> Dear All,
>
> Our flagship NWP code WRF has many many statements containing
> "Unary operator following arithmetic operator" (e.g. 10.*-1. ) that Cray-ftn
> fails to compile. While,
> 1. gfortran compiles with warning
> 2. ifort compiles fine
> 3. nvfortran compiles fine
> My question is, is this allowed by the current standard ?
> I am trying this tiny example as a test.
>
> program tst
>
> print *, 10.*-1.
>
> end
LFortran also compiles this without warning. I remember looking this up, but couldn't figure out in the standard if it is conforming either, but since GFortran, Intel, etc. all compile it, we implemented it also.
Steve, thanks for the link to your blog post, where you explain that it is actually not standard conforming.
I like how GFortran gives a warning:
$ gfortran a.f90
a.f90:2:15:
2 | print *, 10.*-1.
| 1
Warning: Extension: Unary operator following arithmetic operator (use parentheses) at (1)
That seems like the best behavior, given that this is actually not conforming.
Ondrej
More information about the J3
mailing list