-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Tests] Re-enable the tests for integer overflow diagnostics #15811
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. It is great to see these re-enabled and using -verify instead of FileCheck!
See one comment inline about using PTRSIZE instead of enumerating architectures.
@@ -0,0 +1,235 @@ | |||
// RUN: %target-swift-frontend -emit-sil -primary-file %s -o /dev/null -verify | |||
// | |||
// REQUIRES: CPU=x86_64 || CPU=arm64 || CPU=powerpc64 || CPU=powerpc64le || CPU=s390x |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder it might be better to use PTRSIZE=64 and PTRSIZE=32. Pointer size and Int size aren't the same thing -- but this would avoid having to enumerate all 64-bit CPUs
} | ||
|
||
do { | ||
// bitwise operations. No overflows canhappen during these operations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo "canhappen"
@@ -0,0 +1,232 @@ | |||
// RUN: %target-swift-frontend -emit-sil -primary-file %s -o /dev/null -verify | |||
// | |||
// REQUIRES: CPU=i386 || CPU=arm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can do ||
in REQUIRES
?! o_O
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This commit splits up the test suite 'diagnostic_constant_propagation_propagation_int.swift' into two files one each for 64bit and 32bit architectures. The tests check the diagnostics for arithmetic and bitwise operations on 'Int' and 'UInt' values. The size of these numeric types depend on the word length of the target architecture. Most of the tests added in this commit were present earlier but were xfailed.
Hi Devin and Max, |
@swift-ci Please smoke test merge |
@ravikandhadai this is not the real command =) |
@swift-ci Please smoke test |
@swift-ci Please smoke test merge |
"Extend test/SILPasses/diagnostic_constant_propagation.swift" by removing tests from the file that referred to `Int` and `UInt` types. These tests are dependent on the word length of the architecture and are covered by the tests in the files `diagnostic_constant_propagation_int_archXX.swift`. Also, this commit corrects erroneous references to a radar problem in the test suties: `diagnostic_constant_propagation_int_archXX.swift`
@swift-ci Please smoke test |
This pull request now has two commits and I think both the commits pass the test cases. The latest commit removes the requirement on 64bit PTRSIZE for the |
@devincoughlin @moiseev @ravikandhadai Would it be possible to add tests with more complex expressions as well to check that this is not too eager? E.g. _ = Int16(integerLiteral: 0).magnitude
error: arithmetic operation '65535 + 1' (on unsigned 16-bit integer type) results in an overflow
Int16(integerLiteral: 0).magnitude
^ The problem here is that getter for the |
@xedin Is the branch containing ~0 + 1 actually dead branch that will not be taken? let's catch up to discuss more on this. |
@ravikandhadai yes, in this case |
This commit splits up the test suite 'diagnostic_constant_propagation_propagation_int.swift'
into two files one each for 64bit and 32bit architectures.
The tests check the diagnostics for arithmetic and bitwise operations on
'Int' and 'UInt' values. The size of these numeric types depend on the word length of
the target architecture. Most of the tests added in this commit were present
earlier but were xfailed.