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

write(...,*) difference from G95. Bug?

Guthrie_M_
Beginner
497 Views

here is the test code:

      character(len=100)::buf
      write(buf,*)0.,'ABC'
      write(*,*)buf
      end

With intel (Composer XE 2015) the output is

 0.0000000E+00ABC

while with G95 it is

 0. ABC

Note the space with G95, which allows a subsequent read(...,*).

This seems like a bug to me.

0 Kudos
3 Replies
Steven_L_Intel1
Employee
497 Views

Interesting. I see two problems here - the missing blank (which IS inserted if you write to a file), and the use of E format where the standard calls for F. I'm more than a bit astonished at this and will follow up with the developers. Thanks for reporting this.

0 Kudos
Steven_L_Intel1
Employee
497 Views

Escalated as issue DPD200380295, The issue arises only when doing internal writes, which is perhaps why we haven't seen this reported long ago. I played around with this some and suspect that we are actually using G format for the reals, which would not be correct. While your test case doesn't show this, /standard-semantics implies /assume:noold_ldout_format which changes how a real zero is formatted. This changed between Fortran 95 and Fortran 2003, and our default behavior is consistent with F95. What is strange is that if you enable /assume:noold_ldout_format, the formatting of zero changes for external files but not internal files!

0 Kudos
Steven_L_Intel1
Employee
497 Views

This will be fixed for a major release later this year.

0 Kudos
Reply