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

fortran_winprintdirect appears to currupt something.

sgongola
Beginner
905 Views
I have a problem with fortran_winprintdirect in the following code snippet. The first two times work. The file is opened, print_direct generates the output, the file is closed. The third open fails with iostat=45.

With the calls to print_direct commented, the failure does not occur. It looks like print_direct is currupting something somewhere causing the third open to fail.

qstr="aptrac."
open (unit=12,file=qstr,form="formatted",status="old",
1 action="read",err=1001,iostat=istat)
istat = Print_direct (12, .FALSE.)
close(unit=12,iostat=istat)
qstr="aptrac."
open (unit=12,file=qstr,form="formatted",status="old",
1 action="read",err=1001,iostat=istat)
istat = Print_direct (12, .FALSE.)
close(unit=12,iostat=istat)
qstr="aptrac."
open (unit=12,file=qstr,form="formatted",status="old",
1 action="read",err=1001,iostat=istat)
istat = Print_direct (12, .FALSE.)
close(unit=12,iostat=istat)
qstr="aptrac."
open (unit=12,file=qstr,form="formatted",status="old",
1 action="read",err=1001,iostat=istat)
istat = Print_direct (12, .FALSE.)
close(unit=12,iostat=istat)
qstr="aptrac."
open (unit=12,file=qstr,form="formatted",status="old",
1 action="read",err=1001,iostat=istat)
istat = Print_direct (12, .FALSE.)
close(unit=12,iostat=istat)

The original code was a loop passing different file names to print_direct and always failing at the third 'open'. The supplied code was my final test to determine if winprintdirect is involved with the problem.
0 Kudos
7 Replies
durisinm
Novice
905 Views
The IOSTAT value of 45 means that there is a keyword value error in an OPEN statement. All of your OPEN statements look identical to me, so that doesn't seem to make sense.

The only thing I can think of is that you are using double quotes to delimit your argument values, while the online documentation always shows its examples with single quotes. Try switching the double quotes for single ones to see if it makes a difference.

Even if this works, though, it would be inconsistent. Why would CVF complain on the third OPEN statement and not the first two?

Mike
0 Kudos
Steven_L_Intel1
Employee
905 Views
This is truly bizarre. Would you please send your sample code and data file in a ZIP archive to me at steve.lionel@intel.com? I'd like to look at it.

Single vs. double quotes is not an issue here.

Steve
0 Kudos
sgongola
Beginner
905 Views
I think it comes down to some conflicting compile specifications between the modules. Attached are the test source that calls fortran_winprintdirect and a 'listing'
of the compiles. I converted the original f77 code to f90
in case that was the problem.
0 Kudos
sgongola
Beginner
905 Views
I think it comes down to some conflicting compile specifications between the modules. Attached are the test source that calls fortran_winprintdirect and a 'listing'
of the compiles. I converted the original f77 code to f90
in case that was the problem.
0 Kudos
Steven_L_Intel1
Employee
905 Views
"conflicting compile specifications" don't seem to be an issue here (nor do I see any).

Your sample code works ok for me, though I notice you close unit 12 again unnecessarily at the end of the program. I don't get an error.

Steve
0 Kudos
sgongola
Beginner
905 Views
I figured it out. I was using /iface:cref in our fortran in order to
interface with existing 'other' code. Not knowing fortran 90, I used
the default specs for the fortran_winprintdirect file supplied by visual
fortrans export makefile. I didn't know any better and the original code
worked fine for the first 2 OPENs. The difference between /iface:cref
and /iface=default includes handling of the stack by caller/calee. The
stack got messed up enough by the third call to print_direct to cause
the problem.

thank you
sol
0 Kudos
Steven_L_Intel1
Employee
905 Views
I'm glad you figured it out.

By the way, you are using Fortran 90 whether you know it or not!

Steve
0 Kudos
Reply