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

Problem with user defned operator and WRITE statement

MR
Beginner
445 Views
Hi,
I think that the attached code exposes a (small) bug in ifort:

ifort xyz.f90 -o xyz
xyz.f90(21): error #5082: Syntax error, found '.' when expecting one of: ( , ; ...
write(*,*) .s."12.34"
-------------^
compilation aborted for xyz.f90 (code 1)

I think that the code is correct; am I wrong?

Thank you,
Marco


ifort -V
Intel Fortran Intel 64 Compiler Professional for applications running on Intel 64, Version 11.1 Build 20091012 Package ID: l_cprof_p_11.1.056
Copyright (C) 1985-2009 Intel Corporation. All rights reserved.


module m

interface operator(.s.)
module procedure afun
end interface

contains

pure function afun(s) result(x)
character(len=*), intent(in) :: s
real :: x
read(s,*) x
end function afun

end module m

program xyz
use m

write(*,*) .s."12.34"
!write(*,*) (.s."12.34") ! this works
end program xyz


0 Kudos
2 Replies
Steven_L_Intel1
Employee
445 Views

Marco,

You're correct - this does indeed seem to be a bug. I'll let the developers know - thanks.
0 Kudos
Steven_L_Intel1
Employee
445 Views
This will be fixed in the next major release.
0 Kudos
Reply