History log of /llvm-project/flang/runtime/iostat.cpp (Results 1 – 25 of 29)
Revision Date Author Comments
# 8ebf7411 25-Mar-2024 Slava Zakharin <szakharin@nvidia.com>

[flang][runtime] Prepare enabling PRINT of integer32 for device. (#86247)

This commit adds required files into the offload build closure,
which means adding RT_API_ATTRS and other markers.

The i

[flang][runtime] Prepare enabling PRINT of integer32 for device. (#86247)

This commit adds required files into the offload build closure,
which means adding RT_API_ATTRS and other markers.

The implementation does not work for CUDA yet, because of
std::variant,swap,reverse usage. These issues will be resolved
separately (e.g. by using libcudacxx header files).

show more ...


# 10f15e2e 11-Dec-2023 Peter Klausler <35819229+klausler@users.noreply.github.com>

[flang][runtime] Crash more informatively in defined I/O error case (#74134)

Defined unformatted I/O is not allowed except from/to an external unit.
This restriction prohibits an INQUIRE(IOLENGTH=n

[flang][runtime] Crash more informatively in defined I/O error case (#74134)

Defined unformatted I/O is not allowed except from/to an external unit.
This restriction prohibits an INQUIRE(IOLENGTH=n) statement from using
derived types with defined unformatted output in its I/O list. The
runtime currently detects this case and crashes with an internal error;
this patch defines a new I/O error enum and causes the program to crash
with a more useful message.

show more ...


# 37ea42b2 18-Sep-2023 Peter Klausler <35819229+klausler@users.noreply.github.com>

[flang][runtime] Enforce proper termination of list-directed input va… (#66244)

…lues

Emit an error at runtime when a list-directed input value is not
followed by a value separator or end of rec

[flang][runtime] Enforce proper termination of list-directed input va… (#66244)

…lues

Emit an error at runtime when a list-directed input value is not
followed by a value separator or end of record. Previously, the runtime
I/O library was consuming as many input characters that were valid for
the type of the value, and leaving any remaining characters for the next
input edit, if any.

show more ...


# afdbf1b7 19-Jul-2023 Peter Klausler <pklausler@nvidia.com>

[flang][runtime] Detect NEWUNIT= without FILE= or STATUS='SCRATCH'

It is an error to open a new unit with OPEN(NEWUNIT=) and have
neither a file name nor a scratch status. Catch it, and report a
ne

[flang][runtime] Detect NEWUNIT= without FILE= or STATUS='SCRATCH'

It is an error to open a new unit with OPEN(NEWUNIT=) and have
neither a file name nor a scratch status. Catch it, and report a
new error code.

Differential Revision: https://reviews.llvm.org/D155967

show more ...


# 79f6b812 08-Mar-2023 Peter Klausler <pklausler@nvidia.com>

[flang][runtime] Corrections to formatted child I/O

A handful of I/O statements (OPEN, CLOSE, positioning) are not allowed
on units during child I/O; catch violations and report errors.
Also finesse

[flang][runtime] Corrections to formatted child I/O

A handful of I/O statements (OPEN, CLOSE, positioning) are not allowed
on units during child I/O; catch violations and report errors.
Also finesse error handling during FORMAT runtime parsing of DT
derived type edit descriptors, and ensure that formatted child
I/O is nonadvancing.

Differential Revision: https://reviews.llvm.org/D145751

show more ...


# c078e464 22-Jun-2022 Peter Klausler <pklausler@nvidia.com>

[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 ...


# cfbde714 11-Jun-2022 Peter Klausler <pklausler@nvidia.com>

[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 ...


# 142db43b 09-Jun-2022 Peter Klausler <pklausler@nvidia.com>

[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 ...


# 166d6ed5 06-Jun-2022 Peter Klausler <pklausler@nvidia.com>

[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 <pklausler@nvidia.com>

[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 ...


# 9c54d762 03-Jun-2022 Peter Klausler <pklausler@nvidia.com>

[flang][runtime] Signal new I/O error on floating-point input overflow

Besides raising the IEEE floating-point overflow exception, treat
a floating-point overflow on input as an I/O error catchable

[flang][runtime] Signal new I/O error on floating-point input overflow

Besides raising the IEEE floating-point overflow exception, treat
a floating-point overflow on input as an I/O error catchable with
ERR=, IOSTAT=, &/or IOMSG=.

Differential Revision: https://reviews.llvm.org/D127022

show more ...


# cdd54cbd 20-May-2022 Peter Klausler <pklausler@nvidia.com>

[flang][runtime] Catch decimal integer input overflow

B/O/Z input overflow is already caught, and real input overflow
is signalled as an IEEE arithmetic exception, but regular decimal
integer overfl

[flang][runtime] Catch decimal integer input overflow

B/O/Z input overflow is already caught, and real input overflow
is signalled as an IEEE arithmetic exception, but regular decimal
integer overflow was silent.

Differential Revision: https://reviews.llvm.org/D126155

show more ...


# deb62f5a 12-May-2022 Peter Klausler <pklausler@nvidia.com>

[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 ...


# c02abb68 22-Apr-2022 Peter Klausler <pklausler@nvidia.com>

[flang][runtime] Enforce some limits on kP scale factors

Ew.d and Dw.d output edit descriptors should respect limitations from
the standard on the value of a kP scale factor with respect to the
digi

[flang][runtime] Enforce some limits on kP scale factors

Ew.d and Dw.d output edit descriptors should respect limitations from
the standard on the value of a kP scale factor with respect to the
digit count (d), at least for values of k other than zero.

Differential Revision: https://reviews.llvm.org/D124300

show more ...


# e6873bfb 06-Apr-2022 Peter Klausler <pklausler@nvidia.com>

[flang][runtime] Don't skip input spaces when they are significant

When formatted input (not list-directed or NAMELIST) is in "BZ" mode,
either because a BZ control edit descriptor appeared in a FOR

[flang][runtime] Don't skip input spaces when they are significant

When formatted input (not list-directed or NAMELIST) is in "BZ" mode,
either because a BZ control edit descriptor appeared in a FORMAT or
BLANK="ZERO" appeared in OPEN or READ, input editing must not skip
over blanks before or within the input field.

Differential Revision: https://reviews.llvm.org/D123725

show more ...


# c58c64d0 06-Apr-2022 Jean Perier <jperier@nvidia.com>

[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 ...


# bafbae23 16-Mar-2022 Peter Klausler <pklausler@nvidia.com>

[flang] Initial UTF-8 support in runtime I/O

Implements UTF-8 encoding and decoding for external units
with OPEN(ENCODING='UTF-8'). This encoding applies to default
CHARACTER values that are not 7-

[flang] Initial UTF-8 support in runtime I/O

Implements UTF-8 encoding and decoding for external units
with OPEN(ENCODING='UTF-8'). This encoding applies to default
CHARACTER values that are not 7-bit ASCII as well as to
the wide CHARACTER kinds 2 and 4. Basic testing is in place
via direct calls to the runtime I/O APIs, but serious checkout
awaits lowering support of the wide CHARACTER kinds.

Differential Revision: https://reviews.llvm.org/D122038

show more ...


# 461b6fe4 15-Mar-2022 Peter Klausler <pklausler@nvidia.com>

[flang] Expose error recovery cases in external I/O

Some I/O error situations are current handled with fatal
runtime asserts, but should be exposed for user program
error recovery.

Differential Rev

[flang] Expose error recovery cases in external I/O

Some I/O error situations are current handled with fatal
runtime asserts, but should be exposed for user program
error recovery.

Differential Revision: https://reviews.llvm.org/D122049

show more ...


# e3550f19 11-Mar-2022 Peter Steinfeld <psteinfeld@nvidia.com>

[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 ...


# df38f35a 16-Feb-2022 Peter Klausler <pklausler@nvidia.com>

[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 ...


# 991696c2 28-Jan-2022 Peter Klausler <pklausler@nvidia.com>

[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 <andrzej.warzynski@arm.com>

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 ...


# be9946b8 28-Jan-2022 Peter Klausler <pklausler@nvidia.com>

[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 ...


# ac4202fe 07-Jan-2022 Peter Klausler <pklausler@nvidia.com>

[flang] Signal runtime error on WRITE after ENDFILE

After an ENDFILE statement, a WRITE is an error without
a prior BACKSPACE. Also fix the return value for the case
of formatted integer input with

[flang] Signal runtime error on WRITE after ENDFILE

After an ENDFILE statement, a WRITE is an error without
a prior BACKSPACE. Also fix the return value for the case
of formatted integer input with no input digits to be false
(exposed by new test).

Differential Revision: https://reviews.llvm.org/D117346

show more ...


# 830c0b90 01-Sep-2021 Peter Klausler <pklausler@nvidia.com>

[flang] Move runtime API headers to flang/include/flang/Runtime

Move the closure of the subset of flang/runtime/*.h header files that
are referenced by source files outside flang/runtime (apart from

[flang] Move runtime API headers to flang/include/flang/Runtime

Move the closure of the subset of flang/runtime/*.h header files that
are referenced by source files outside flang/runtime (apart from unit tests)
into a new directory (flang/include/flang/Runtime) so that relative
include paths into ../runtime need not be used.

flang/runtime/pgmath.h.inc is moved to flang/include/flang/Evaluate;
it's not used by the runtime.

Differential Revision: https://reviews.llvm.org/D109107

show more ...


12