Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Fortran/cray/f2023/12/11/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
file(GLOB Source *.f90)

llvm_singlesource()

file(COPY lit.local.cfg DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")
53 changes: 53 additions & 0 deletions Fortran/cray/f2023/12/11/io-after-close.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
program io_after_close

implicit none
integer :: n, k, l
logical :: ok

ok = .true.

open(5, err=500, iostat=n)
k = 45
goto 505
500 continue
k = 46
505 continue
print *, 'k after OPEN:', k
ok = ok .and. (k == 45)

close(5, err=510, iostat=n)
k = 55
goto 515
510 continue
k = 56
515 continue
print *, 'k after CLOSE:', k
ok = ok .and. (k == 55)

read(5, err=520, iostat=n) l
k = 65
goto 523
520 continue
k = 66
523 continue
print *, 'iostat after read:', n, ' k:', k
ok = ok .and. (k == 66)

l = 34
write(5, err=525, iostat=n) l
k = 65
goto 528
525 continue
k = 66
528 continue
print *, 'iostat after write:', n, ' k:', k
ok = ok .and. (k == 66)

if (ok) then
print *, 'PASS'
else
print *, 'FAIL'
end if

end program io_after_close

5 changes: 5 additions & 0 deletions Fortran/cray/f2023/12/11/io-after-close.reference_output
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
k after OPEN: 45
k after CLOSE: 55
iostat after read: 0 k: 65
iostat after write: 0 k: 65
FAIL
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test fails?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eugene is right. This expected output is not correct. If your test is successful in branching to the error label for the last 2 cases, then your "k" value should be "66" for both and the final should be PASS.

2 changes: 2 additions & 0 deletions Fortran/cray/f2023/12/11/lit.local.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
config.traditional_output = True
config.single_source = True
1 change: 1 addition & 0 deletions Fortran/cray/f2023/12/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add_subdirectory(11)
1 change: 1 addition & 0 deletions Fortran/cray/f2023/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
add_subdirectory(10)
add_subdirectory(13)
add_subdirectory(16)
add_subdirectory(12)