|
Revision tags: llvmorg-20.1.0, llvmorg-20.1.0-rc3, llvmorg-20.1.0-rc2, llvmorg-20.1.0-rc1, llvmorg-21-init, llvmorg-19.1.7, llvmorg-19.1.6, llvmorg-19.1.5, llvmorg-19.1.4, llvmorg-19.1.3, llvmorg-19.1.2, llvmorg-19.1.1, llvmorg-19.1.0, llvmorg-19.1.0-rc4, llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init, llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6, llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init, llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init, llvmorg-16.0.6, llvmorg-16.0.5, llvmorg-16.0.4, llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1, llvmorg-16.0.0, llvmorg-16.0.0-rc4, llvmorg-16.0.0-rc3, llvmorg-16.0.0-rc2, llvmorg-16.0.0-rc1, llvmorg-17-init, llvmorg-15.0.7, llvmorg-15.0.6, llvmorg-15.0.5, llvmorg-15.0.4, llvmorg-15.0.3, llvmorg-15.0.2, llvmorg-15.0.1, llvmorg-15.0.0, llvmorg-15.0.0-rc3, llvmorg-15.0.0-rc2, llvmorg-15.0.0-rc1, llvmorg-16-init |
|
| #
c078e464 |
| 22-Jun-2022 |
Peter Klausler <[email protected]> |
[flang][runtime] FLUSH(bad or unconnected unit number) is an error
Some I/O control statements are no-ops when attempted on a bad or unconnected UNIT=, but the standard says that FLUSH is an error i
[flang][runtime] FLUSH(bad or unconnected unit number) is an error
Some I/O control statements are no-ops when attempted on a bad or unconnected UNIT=, but the standard says that FLUSH is an error in that case.
Differential Revision: https://reviews.llvm.org/D128392
show more ...
|
|
Revision tags: llvmorg-14.0.6 |
|
| #
d771245a |
| 17-Jun-2022 |
Peter Klausler <[email protected]> |
[flang] Fix READ/WRITE with POS= on stream units, with refactoring
First, ExternalFileUnit::SetPosition was being used both as a utility within the class' member functions as well as an API from I/O
[flang] Fix READ/WRITE with POS= on stream units, with refactoring
First, ExternalFileUnit::SetPosition was being used both as a utility within the class' member functions as well as an API from I/O statement processing. Make it private, and add APIs for SetStreamPos and SetDirectRec.
Second, ensure that SetStreamPos for POS= positioning in a stream doesn't leave the current record number and endfile record number in an arbitrary state. In stream I/O they are used only to manage end-of-file detection, and shouldn't produce false positive results from IsAtEnd() after repositioning.
Differential Revision: https://reviews.llvm.org/D128388
show more ...
|
| #
17853928 |
| 15-Jun-2022 |
Peter Klausler <[email protected]> |
[flang] Correct implementation of WAIT with no ID
Previous one was returning a bogus error status about a bad WAIT statement ID number.
Differential Revision: https://reviews.llvm.org/D127979
|
| #
cfbde714 |
| 11-Jun-2022 |
Peter Klausler <[email protected]> |
[flang][runtime] Catch more (all?) negative unit number errors
Fortran does have negative unit numbers -- they show up in child I/O subroutines for defined I/O and for OPEN(NEWUNIT=) -- but the runt
[flang][runtime] Catch more (all?) negative unit number errors
Fortran does have negative unit numbers -- they show up in child I/O subroutines for defined I/O and for OPEN(NEWUNIT=) -- but the runtime needs to catch the cases where a negative unit number that wasn't generated by the runtime is passed in for OPEN or for an I/O statement that would ordinarily create an anonymous "fort.NNN" file for a hitherto unseen unit.
Differential Revision: https://reviews.llvm.org/D127788
show more ...
|
|
Revision tags: llvmorg-14.0.5 |
|
| #
142db43b |
| 09-Jun-2022 |
Peter Klausler <[email protected]> |
[flang][runtime] Allow recovery from BACKSPACE(badUnit)
When an unconnected unit number is used in a BACKSPACE statement with ERR=, IOSTAT=, &/or IOMSG= control specifiers, don't crash, but let the
[flang][runtime] Allow recovery from BACKSPACE(badUnit)
When an unconnected unit number is used in a BACKSPACE statement with ERR=, IOSTAT=, &/or IOMSG= control specifiers, don't crash, but let the program deal with the error.
Differential Revision: https://reviews.llvm.org/D127782
show more ...
|
| #
2a07db4c |
| 06-Jun-2022 |
Peter Klausler <[email protected]> |
[flang][runtime] Don't crash after reporting I/O statement errors
When an I/O statement is known to be in a recoverable error state, it shouldn't cause a crash later in execution because it's not in
[flang][runtime] Don't crash after reporting I/O statement errors
When an I/O statement is known to be in a recoverable error state, it shouldn't cause a crash later in execution because it's not in an expected non-erroneous processing state. Add checking for the ErroneousIoStatementState variant on paths that might otherwise lead to runtime crashes.
Differential Revision: https://reviews.llvm.org/D127423
show more ...
|
| #
166d6ed5 |
| 06-Jun-2022 |
Peter Klausler <[email protected]> |
[flang][runtime] Better (but still synchronous) support for asynchronous I/O
Track pending "asynchronous" I/O operation IDs so that WAIT statements can report errors about bad ID numbers.
Lowering
[flang][runtime] Better (but still synchronous) support for asynchronous I/O
Track pending "asynchronous" I/O operation IDs so that WAIT statements can report errors about bad ID numbers.
Lowering will need to extended to call GetAsynchronousId() for a READ or WRITE statement with ID=n.
Differential Revision: https://reviews.llvm.org/D127421
show more ...
|
| #
03c066ab |
| 03-Jun-2022 |
Peter Klausler <[email protected]> |
[flang][runtime] Catch OPEN of connected file
Diagnose OPEN(FILE=f) when f is already connected by the same name to a distinct external I/O unit.
Differential Revision: https://reviews.llvm.org/D12
[flang][runtime] Catch OPEN of connected file
Diagnose OPEN(FILE=f) when f is already connected by the same name to a distinct external I/O unit.
Differential Revision: https://reviews.llvm.org/D127035
show more ...
|
| #
11f928af |
| 02-Jun-2022 |
Peter Klausler <[email protected]> |
[flang][runtime] Fix deadlock in error recovery
When an external I/O statement is in a recoverable error state before any data transfers take place (for example, an unformatted transfer with ERR=/IO
[flang][runtime] Fix deadlock in error recovery
When an external I/O statement is in a recoverable error state before any data transfers take place (for example, an unformatted transfer with ERR=/IOSTAT=/IOMSG= attempted on a formatted unit), ensure that the unit's mutex is still released at the end of the statement.
Differential Revision: https://reviews.llvm.org/D127032
show more ...
|
|
Revision tags: llvmorg-14.0.4 |
|
| #
d90e866a |
| 18-May-2022 |
Peter Klausler <[email protected]> |
[flang][runtime] INQUIRE(UNIT=666,NUMBER=n) must set n=666
Whether a unit number in an inquire-by-unit statement is valid or not, it should be the value to which the NUMBER= variable is set, not -1.
[flang][runtime] INQUIRE(UNIT=666,NUMBER=n) must set n=666
Whether a unit number in an inquire-by-unit statement is valid or not, it should be the value to which the NUMBER= variable is set, not -1. -1 should be returned to NUMBER= only for an inquire-by-file statement when the FILE= is not connected to any unit.
Differential Revision: https://reviews.llvm.org/D126145
show more ...
|
| #
deb62f5a |
| 12-May-2022 |
Peter Klausler <[email protected]> |
[flang][runtime] Clean up asynchronous I/O APIs
Now that the requirements and implementation of asynchronous I/O are better understood, adjust their I/O runtime APIs. In particular: 1) Remove the B
[flang][runtime] Clean up asynchronous I/O APIs
Now that the requirements and implementation of asynchronous I/O are better understood, adjust their I/O runtime APIs. In particular: 1) Remove the BeginAsynchronousOutput/Input APIs; they're not needed, since any data transfer statement might have ASYNCHRONOUS= and (if ASYNCHRONOUS='YES') ID= control list specifiers that need to at least be checked. 2) Add implementations for BeginWait(All) to check for the error case of a bad unit number and nonzero ID=. 3) Rearrange and comment SetAsynchronous so that it's clear that it can be called for READ/WRITE as well as for OPEN.
The implementation remains completely synchronous, but should be conforming. Where opportunities make sense for true asynchronous implementations of some big block transfers without SIZE= in the future, we'll need to add a GetAsynchronousId API to capture ID= on a READ or WRITE; add sourceFile and sourceLine arguments to BeginWait(All) for good error reporting; track pending operations in unit.h; and add code to force synchronization to non-asynchronous I/O operations.
Lowering should call SetAsynchronous when ASYNCHRONOUS= appears as a control list specifier. It should also set ID=x variables to 0 until such time as we support asynchronous operations, if ever. This patch only removes the removed APIs from lowering.
Differential Revision: https://reviews.llvm.org/D126143
show more ...
|
|
Revision tags: llvmorg-14.0.3 |
|
| #
cea8b8a7 |
| 27-Apr-2022 |
Peter Klausler <[email protected]> |
[flang][runtime] Don't pad CHARACTER input at end of record unless PAD='YES'
When formatted CHARACTER input runs into the end of an input record, the runtime usually fills the remainder of the varia
[flang][runtime] Don't pad CHARACTER input at end of record unless PAD='YES'
When formatted CHARACTER input runs into the end of an input record, the runtime usually fills the remainder of the variable with spaces, but this should be conditional, and not done when PAD='NO'.
And while here, add some better comments to two members of connection.h to make their non-obvious relationship more clear.
Differential Revision: https://reviews.llvm.org/D125053
show more ...
|
|
Revision tags: llvmorg-14.0.2, llvmorg-14.0.1 |
|
| #
9cfa899b |
| 11-Apr-2022 |
Jean Perier <[email protected]> |
[flang] add a static assert in CheckUnitNumberInRangeImpl
Add a check that CheckUnitNumberInRangeImpl is not needlessly instantiated.
Differential Revision: https://reviews.llvm.org/D123285
|
| #
c58c64d0 |
| 06-Apr-2022 |
Jean Perier <[email protected]> |
[flang] Add runtime API to catch unit number out of range
Unit numbers must fit on a default integer. It is however possible that the user provides the unit number in UNIT with a wider integer type.
[flang] Add runtime API to catch unit number out of range
Unit numbers must fit on a default integer. It is however possible that the user provides the unit number in UNIT with a wider integer type. In such case, lowering was previously silently narrowing the value and passing the result to the BeginXXX runtime entry points. Cases where the conversion caused overflow were not reported/caught. Most existing compilers catch these errors and raise an IO error. Add a CheckUnitNumberInRange runtime API to do the same in f18.
This runtime API has its own error management interface (i.e., does not use GetIoMsg, EndIo, and EnableHandlers) because the usual error management requires BeginXXX to be called to set up the error management. But in this case, the BeginXXX cannot be called since the bad unit number that would be provided to it overflew (and in the worst case scenario, the narrowed value could point to a different valid unit already in use). Hence I decided to make an API that must be called before the BeginXXX and should trigger the whole BeginXXX/.../EndIoStatement to be skipped in case the unit number is too big and the user enabled error recovery.
Note that CheckUnitNumberInRange accepts negative numbers (as long as they can fit on a default integer), because unit numbers may be negative if they were created by NEWUNIT.
Differential Revision: https://reviews.llvm.org/D123157
show more ...
|
| #
8db4dc86 |
| 14-Mar-2022 |
Peter Klausler <[email protected]> |
[flang] Error recovery improvement in runtime (IOMSG=)
Some refactoring and related fixes for more accurate user program error recovery in the I/O runtime, especially for error recovery with IOMSG=
[flang] Error recovery improvement in runtime (IOMSG=)
Some refactoring and related fixes for more accurate user program error recovery in the I/O runtime, especially for error recovery with IOMSG= character values.
1) Move any work in an EndIoStatement() implementation that may raise an error into a new CompleteOperation() member function. This allows error handling APIs like GetIoMsg() to complete a pending I/O statement and harvest any errors that may result.
2) Move the pending error code from ErroneousIoStatementState to a new pendingError_ data member in IoErrorHandler. This allows IoErrorHandler::InError() to return a correct result when there is a pending error that will be recovered from so that I/O list data transfers don't crash in the meantime.
3) Don't create and leak a unit for a failed OPEN(NEWUNIT=n) with error recovery, and don't modify 'n'. (Depends on changes to API call ordering in lowering, in a separate patch; code was added to ensure that OPEN statement control list specifiers, e.g. SetFile(), must be passed before GetNewUnit().)
4) Fix the code that calls a form of strerror to fill an IOMSG= variable so that it actually works for Fortran's character type: blank fill with no null or newline termination.
Differential Revision: https://reviews.llvm.org/D122036
show more ...
|
|
Revision tags: llvmorg-14.0.0 |
|
| #
e3550f19 |
| 11-Mar-2022 |
Peter Steinfeld <[email protected]> |
[flang] Improve runtime crash messages
Where possible, I added additional information to the messages to help programmers figure out what went wrong. I also removed all uses of the word "bad" from
[flang] Improve runtime crash messages
Where possible, I added additional information to the messages to help programmers figure out what went wrong. I also removed all uses of the word "bad" from the messages since (to me) that implies a moral judgement rather than a programming error. I replaced it with either "invalid" or "unsupported" where appropriate.
Differential Revision: https://reviews.llvm.org/D121493
show more ...
|
|
Revision tags: llvmorg-14.0.0-rc4, llvmorg-14.0.0-rc3, llvmorg-14.0.0-rc2 |
|
| #
df38f35a |
| 16-Feb-2022 |
Peter Klausler <[email protected]> |
[flang] Allow data transfer stmt control list errors to be caught
The runtime crashes on several fundamental I/O data transfer statement control list errors, like list I/O on a direct-access unit, o
[flang] Allow data transfer stmt control list errors to be caught
The runtime crashes on several fundamental I/O data transfer statement control list errors, like list I/O on a direct-access unit, or input from a write-only unit, &c. These errors should not be fatal when ERR= or IOSTAT= are present.
This patch creates a new ErroneousIoStatementState class and uses it for the state of an I/O statement that is doomed to fail from these errors. If there is no ERR= label or IOSTAT= variable, the error will be raised at the end of the statement. Data transfer operations along the way will be no-op failures.
Differential Revision: https://reviews.llvm.org/D120745
show more ...
|
| #
73b193ae |
| 16-Feb-2022 |
Peter Klausler <[email protected]> |
[flang] Allow more concurrently open NEWUNIT= values, with recycling
Add a header-only implementation of Briggs & Torczon's fast small integer set data structure to flang/include/flang/Common, and u
[flang] Allow more concurrently open NEWUNIT= values, with recycling
Add a header-only implementation of Briggs & Torczon's fast small integer set data structure to flang/include/flang/Common, and use it in the runtime to manage a pool of Fortran unit numbers with recycling. This replaces the bit set previously used for that purpose. The set is initialized on demand with the negations of all the NEWUNIT= unit numbers that can be returned to any kind of integer variable.
For programs that require more concurrently open NEWUNIT= unit numbers than the pool can hold, they are now allocated with a non-recycling counter. This allows as many open units as the operating system provides.
Many of the top-line comments in flang/unittests/Runtime had the wrong path name. I noticed this while adding a unit test for the fast integer set data structure, and cleaned them up.
Differential Revision: https://reviews.llvm.org/D120685
show more ...
|
|
Revision tags: llvmorg-14.0.0-rc1, llvmorg-15-init |
|
| #
991696c2 |
| 28-Jan-2022 |
Peter Klausler <[email protected]> |
[flang] Debugging of ACCESS='STREAM' I/O (take 2)
Corrects the runtime implementation of I/O on files with the access mode ACCESS='STREAM'. This is a collection of edge-case tweaks to ensure that t
[flang] Debugging of ACCESS='STREAM' I/O (take 2)
Corrects the runtime implementation of I/O on files with the access mode ACCESS='STREAM'. This is a collection of edge-case tweaks to ensure that the distinctions between stream and direct/sequential files, unformatted or formatted, are respected where appropriate.
Moves NextInField() from io-stmt.h to io-stmt.cpp -- it was getting too big to keep in a header.
This patch exposed a problem with the I/O runtime on Windows and it was reverted. This version also fixes that problem; files are now opened on Windows in binary mode to prevent inadvertent insertions of carriage returns before line feeds, and those line endings (CR+LF) are now explicitly generated.
Differential Revision: https://reviews.llvm.org/D119015
show more ...
|
| #
4e53e283 |
| 03-Feb-2022 |
Andrzej Warzynski <[email protected]> |
Revert "[flang] Debugging of ACCESS='STREAM' I/O"
This reverts commit be9946b877add0db906090d22840b213c3f41dd2.
This change has caused Flang's Windows buildbot to start failing: * https://lab.llvm.
Revert "[flang] Debugging of ACCESS='STREAM' I/O"
This reverts commit be9946b877add0db906090d22840b213c3f41dd2.
This change has caused Flang's Windows buildbot to start failing: * https://lab.llvm.org/buildbot/#/builders/172/builds/7664
show more ...
|
| #
2b0b9b2e |
| 31-Jan-2022 |
Peter Klausler <[email protected]> |
[flang] Modify right modes for READ/WRITE vs OPEN
When a mode flag is modified (e.g., BLANK='ZERO') in an I/O data transfer statement, ensure that the right set of mode flags is modified. There's on
[flang] Modify right modes for READ/WRITE vs OPEN
When a mode flag is modified (e.g., BLANK='ZERO') in an I/O data transfer statement, ensure that the right set of mode flags is modified. There's one set of mode flags that are captured by an OPEN statement and maintained in the connection, and another that is maintained in an I/O statement state record for local mutability. Some I/O API routines were unconditionally modifying the persistent set of flags.
Differential Revision: https://reviews.llvm.org/D118835
show more ...
|
| #
be9946b8 |
| 28-Jan-2022 |
Peter Klausler <[email protected]> |
[flang] Debugging of ACCESS='STREAM' I/O
Corrects the runtime implementation of I/O on files with the access mode ACCESS='STREAM'. This is a collection of edge-case tweaks to ensure that the distin
[flang] Debugging of ACCESS='STREAM' I/O
Corrects the runtime implementation of I/O on files with the access mode ACCESS='STREAM'. This is a collection of edge-case tweaks to ensure that the distinctions between stream and direct/sequential files, unformatted or formatted, are respected where appropriate. Moves NextInField() from io-stmt.h to io-stmt.cpp -- it was getting too big to keep in a header.
Differential Revision: https://reviews.llvm.org/D118834
show more ...
|
| #
c7f4c333 |
| 26-Jan-2022 |
Peter Klausler <[email protected]> |
[flang] Make NEWUNIT= use a range suitable for INTEGER(KIND=1) and recycle unit numbers
Use a bit-set to manage runtime-generated I/O unit numbers, recycle them after they're closed, and use a range
[flang] Make NEWUNIT= use a range suitable for INTEGER(KIND=1) and recycle unit numbers
Use a bit-set to manage runtime-generated I/O unit numbers, recycle them after they're closed, and use a range of values that fits in a minimal-sized integer.
Differential Revision: https://reviews.llvm.org/D118651
show more ...
|
|
Revision tags: llvmorg-13.0.1, llvmorg-13.0.1-rc3 |
|
| #
e9d0f8ba |
| 14-Jan-2022 |
Peter Klausler <[email protected]> |
[flang] Don't drop format string for external child I/O
In user-defined derived type I/O to an external unit, don't omit the format string from the constructor of ChildFormattedIoStatement. And incl
[flang] Don't drop format string for external child I/O
In user-defined derived type I/O to an external unit, don't omit the format string from the constructor of ChildFormattedIoStatement. And include any user IOMSG text in the crash message of the parent, if it doesn't catch errors.
Differential Revision: https://reviews.llvm.org/D117903
show more ...
|
| #
b1856009 |
| 18-Jan-2022 |
Peter Klausler <[email protected]> |
[flang] Allow INQUIRE() on a child unit in user-defined I/O procedure
A procedure that implements a user-defined derived type I/O operation is allowed to perform an INQUIRE statement on its unit.
D
[flang] Allow INQUIRE() on a child unit in user-defined I/O procedure
A procedure that implements a user-defined derived type I/O operation is allowed to perform an INQUIRE statement on its unit.
Differential Revision: https://reviews.llvm.org/D117905https://reviews.llvm.org/D117905
show more ...
|