1
votes

I an currently working on a code that is ,as far as I know, compiling well with ifort. I tried to compile it with gfortran and I got the following error:

WRITE(100, '(8ES18.10E)') a
1 Error: Positive exponent width required in format string at (1)

I am puzzle by this format:8ES18.10E, what is supposed to mean the last E? Is it a ifort/gfortran incompatibility?

Thanks for advice

1
Not sure, by head, but maybe the second E in the format should not be present. - albert
I think that gfortran is correct to reject that format without a digit or two after the final E. It doesn't surprise me that Intel Fortran doesn't reject it, it's but the latest incarnation of a long line of compilers extending back to the 60s. Along the way it has picked up many, many non-standard features (or features which are no longer standard) and through an unbounded enthusiasm for backward compatibility not dropped (m)any of them, though judicious use of flags can persuade it to be more ruthless in this regard. - High Performance Mark
I suppose someone should explain the format, ES18.10E, and why gfortran correctly rejects it. 18 is the overall width of the formatted number. 10 is the number of digits that follows the decimal point. The trailing E requires an integer value to specify the number of digits in the exponent. As @HighPerformanceMark states Intel is accepting an extension to the Fortran standard. Intel provides an option to request conformance to the Fortran standard (see its documentation). - evets
It isn't so much that ifort accepts as an extension ES18.10E so much as it's under no obligation whatsoever to tell you that ES18.10E isn't a valid format item. - francescalus
All of the comments above are on point, except that it can't be considered an extension, as it's meaningless. As to what ifort does at run time with the invalid format, my guess is that the trailing E would be ignored, but this would need to be tested with each major version. It's disappointing if it's not possible to get it checked, and a problem report would be justified. Any level of standards checking in ifort should require f95 compliance. As francescalus pointed out, Fortran standard doesn't require ability to check all aspects of compliance. - tim18

1 Answers

1
votes

ifort interprets WRITE(100, '(8ES18.10E)') as WRITE(100, '(8ES18.10E2)') ) at least in the example I found