Open thekief opened 9 months ago
Description
When compiling an iOS app with a self-built toolchain using release/5.9.0, there is an issue with a type reconstruction.
release/5.9.0
... Incorrect reconstructed type for $s7SwiftUI9TupleViewVyxxQp_tGD Original type: (bound_generic_struct_type decl=SwiftUI.(file).TupleView (tuple_type num_elements=1 (tuple_type_elt (pack_expansion_type (pattern=generic_type_param_type depth=0 index=0 pack) (count=generic_type_param_type depth=0 index=0 pack))))) Reconstructed type: (bound_generic_struct_type decl=SwiftUI.(file).TupleView (pack_expansion_type (pattern=generic_type_param_type depth=0 index=0 pack) (count=generic_type_param_type depth=0 index=0 pack))) Generic signature: <each τ_0_0 where repeat each τ_0_0 : View> Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace. Stack dump: 0. Program arguments: /Library/Developer/Toolchains/swift-LOCAL-2023-10-07-a.xctoolchain/usr/bin/swift-frontend -frontend -c -primary-file "/Users/ob2/develop/test-app/Test App/ContentView.swift" "/Users/ob2/develop/test-app/Test App/Test_AppApp.swift" "/Users/ob2/Library/Developer/Xcode/DerivedData/Test_Ap$ 1. Apple Swift version 5.9-dev (LLVM 8ee3f51668ac68d, Swift b96b2d9a9ef431c) 2. Compiling with the current language version 3. While evaluating request IRGenRequest(IR Generation for file "/Users/ob2/develop/test-app/Test App/ContentView.swift") 4. While emitting IR SIL function "@$s7SwiftUI11ViewBuilderV10buildBlockyAA05TupleC0VyxxQp_tGxxQpRvzAA0C0RzlFZ". for 'buildBlock(_:)' (in module 'SwiftUI') Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it): 0 swift-frontend 0x00000001096b8384 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56 1 swift-frontend 0x00000001096b7770 llvm::sys::RunSignalHandlers() + 112 2 swift-frontend 0x00000001096b89c0 SignalHandler(int) + 304 3 libsystem_platform.dylib 0x0000000188905a24 _sigtramp + 56 4 libsystem_pthread.dylib 0x00000001888d6cc0 pthread_kill + 288 5 libsystem_c.dylib 0x00000001887e6a50 abort + 180 6 swift-frontend 0x000000010975d410 (anonymous namespace)::IRGenDebugInfoImpl::getOrCreateType(swift::irgen::DebugTypeInfo) (.cold.29) + 0 7 swift-frontend 0x0000000104ef9718 (anonymous namespace)::IRGenDebugInfoImpl::getOrCreateType(swift::irgen::DebugTypeInfo) + 3688 8 swift-frontend 0x0000000104ef9a38 (anonymous namespace)::IRGenDebugInfoImpl::createParameterTypes(swift::CanTypeWrapper<swift::SILFunctionType>) + 792 9 swift-frontend 0x0000000104ef2bd0 (anonymous namespace)::IRGenDebugInfoImpl::emitFunction(swift::SILDebugScope const*, llvm::Function*, swift::SILFunctionTypeRepresentation, swift::SILType, swift::DeclContext*, llvm::StringRef) + 1984 10 swift-frontend 0x0000000104ef346c (anonymous namespace)::IRGenDebugInfoImpl::emitFunction(swift::SILFunction&, llvm::Function*) + 160 11 swift-frontend 0x0000000104f2dd80 (anonymous namespace)::IRGenSILFunction::emitSILFunction() + 860 12 swift-frontend 0x0000000104f2d464 swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 1320 13 swift-frontend 0x0000000104ddd2f4 swift::irgen::IRGenerator::emitLazyDefinitions() + 1484 14 swift-frontend 0x0000000104edd9c8 swift::IRGenRequest::evaluate(swift::Evaluator&, swift::IRGenDescriptor) const + 2516 15 swift-frontend 0x0000000104f2ca30 swift::GeneratedModule swift::SimpleRequest<swift::IRGenRequest, swift::GeneratedModule (swift::IRGenDescriptor), (swift::RequestFlags)9>::callDerived<0ul>(swift::Evaluator&, std::__1::integer_sequence<unsigned long, 0ul>) const + 200 16 swift-frontend 0x0000000104eec508 llvm::Expected<swift::IRGenRequest::OutputType> swift::Evaluator::getResultUncached<swift::IRGenRequest>(swift::IRGenRequest const&) + 252 17 swift-frontend 0x0000000104edfad0 swift::performIRGeneration(swift::FileUnit*, swift::IRGenOptions const&, swift::TBDGenOptions const&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule>>, llvm::StringRef, swift::PrimarySpecificPaths const&, llvm::StringRef, llvm::GlobalVariable**) + 208 18 swift-frontend 0x0000000104a6e584 generateIR(swift::IRGenOptions const&, swift::TBDGenOptions const&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule>>, swift::PrimarySpecificPaths const&, llvm::StringRef, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, llvm::GlobalVariable*&, llvm::ArrayRef<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>) + 156 19 swift-frontend 0x0000000104a6b670 performCompileStepsPostSILGen(swift::CompilerInstance&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule>>, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::PrimarySpecificPaths const&, int&, swift::FrontendObserver*) + 1292 20 swift-frontend 0x0000000104a6abb8 swift::performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 584 21 swift-frontend 0x0000000104a7a66c withSemanticAnalysis(swift::CompilerInstance&, swift::FrontendObserver*, llvm::function_ref<bool (swift::CompilerInstance&)>, bool) + 160 22 swift-frontend 0x0000000104a6c944 performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 628 23 swift-frontend 0x0000000104a6be90 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 1856 24 swift-frontend 0x00000001048f4414 swift::mainEntry(int, char const**) + 3248 25 dyld 0x000000018855d058 start + 2224 Command SwiftCompile failed with a nonzero exit code ...
The file causing the issue has following output:
import SwiftUI struct ContentView: View { @State private var counter = 0 var body: some View { VStack { Image(systemName: "globe") .imageScale(.large) .foregroundColor(.accentColor) Text("Hello, world!").padding(30) Button("Increment Counter") { counter += 1 } Text("Counter: \(counter)") } .padding() } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() } }
Steps to reproduce
Expected behavior
The app compiles.
Environment
xcrun -toolchain "mytoolchain" swiftc --version Apple Swift version 5.9-dev (LLVM 8ee3f51668ac68d, Swift b96b2d9a9ef431c) Target: arm64-apple-macosx14.0
Xcode 15.0 Build version 15A240d
n/a
I ran into a similar error (Incorrect reconstructed type), and was able to work around it by using -disable-round-trip-debug-types as described here.
Incorrect reconstructed type
-disable-round-trip-debug-types
Description
When compiling an iOS app with a self-built toolchain using
release/5.9.0
, there is an issue with a type reconstruction.The file causing the issue has following output:
Steps to reproduce
Expected behavior
The app compiles.
Environment