Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29530 Discussions

Standard semantics changes print format

Jellby1
New Contributor I
539 Views

I've noticed a "recent" change in the behavior of the -standard-semantics flag, concerting the printing format of long exponents.

Best shown with an example:

program test
use iso_fortran_env
character(len=*), parameter :: frmt = '(4(1x,es21.14))'
write(output_unit,frmt) tiny(1.0_real32), huge(1.0_real32), -tiny(1.0_real32), -huge(1.0_real32)
write(output_unit,frmt) tiny(1.0_real64), huge(1.0_real64), -tiny(1.0_real64), -huge(1.0_real64)
write(output_unit,frmt) tiny(1.0_real128), huge(1.0_real128), -tiny(1.0_real128), -huge(1.0_real128)
write(output_unit,*) tiny(1.0_real128), huge(1.0_real128), -tiny(1.0_real128), -huge(1.0_real128)
end program test

Output with gfortran 11.4.0 (as expected, note the E is omitted in the second line):

  1.17549435082229E-38  3.40282346638529E+38 -1.17549435082229E-38 -3.40282346638529E+38
  2.22507385850720-308  1.79769313486232+308 -2.22507385850720-308 -1.79769313486232+308
 ********************* ********************* ********************* *********************
   3.36210314311209350626267781732175260E-4932   1.18973149535723176508575932662800702E+4932  -3.36210314311209350626267781732175260E-4932  -1.18973149535723176508575932662800702E+4932

Output with ifx 2025.3.0 is similar, but when adding -standard-semantics (E is never omitted, causing stars with negative numbers):

  1.17549435082229E-38  3.40282346638529E+38 -1.17549435082229E-38 -3.40282346638529E+38
 2.22507385850720E-308 1.79769313486232E+308 ********************* *********************
 ********************* ********************* ********************* *********************
 3.362103143112093506262677817321753E-4932
 1.189731495357231765085759326628007E+4932
 -3.362103143112093506262677817321753E-4932
 -1.189731495357231765085759326628007E+4932

 This was not the case with ifx 2024.0.2 (E was omitted as with gfortran).

 

Is this change intended? Is it spec-compliant? Is it documented? Can it be disabled (while keeping -standard-semantics)?

0 Kudos
2 Replies
Steve_Lionel
Honored Contributor III
481 Views

I believe this is an error on the part of ifx. 

0 Kudos
Igor_V_Intel
Moderator
327 Views

Looks like ifx emits an incorrect ES format-mode flag, which is passed further to for_write_seq_fmt. There is no problem with the ifx 2024.2.1 version.

I escalated it to the development team (CMPLRLLVM-74145). Thank you for your report.



Reply