vivkong
(Vivian Kong)
1
Our nightly master branch build on s390x failed with the following error:
09:09:39 /home/swiftbuild/workspace/Swift/CONFIG/FIVE/GIT_BRANCH/master/label/csz25097/swift/lib/Parse/Lexer.cpp:2460:17: error: overflow converting case value to switch condition type (-2 to 254) [-Werror,-Wswitch]
09:09:39 case -1: case -2:
09:09:39 ^
09:09:39 /home/swiftbuild/workspace/Swift/CONFIG/FIVE/GIT_BRANCH/master/label/csz25097/swift/lib/Parse/Lexer.cpp:2460:8: error: overflow converting case value to switch condition type (-1 to 255) [-Werror,-Wswitch]
09:09:39 case -1: case -2:
09:09:39 ^
09:09:39 2 errors generated.
Looks like this commit introduced the new code in question:
https://github.com/apple/swift/commit/22cddbf033e0cba7e584fcafaa16af22a1e4281d#diff-bacd55a550c89a67b8a470ce30b46dda
Any suggestions on how to fix this?
Thanks.
jrose
(Jordan Rose)
2
I think the usual thing would be to comment on @omochimetaru's PR (but tagging them here since there is a thread now). It seems like a simple enough thing to fix (case (uint8_t)-1).
EDIT: Ah, it's probably that char is signed on Mac and x86_64 Linux platforms but unsigned on s390x. So casting to char would be the fix, not to uint8_t.
rintaro
(Rintaro Ishizaki)
3
Ah, you can use the same treatment in lexImpl()
Sorry for inconvenience.
I will submit a patch.
rintaro
(Rintaro Ishizaki)
5