Skip to content
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

Building CxxStdlib overlay crashes on Windows #77856

Open
egorzhdan opened this issue Nov 27, 2024 · 0 comments
Open

Building CxxStdlib overlay crashes on Windows #77856

egorzhdan opened this issue Nov 27, 2024 · 0 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. c++ interop Feature: Interoperability with C++ compiler The Swift compiler itself crash Bug: A crash, i.e., an abnormal termination of software

Comments

@egorzhdan
Copy link
Contributor

Description

Since #77843 got merged, the CxxStdlib overlay cannot be built on Windows: we're getting a crash from LLVM IR verifier.

Reproduction

Stack dump

[267/374][ 71%][209.701s] Compiling T:/201/stdlib/public/Cxx/std//WINDOWS/i686/CxxStdlib.obj
FAILED: stdlib/public/Cxx/std/WINDOWS/i686/CxxStdlib.obj T:/201/stdlib/public/Cxx/std/WINDOWS/i686/CxxStdlib.obj 
stdlib\public\Cxx\std\CMakeFiles\CxxStdlib.obj-1ad2516.bat 971315f6b0e97a34
<unknown>:0: warning: using (deprecated) legacy driver, Swift installation does not contain swift-driver at: 'C:\Users\swift-ci\jenkins\workspace\swift-PR-windows\build\5\bin\swift-driver-new.exe'
inalloca argument for call has mismatched alloca

  %4 = alloca %TSo3stdO0071basic_stringCCharchar_traitsCCharallocatorCChar_mHGHsqaGJcraCCfsaqChraaV, align 4

  %6 = call i32 @"?__swift_interopComputeHashOfString@@YAIV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z"(ptr %4)

inalloca argument for call has mismatched alloca

  %6 = alloca %TSo3stdO0071basic_stringCCharchar_traitsCCharallocatorCChar_mHGHsqaGJcraCCfsaqChraaV, align 4

  %8 = call i32 @"?__swift_interopComputeHashOfString@@YAIV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z"(ptr %6) #16

inalloca argument for call has mismatched alloca

  %5 = alloca %TSo3stdO0071basic_stringCCharchar_traitsCCharallocatorCChar_mHGHsqaGJcraCCfsaqChraaV, align 4

  %7 = call i32 @"?__swift_interopComputeHashOfString@@YAIV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z"(ptr %5) #16

inalloca argument for call has mismatched alloca

  %7 = alloca %TSo3stdO0071basic_stringCCharchar_traitsCCharallocatorCChar_mHGHsqaGJcraCCfsaqChraaV, align 4

  %9 = call i32 @"?__swift_interopComputeHashOfString@@YAIV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z"(ptr %7) #16

inalloca argument for call has mismatched alloca

  %4 = alloca %TSo3stdO0077basic_stringCChar16char_traitsCChar16allocatorCChar16_jlHEvsaGGdtaEBguasEitaaV, align 4

  %6 = call i32 @"?__swift_interopComputeHashOfU16String@@YAIV?$basic_string@_SU?$char_traits@_S@std@@V?$allocator@_S@2@@std@@@Z"(ptr %4)

inalloca argument for call has mismatched alloca

  %6 = alloca %TSo3stdO0077basic_stringCChar16char_traitsCChar16allocatorCChar16_jlHEvsaGGdtaEBguasEitaaV, align 4

  %8 = call i32 @"?__swift_interopComputeHashOfU16String@@YAIV?$basic_string@_SU?$char_traits@_S@std@@V?$allocator@_S@2@@std@@@Z"(ptr %6) #16

inalloca argument for call has mismatched alloca

  %5 = alloca %TSo3stdO0077basic_stringCChar16char_traitsCChar16allocatorCChar16_jlHEvsaGGdtaEBguasEitaaV, align 4

  %7 = call i32 @"?__swift_interopComputeHashOfU16String@@YAIV?$basic_string@_SU?$char_traits@_S@std@@V?$allocator@_S@2@@std@@@Z"(ptr %5) #16

inalloca argument for call has mismatched alloca

  %7 = alloca %TSo3stdO0077basic_stringCChar16char_traitsCChar16allocatorCChar16_jlHEvsaGGdtaEBguasEitaaV, align 4

  %9 = call i32 @"?__swift_interopComputeHashOfU16String@@YAIV?$basic_string@_SU?$char_traits@_S@std@@V?$allocator@_S@2@@std@@@Z"(ptr %7) #16

inalloca argument for call has mismatched alloca

  %4 = alloca %TSo3stdO0077basic_stringCChar32char_traitsCChar32allocatorCChar32_jlHEvsaGGdtaEBguasEitaaV, align 4

  %6 = call i32 @"?__swift_interopComputeHashOfU32String@@YAIV?$basic_string@_UU?$char_traits@_U@std@@V?$allocator@_U@2@@std@@@Z"(ptr %4)

