Skip to content

Commit 8df6df3

Browse files
committed
[android][test] Explicitly sign chars to match expectations
`char` is not always signed by default. In fact, the signedness of the `char` datatype in C is undefined. That means that on some architectures, the `c_layout.sil` test fails, because it expects the IR for `char chareth(char a);` to use `signedext`, whereas some architectures treat these types as unsigned, and thus `zeroext` is used. In order to ensure identical signedness on all platforms the tests run on, explicitly specify the signedness using the compiler flag `-fsigned-char`. It would be better to test the signedness for each platform, as suggested in swiftlang#1103. This is an interim solution.
1 parent 5b1d25f commit 8df6df3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

test/IRGen/c_layout.sil

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
// RUN: %target-swift-frontend -I %S/Inputs/abi %s -emit-ir | FileCheck %s --check-prefix=CHECK-%target-cpu
1+
// FIXME: Rather than passing `-fsigned-char`, this should test each platform's expected char
2+
// signedness. For Android, this means implicitly unsigned. See: https://github.com/apple/swift/pull/1103
3+
// RUN: %target-swift-frontend -Xcc -fsigned-char -I %S/Inputs/abi %s -emit-ir | FileCheck %s --check-prefix=CHECK-%target-cpu
24

35
sil_stage canonical
46
import c_layout

0 commit comments

Comments
 (0)