Skip to content

Commit 56aa935

Browse files
[flang-rt] Fix warnings
This patch fixes: flang-rt/include/flang-rt/runtime/emit-encoded.h:67:27: error: implicit conversion from 'const char16_t' to 'char32_t' may change the meaning of the represented code unit [-Werror,-Wcharacter-conversion] flang-rt/lib/runtime/edit-input.cpp:1114:18: error: implicit conversion from 'char32_t' to 'char16_t' may lose precision and change the meaning of the represented code unit [-Werror,-Wcharacter-conversion] flang-rt/lib/runtime/edit-input.cpp:1133:18: error: implicit conversion from 'char32_t' to 'char16_t' may lose precision and change the meaning of the represented code unit [-Werror,-Wcharacter-conversion] flang-rt/lib/runtime/edit-input.cpp:1033:14: error: implicit conversion from 'char32_t' to 'char16_t' may lose precision and change the meaning of the represented code unit [-Werror,-Wcharacter-conversion] flang-rt/lib/runtime/edit-input.cpp:986:14: error: implicit conversion from 'char32_t' to 'char16_t' may lose precision and change the meaning of the represented code unit [-Werror,-Wcharacter-conversion]
1 parent 8d3a707 commit 56aa935

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

flang-rt/include/flang-rt/runtime/emit-encoded.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ RT_API_ATTRS bool EmitEncoded(
6464
} else {
6565
// CHARACTER kind conversion for internal output
6666
while (chars-- > 0) {
67-
char32_t buffer = *data++;
67+
char32_t buffer = static_cast<char32_t>(*data++);
6868
char *p{reinterpret_cast<char *>(&buffer)};
6969
if constexpr (!isHostLittleEndian) {
7070
p += sizeof(buffer) - internalKind;

flang-rt/lib/runtime/edit-input.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -983,7 +983,7 @@ static RT_API_ATTRS bool EditDelimitedCharacterInput(
983983
}
984984
}
985985
if (length > 0) {
986-
*x++ = *ch;
986+
*x++ = static_cast<CHAR>(*ch);
987987
--length;
988988
}
989989
}
@@ -1030,7 +1030,7 @@ static RT_API_ATTRS bool EditListDirectedCharacterInput(
10301030
break;
10311031
}
10321032
if (length > 0) {
1033-
*x++ = *ch;
1033+
*x++ = static_cast<CHAR>(*ch);
10341034
--length;
10351035
} else if (edit.IsNamelist()) {
10361036
// GNU compatibility
@@ -1111,7 +1111,7 @@ RT_API_ATTRS bool EditCharacterInput(IoStatementState &io, const DataEdit &edit,
11111111
(sizeof *x == 2 && *ucs > 0xffff)) {
11121112
*x++ = '?';
11131113
} else {
1114-
*x++ = *ucs;
1114+
*x++ = static_cast<CHAR>(*ucs);
11151115
}
11161116
--lengthChars;
11171117
} else if (chunkBytes == 0) {
@@ -1130,7 +1130,7 @@ RT_API_ATTRS bool EditCharacterInput(IoStatementState &io, const DataEdit &edit,
11301130
(sizeof *x == 2 && buffer > 0xffff)) {
11311131
*x++ = '?';
11321132
} else {
1133-
*x++ = buffer;
1133+
*x++ = static_cast<CHAR>(buffer);
11341134
}
11351135
--lengthChars;
11361136
}

0 commit comments

Comments
 (0)