inalloca argument for call has mismatched alloca

  %6 = alloca %TSo3stdO0077basic_stringCChar32char_traitsCChar32allocatorCChar32_jlHEvsaGGdtaEBguasEitaaV, align 4

  %8 = call i32 @"?__swift_interopComputeHashOfU32String@@YAIV?$basic_string@_UU?$char_traits@_U@std@@V?$allocator@_U@2@@std@@@Z"(ptr %6) #16

inalloca argument for call has mismatched alloca

  %5 = alloca %TSo3stdO0077basic_stringCChar32char_traitsCChar32allocatorCChar32_jlHEvsaGGdtaEBguasEitaaV, align 4

  %7 = call i32 @"?__swift_interopComputeHashOfU32String@@YAIV?$basic_string@_UU?$char_traits@_U@std@@V?$allocator@_U@2@@std@@@Z"(ptr %5) #16

inalloca argument for call has mismatched alloca

  %7 = alloca %TSo3stdO0077basic_stringCChar32char_traitsCChar32allocatorCChar32_jlHEvsaGGdtaEBguasEitaaV, align 4

  %9 = call i32 @"?__swift_interopComputeHashOfU32String@@YAIV?$basic_string@_UU?$char_traits@_U@std@@V?$allocator@_U@2@@std@@@Z"(ptr %7) #16

