Skip to content
This repository has been archived by the owner on Mar 30, 2022. It is now read-only.

Upgrading to v0.11 Causes Compiler Crash #522

Closed
xanderdunn opened this issue Aug 22, 2020 · 4 comments
Closed

Upgrading to v0.11 Causes Compiler Crash #522

xanderdunn opened this issue Aug 22, 2020 · 4 comments
Assignees

Comments

@xanderdunn
Copy link

xanderdunn commented Aug 22, 2020

My project, which builds and runs successfully on Swift for Tensorflow v0.10, crashes during the build process on v0.11.

By process of elimination on my project dependencies, I was able to figure out this is happening when building the google-auth-library-swift dependency.

On Ubuntu 18.04:

$ git clone https://github.com/googleapis/google-auth-library-swift
$ cd google-auth-library-swift
$ rm -rf .build/
$ which swift
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift
$ swift --version
Swift version 5.3-dev (LLVM db8896f3f345af2, Swift 61684f62a6132c0)
Target: x86_64-unknown-linux-gnu
$ swift build
Fetching https://github.com/apple/swift-nio.git
Fetching https://github.com/krzyzanowskim/CryptoSwift.git
Fetching https://github.com/attaswift/BigInt
Cloning https://github.com/krzyzanowskim/CryptoSwift.git
Resolving https://github.com/krzyzanowskim/CryptoSwift.git at 1.3.1
Cloning https://github.com/attaswift/BigInt
Resolving https://github.com/attaswift/BigInt at 5.1.0
Cloning https://github.com/apple/swift-nio.git
Resolving https://github.com/apple/swift-nio.git at 2.21.0
[1/30] Compiling CNIOSHA1 c_nio_sha1.c
[2/30] Compiling CNIOLinux shim.c
[3/30] Compiling CNIOLinux ifaddrs-android.c
[4/63] Compiling CNIOHTTPParser c_nio_http_parser.c
[5/63] Compiling CNIODarwin shim.c
swift-frontend: /swift-base/swift/lib/AST/GenericSignature.cpp:251: static swift::CanGenericSignature swift::CanGenericSignature::getCanonical(TypeArrayView<swift::GenericTypeParamType>, ArrayRef<swift::Requirement>, bool): Assertion `isCanonicalAnchor(secondType)' failed.
Stack dump:
0.	Program arguments: /home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend -frontend -c /home/xander/dev/google-auth-library-swift/.build/checkouts/BigInt/Sources/Addition.swift /home/xander/dev/google-auth-library-swift/.build/checkouts/BigInt/Sources/BigInt.swift /home/xander/dev/google-auth-library-swift/.build/checkouts/BigInt/Sources/BigUInt.swift /home/xander/dev/google-auth-library-swift/.build/checkouts/BigInt/Sources/Bitwise Ops.swift /home/xander/dev/google-auth-library-swift/.build/checkouts/BigInt/Sources/Codable.swift /home/xander/dev/google-auth-library-swift/.build/checkouts/BigInt/Sources/Comparable.swift -primary-file /home/xander/dev/google-auth-library-swift/.build/checkouts/BigInt/Sources/Data Conversion.swift -primary-file /home/xander/dev/google-auth-library-swift/.build/checkouts/BigInt/Sources/Division.swift -primary-file /home/xander/dev/google-auth-library-swift/.build/checkouts/BigInt/Sources/Exponentiation.swift -primary-file /home/xander/dev/google-auth-library-swift/.build/checkouts/BigInt/Sources/Floating Point Conversion.swift -primary-file /home/xander/dev/google-auth-library-swift/.build/checkouts/BigInt/Sources/GCD.swift -primary-file /home/xander/dev/google-auth-library-swift/.build/checkouts/BigInt/Sources/Hashable.swift /home/xander/dev/google-auth-library-swift/.build/checkouts/BigInt/Sources/Integer Conversion.swift /home/xander/dev/google-auth-library-swift/.build/checkouts/BigInt/Sources/Multiplication.swift /home/xander/dev/google-auth-library-swift/.build/checkouts/BigInt/Sources/Prime Test.swift /home/xander/dev/google-auth-library-swift/.build/checkouts/BigInt/Sources/Random.swift /home/xander/dev/google-auth-library-swift/.build/checkouts/BigInt/Sources/Shifts.swift /home/xander/dev/google-auth-library-swift/.build/checkouts/BigInt/Sources/Square Root.swift /home/xander/dev/google-auth-library-swift/.build/checkouts/BigInt/Sources/Strideable.swift /home/xander/dev/google-auth-library-swift/.build/checkouts/BigInt/Sources/String Conversion.swift /home/xander/dev/google-auth-library-swift/.build/checkouts/BigInt/Sources/Subtraction.swift /home/xander/dev/google-auth-library-swift/.build/checkouts/BigInt/Sources/Words and Bits.swift -supplementary-output-file-map /tmp/supplementaryOutputs-2b70e2 -target x86_64-unknown-linux-gnu -disable-objc-interop -I /home/xander/dev/google-auth-library-swift/.build/x86_64-unknown-linux-gnu/debug -enable-testing -g -module-cache-path /home/xander/dev/google-auth-library-swift/.build/x86_64-unknown-linux-gnu/debug/ModuleCache -swift-version 5 -Onone -D SWIFT_PACKAGE -D DEBUG -enable-anonymous-context-mangled-names -parse-as-library -module-name BigInt -o /home/xander/dev/google-auth-library-swift/.build/x86_64-unknown-linux-gnu/debug/BigInt.build/Data Conversion.swift.o -o /home/xander/dev/google-auth-library-swift/.build/x86_64-unknown-linux-gnu/debug/BigInt.build/Division.swift.o -o /home/xander/dev/google-auth-library-swift/.build/x86_64-unknown-linux-gnu/debug/BigInt.build/Exponentiation.swift.o -o /home/xander/dev/google-auth-library-swift/.build/x86_64-unknown-linux-gnu/debug/BigInt.build/Floating Point Conversion.swift.o -o /home/xander/dev/google-auth-library-swift/.build/x86_64-unknown-linux-gnu/debug/BigInt.build/GCD.swift.o -o /home/xander/dev/google-auth-library-swift/.build/x86_64-unknown-linux-gnu/debug/BigInt.build/Hashable.swift.o -index-store-path /home/xander/dev/google-auth-library-swift/.build/x86_64-unknown-linux-gnu/debug/index/store -index-system-modules 
1.	Swift version 5.3-dev (LLVM db8896f3f345af2, Swift 61684f62a6132c0)
2.	While evaluating request TypeCheckSourceFileRequest(source_file "/home/xander/dev/google-auth-library-swift/.build/checkouts/BigInt/Sources/Division.swift")
3.	While type-checking extension of FixedWidthInteger (at /home/xander/dev/google-auth-library-swift/.build/checkouts/BigInt/Sources/Division.swift:11:1)
4.	While type-checking declaration 0x96aa840 (at /home/xander/dev/google-auth-library-swift/.build/checkouts/BigInt/Sources/Division.swift:12:13)
5.	While evaluating request PatternBindingEntryRequest((unknown decl), 0)
6.	While evaluating request PatternTypeRequest((pattern @ 0x96aa428))
7.	While canonicalizing generic signature <τ_0_0 where τ_0_0 : FixedWidthInteger, τ_0_0 == τ_0_0.Magnitude, τ_0_0.Magnitude == τ_0_0.Magnitude.Magnitude.Magnitude> in requirement #2
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x5214dc4]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x52129be]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x521509c]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x128a0)[0x7fe170bf18a0]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0xc7)[0x7fe16f493f47]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x141)[0x7fe16f4958b1]
/lib/x86_64-linux-gnu/libc.so.6(+0x3042a)[0x7fe16f48542a]
/lib/x86_64-linux-gnu/libc.so.6(+0x304a2)[0x7fe16f4854a2]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x193f72e]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x193e98d]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x193e87c]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x193fb27]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x18805a5]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x1418ecf]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x13a2636]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x13f4788]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x13a8cb7]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x13a87b6]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x13a1f61]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x13a1f34]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x1400212]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x137a793]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x137a4af]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x136cc71]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x14d180f]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x14d0871]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x14d3fab]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x14d0871]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x14d07a1]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x142b995]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x142cc70]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x142c9a7]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x142c8b1]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x142b6de]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x142b6b4]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x63d3c9]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x63d296]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x4fd485]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x490dd8]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7)[0x7fe16f476b97]
/home/xander/swift-tensorflow-RELEASE-0.11-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift-frontend[0x49098a]
[6/127] Compiling BigInt Addition.swift
[7/127] Compiling CryptoSwift AEADChaCha20Poly1305.swift
[8/128] Merging module SwiftyBase64
[8/128] Compiling c-atomics.c
[8/128] Compiling c-nioatomics.c

I don't know if this is a compiler bug or a bug in the google-auth-library-swift project. Should I file an issue over there?

@xanderdunn
Copy link
Author

xanderdunn commented Sep 2, 2020

I narrowed the crash down to the BigInt library. See attaswift/BigInt#75.

I was able to successfully build BigInt with the official Swift 5.3 snapshot toolchain on Ubuntu 18.04:

$ which swift
/home/xander/swift-5.3-DEVELOPMENT-SNAPSHOT-2020-08-31-a-ubuntu18.04/usr/bin/swift
$ swift --version
Swift version 5.3-dev (LLVM 3fa9679add, Swift d24649a4d6)
Target: x86_64-unknown-linux-gnu

The compiler crash appears to be specific to the Swift for Tensorflow v0.11 toolchain on Ubuntu 18.04.

@xanderdunn xanderdunn changed the title Upgrading to v0.11 Causes Build to Crash Upgrading to v0.11 Causes Compiler Crash Sep 2, 2020
@dan-zheng
Copy link
Member

Swift for TensorFlow toolchains are built from apple/swift tensorflow branch, which tracks apple/swift master branch rather than the Swift 5.3 release branch.

At first glance, the crash doesn't look related to compiler changes related to Swift for TensorFlow. I wonder if the crash also reproduces with trunk development snapshots from swift.org/download? If so, the issue exists on apple/swift master branch - please file an issue at bugs.swift.org.

@xanderdunn
Copy link
Author

Thanks @dan-zheng. I can confirm that this occurs on Swift dev trunk:

$ which swift
/home/xander/swift-DEVELOPMENT-SNAPSHOT-2020-08-31-a-ubuntu18.04/usr/bin/swift
$ swift --version
Swift version 5.3-dev (LLVM 19447e27024a8d4, Swift f89dbd325b96dd6)
Target: x86_64-unknown-linux-gnu

Attempting to build the BigInt project on Ubuntu 18.04 produces the same crash.

I've filed a bug report on swift.org.

@dan-zheng
Copy link
Member

Thanks for the filing the bug upstream! I'll close this issue now, since the crash isn't related to Swift for TensorFlow.

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

No branches or pull requests

2 participants