-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix iomsg allocation in save_npy #600
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, thanks for fixing it
@@ -128,7 +128,9 @@ contains | |||
end if | |||
|
|||
if (present(iomsg)) then | |||
iomsg = "Failed to write array to file '"//filename//"'" | |||
if (stat /= 0) then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not check for present(iomsg) .and. stat /= 0
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did that initially, but then decided to go with nested if's to avoid the .and.
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
This is currently just a draft for a minor issue remaining in #581.
I've added a test to check that iomsg is deallocated if present, although this should technically be guaranteed by a standard-conforming compiler when the
intent(out)
attribute is present.To make sure the message gets allocated I need a way to trigger
stat /= 0
. Is their any known way of doing this for a new file?On more thought, I'm afraid that both
stat
andiomsg
only communicate the result of the commandclose()
, and not if opening or writing were unsuccessful. I'm not sure whether the standard stipulates these commands be connected (in other words whether the same I/O error will trigger the same iostat flag in any of the three commands).