<unknown>:0: error: fatal error encountered during compilation; please submit a bug report (https://swift.org/contributing/#reporting-bugs)

<unknown>:0: note: Broken module found, compilation aborted!

Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.

Stack dump:

0.	Program arguments: C:\\Users\\swift-ci\\jenkins\\workspace\\swift-PR-windows\\build\\5\\bin\\swiftc.exe -frontend -c C:/Users/swift-ci/jenkins/workspace/swift-PR-windows/swift/stdlib/public/Cxx/std/std.swift C:/Users/swift-ci/jenkins/workspace/swift-PR-windows/swift/stdlib/public/Cxx/std/Chrono.swift C:/Users/swift-ci/jenkins/workspace/swift-PR-windows/swift/stdlib/public/Cxx/std/String.swift -supplementary-output-file-map T:\\tmp\\supplementaryOutputs-74d185 -target i686-unknown-windows-msvc -disable-objc-interop -I T:/201/./lib/swift/windows -vfsoverlay T:/201/stdlib/windows-vfs-overlay.yaml -color-diagnostics -enable-experimental-feature NoncopyableGenerics2 -enable-experimental-feature SuppressedAssociatedTypes -enable-experimental-feature SE427NoInferenceOnExtension -enable-experimental-feature AllowUnsafeAttribute -enable-experimental-feature NonescapableTypes -enable-experimental-feature LifetimeDependence -enable-upcoming-feature MemberImportVisibility -enable-experimental-feature AssumeResilientCxxTypes -disable-upcoming-feature MemberImportVisibility -warn-implicit-overrides -enable-library-evolution -module-cache-path T:/201/./module-cache -resource-dir T:/201/./lib/swift -static -swift-version 5 -O -library-level api -cxx-interoperability-mode=default -D SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY -D SWIFT_ENABLE_EXPERIMENTAL_DISTRIBUTED -D SWIFT_ENABLE_EXPERIMENTAL_DIFFERENTIABLE_PROGRAMMING -D SWIFT_ENABLE_EXPERIMENTAL_STRING_PROCESSING -D SWIFT_ENABLE_EXPERIMENTAL_OBSERVATION -D SWIFT_ENABLE_EXPERIMENTAL_POINTER_BOUNDS -D SWIFT_ENABLE_SYNCHRONIZATION -D SWIFT_ENABLE_VOLATILE -D SWIFT_RUNTIME_OS_VERSIONING -D SWIFT_STDLIB_ENABLE_UNICODE_DATA -D SWIFT_STDLIB_ENABLE_VECTOR_TYPES -D SWIFT_STDLIB_HAS_COMMANDLINE -D SWIFT_STDLIB_HAS_STDIN -D SWIFT_STDLIB_HAS_ENVIRON -D SWIFT_CONCURRENCY_USES_DISPATCH -D SWIFT_STDLIB_OVERRIDABLE_RETAIN_RELEASE -D SWIFT_THREADING_WIN32 -D SWIFT_ENABLE_REFLECTION -D _LIB -require-explicit-availability=ignore -enforce-exclusivity=unchecked -empty-abi-descriptor -disable-autolinking-runtime-compatibility-concurrency -disable-objc-interop -module-interface-preserve-types-as-written -enable-lexical-lifetimes=false -enable-ossa-modules -disable-implicit-concurrency-module-import -disable-implicit-string-processing-module-import -strict-implicit-module-context -define-availability "SwiftStdlib 9999:macOS 9999, iOS 9999, watchOS 9999, tvOS 9999" -define-availability "SwiftStdlib 5.0:macOS 10.14.4, iOS 12.2, watchOS 5.2, tvOS 12.2" -define-availability "SwiftStdlib 5.1:macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0" -define-availability "SwiftStdlib 5.2:macOS 10.15.4, iOS 13.4, watchOS 6.2, tvOS 13.4" -define-availability "SwiftStdlib 5.3:macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0" -define-availability "SwiftStdlib 5.4:macOS 11.3, iOS 14.5, watchOS 7.4, tvOS 14.5" -define-availability "SwiftStdlib 5.5:macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0" -define-availability "SwiftStdlib 5.6:macOS 12.3, iOS 15.4, watchOS 8.5, tvOS 15.4" -define-availability "SwiftStdlib 5.7:macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0" -define-availability "SwiftStdlib 5.8:macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4" -define-availability "SwiftStdlib 5.9:macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0" -define-availability "SwiftStdlib 5.10:macOS 14.4, iOS 17.4, watchOS 10.4, tvOS 17.4, visionOS 1.1" -define-availability "SwiftStdlib 6.0:macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0" -define-availability "SwiftStdlib 6.1:macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, visionOS 9999" -target-min-inlining-version min -in-process-plugin-server-path C:\\Users\\swift-ci\\jenkins\\workspace\\swift-PR-windows\\build\\5\\bin\\SwiftInProcPluginServer.dll -plugin-path C:\\Users\\swift-ci\\jenkins\\workspace\\swift-PR-windows\\build\\5\\bin -Xcc -DSWIFT_STDLIB_HAS_ENVIRON -Xcc -Xclang -Xcc -ivfsoverlay -Xcc -Xclang -Xcc T:/201/stdlib/public/Cxx/std/windows-sdk-vfs-overlay.yaml -Xcc -Xclang -Xcc -fbuiltin-headers-in-system-modules -autolink-library oldnames -autolink-library msvcrt -Xcc -D_MT -Xcc -D_DLL -parse-as-library -module-name CxxStdlib -o T:/201/stdlib/public/Cxx/std//WINDOWS/i686/CxxStdlib.obj -runtime-compatibility-version none -disable-autolinking-runtime-compatibility-dynamic-replacements

1.	Swift version 6.1-dev (LLVM 42f3e8ef873e24d, Swift 684f7e85f929f12)

2.	Compiling with effective version 5.10

3.	Running pass "verify" on module "T:/201/stdlib/public/Cxx/std//WINDOWS/i686/CxxStdlib.obj"

Exception Code: 0x80000003

 #0 0x00007ff68b1887b5 (C:\Users\swift-ci\jenkins\workspace\swift-PR-windows\build\5\bin\swiftc.exe+0x6a287b5)

Expected behavior

Build passing

Environment

Swift CI

Additional information

No response

@egorzhdan egorzhdan added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. c++ interop Feature: Interoperability with C++ compiler The Swift compiler itself crash Bug: A crash, i.e., an abnormal termination of software labels Nov 27, 2024
egorzhdan added a commit that referenced this issue Nov 27, 2024
egorzhdan added a commit that referenced this issue Nov 27, 2024
hyp added a commit that referenced this issue Dec 13, 2024
…her platforms

The PR #77857 added windows-specific workaround for #77856, that happened after #77843. Unfortunately this caused a new issue on windows - #78119. It looks like windows is suffering from a similar serialization issue as libstdc++, although its even more complex as the callAsFunction is not only a derived function from a base class, the base class although has a static call operator. In any case, the libstdc++ callAsFunction deserialization fix should align with the static operator () deserialization too, so for now make windows use the same workaround as other platforms to avoid the deserialization crash (77856).

This change was tested on i686 windows too, ensuring that IR verifier crash no longer happens
hyp added a commit that referenced this issue Dec 13, 2024
…her platforms

The PR #77857 added windows-specific workaround for #77856, that happened after #77843. Unfortunately this caused a new issue on windows - #78119. It looks like windows is suffering from a similar serialization issue as libstdc++, although its even more complex as the callAsFunction is not only a derived function from a base class, the base class although has a static call operator. In any case, the libstdc++ callAsFunction deserialization fix should align with the static operator () deserialization too, so for now make windows use the same workaround as other platforms to avoid the deserialization crash (77856).

This change was tested on i686 windows too, ensuring that IR verifier crash no longer happens
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. c++ interop Feature: Interoperability with C++ compiler The Swift compiler itself crash Bug: A crash, i.e., an abnormal termination of software
Projects
None yet
Development

No branches or pull requests

1 participant