[J3] [EXTERNAL] Re: Is this standard compliant
Clune, Thomas L. (GSFC-6101)
thomas.l.clune at nasa.gov
Thu Feb 3 21:24:18 UTC 2022
Hi Ondrej,
If it is not too late ... I would encourage you to make the defaults for LFortran to be strict compliance and then add flags to relax that. The existing vendors don't always have that option once they have customers relying on support for incorrect code. Thus they tend to have "strict" as an option that is off by default. Maybe you already have "customers" and thus cannot break backwards compatibility.
Cheers,
- Tom
On 2/3/22, 4:12 PM, "J3 on behalf of Ondřej Čertík via J3" <j3-bounces at mailman.j3-fortran.org on behalf of j3 at mailman.j3-fortran.org> wrote:
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