Skip to content

Commit 6fd475f

Browse files
authored
[flang][runtime] 'A' output editing for LOGICAL (#89817)
We support 'A' output editing for INTEGER and REAL as an extension; it turns out to be used as well for LOGICAL in application code.
1 parent 68a2798 commit 6fd475f

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

flang/runtime/edit-output.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -822,6 +822,11 @@ RT_API_ATTRS bool EditLogicalOutput(
822822
case 'Z':
823823
return EditBOZOutput<4>(io, edit,
824824
reinterpret_cast<const unsigned char *>(&truth), sizeof truth);
825+
case 'A': { // legacy extension
826+
int truthBits{truth};
827+
return EditCharacterOutput(
828+
io, edit, reinterpret_cast<char *>(&truthBits), sizeof truthBits);
829+
}
825830
default:
826831
io.GetIoErrorHandler().SignalError(IostatErrorInFormat,
827832
"Data edit descriptor '%c' may not be used with a LOGICAL data item",

flang/unittests/Runtime/RuntimeCrashTest.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,6 @@ TEST(TestTerminator, CheckFailedTest) {
5353
//------------------------------------------------------------------------------
5454
struct TestIOCrash : CrashHandlerFixture {};
5555

56-
TEST(TestIOCrash, FormatDescriptorWriteMismatchTest) {
57-
static constexpr int bufferSize{4};
58-
static char buffer[bufferSize];
59-
static const char *format{"(A4)"};
60-
auto *cookie{IONAME(BeginInternalFormattedOutput)(
61-
buffer, bufferSize, format, std::strlen(format))};
62-
ASSERT_DEATH(IONAME(OutputLogical)(cookie, true),
63-
"Data edit descriptor 'A' may not be used with a LOGICAL data item");
64-
}
65-
6656
TEST(TestIOCrash, InvalidFormatCharacterTest) {
6757
static constexpr int bufferSize{1};
6858
static char buffer[bufferSize];

0 commit comments

Comments
 (0)