Skip to content

[Test] Disable StaticBigInt test on watchOS #62594

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

Merged
merged 1 commit into from
Dec 15, 2022

Conversation

xymus
Copy link
Contributor

@xymus xymus commented Dec 15, 2022

No description provided.

@xymus xymus merged commit 4f768d5 into swiftlang:main Dec 15, 2022
@xymus xymus deleted the test-staticbigint branch December 15, 2022 00:17
@tbkka
Copy link
Contributor

tbkka commented Dec 21, 2022

This seems to be an issue because the test verifies some things on Int and UInt, but doesn't account for the fact that those types are 32 bits on some platforms.

CC: @benrimmington

@benrimmington
Copy link
Contributor

@tbkka Thanks for the ping, I was unaware that this test file had been disabled.

(Although the // UNSUPPORTED: comment might be ignored, if it appears after the // END. comment.)

I'm unable to test on a watchOS device or 32-bit simulator. Please could you share the output of the test failures?

@tbkka
Copy link
Contributor

tbkka commented Dec 21, 2022

Here you go:

.../swift/test/stdlib/StaticBigInt.swift:181:21: error: integer literal '4822678189205111' overflows when stored into 'UInt'
        expectEqual(0x00112233_44556677, positive.actual[1])
                    ^
.../swift/test/stdlib/StaticBigInt.swift:180:21: error: integer literal '9843086184167632639' overflows when stored into 'UInt'
        expectEqual(0x8899AABB_CCDDEEFF, positive.actual[0])
                    ^
.../swift/test/stdlib/StaticBigInt.swift:165:21: error: integer literal '18446744073709551615' overflows when stored into 'UInt'
        expectEqual(0xFFFFFFFF_FFFFFFFF, negative.actual[.max])
                    ^
.../swift/test/stdlib/StaticBigInt.swift:164:21: error: integer literal '18446744073709551615' overflows when stored into 'UInt'
        expectEqual(0xFFFFFFFF_FFFFFFFF, negative.actual[2])
                    ^
.../swift/test/stdlib/StaticBigInt.swift:163:21: error: integer literal '18441921395520346504' overflows when stored into 'UInt'
        expectEqual(0xFFEEDDCC_BBAA9988, negative.actual[1])
                    ^
.../swift/test/stdlib/StaticBigInt.swift:162:21: error: integer literal '8603657889541918977' overflows when stored into 'UInt'
        expectEqual(0x77665544_33221101, negative.actual[0])
                    ^

@benrimmington
Copy link
Contributor

@tbkka Thanks. Those statements are within else if getInt(UInt.bitWidth) == 64 branches, so they shouldn't be executing on a watchOS device.

@tbkka
Copy link
Contributor

tbkka commented Dec 21, 2022

Were those conditionals added at some point? Maybe this test just got unlucky and ran before that?

@benrimmington
Copy link
Contributor

Were those conditionals added at some point?

No, the tests haven't changed since they were first merged two weeks ago.

The only recent change was to add a feature flag in #62541, but that didn't touch the tests.

@tbkka
Copy link
Contributor

tbkka commented Dec 21, 2022

That's ... confusing. I'll try to dig out some more details and see if I can narrow down the problem here.

One question: Why getInt()?? It's not obvious to me why the conditions here aren't just Uint.bitWidth == 64.

@benrimmington
Copy link
Contributor

One question: Why getInt()??

To avoid "warning: will never be executed"; otherwise the compiler can see the @_transparent implementation.

https://github.com/apple/swift/blob/77527c9e41b3d71501bf35fe85bf0a4d58b7fcce/stdlib/public/core/IntegerTypes.swift.gyb#L1355-L1365

@tbkka
Copy link
Contributor

tbkka commented Dec 21, 2022

Oh. I see. Those tests aren't executing on watchOS. This is a compile-time failure.

@benrimmington
Copy link
Contributor

This is a compile-time failure.

OK, so the tests should be using:

- if getInt(UInt.bitWidth) == 32 {
+ #if arch(i386) || arch(arm) || arch(arm64_32) || arch(wasm32) || arch(powerpc)

- } else if getInt(UInt.bitWidth) == 64 {
+ #elseif arch(x86_64) || arch(arm64) || arch(powerpc64) || arch(powerpc64le) || arch(s390x)

- if getInt(UInt.bitWidth) == 64 {
+ #if arch(x86_64) || arch(arm64) || arch(powerpc64) || arch(powerpc64le) || arch(s390x)

@benrimmington
Copy link
Contributor

The main and release/5.8 branches will be locked tomorrow at 10 AM PST for the holidays. Can this be fixed and approved in time?

@tbkka
Copy link
Contributor

tbkka commented Dec 21, 2022

If you can get the PR up soon enough, we can certainly try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants