problem with FLUSH while redirecting stdout

problem with FLUSH while redirecting stdout


I get the error message "FLUSH--FAILED:: Bad address" when flush() is called for stdout under certain circumstances.
The following small code reproduces the problem:

program flushtest
write(*,*) "now flushing"
call flush(6)
write(*,*) "after flush"

Executing this code ("flushtest") produces the standard output

now flushing
after flush

as expected. You can also redirect this output and append it to an existing text file "abc":

flushtest >> abc

This works as expected as long as "abc" does not contain more than 1023 characters! If "abc" contains 1024 or more characters, a series of the special character "^@" is flushed and the abovementioned error message is issued.
Does somebody know the reason for this strange behaviour? Any workarounds for this problem?

(I'm using ifc 7.0 built in October 2002, Kernel 2.4.)


5 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

In the meantime I found an ugly workaround:

flushtest | cat - >> abc

But this of course is not a solution to the problem.


What happens if you write to unit 6 and not *? By the standard, these are supposed to be distinct.

If you think it's a bug, please report it to Premier Support - the behavior you describe sounds like a bug to me.


Retired 12/31/2016

No matter whether the code writes to unit "*" or "6". I observed the same strange behaviour in both cases.

Since I don't have Premier Support I think that compiler bugs posted in this forum should be considered by the Intel-Premier-Support-people (given they read it) anyway for the next release of the compiler.


Anyone who has a copy of the Intel compiler is eligible to sign up for Premier Support and you can report bugs that way. If you have a noncommercial license, you may not get access to fixes right away, but you should at least get an appropriate response, and Premier Support is the only way that problem reports are tracked. This is a user forum, not a formal Intel support channel.


Retired 12/31/2016

Leave a Comment

Please sign in to add a comment. Not a member? Join today