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

Failed to Reconstruct Type #64565

Closed
thekief opened this issue Mar 23, 2023 · 5 comments
Closed

Failed to Reconstruct Type #64565

thekief opened this issue Mar 23, 2023 · 5 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software demangling Area → compiler: The `libswiftDemangling` library missing info Resolution: Is missing crucial info such as a test case or a concise description swift 5.8

Comments

@thekief
Copy link

thekief commented Mar 23, 2023

Description

When compiling with a 5.8 based toolchain using Xcode 14.2 I get the issue below. I am a bit unsure what the root cause of this might be, as my previous toolchain was based on the commits on the commit c4a0c8e and as of then not too much things seem to have changed with the SIL generation.

Failed to reconstruct type for $s7SwiftUI15ModifiedContentVyAA4ViewPAAE29navigationBarTitleDisplayModeyQrAA010NavigationG4ItemV0hiJ0OFQOyAE3ePAE03epakH0yQrSSFQOyAE0nB0E9listStyle_23defaultMinListRowHeightQrAM0sP0O_12CoreGraphics7CGFloatVSgtFQOyAA0S0Vys5NeverOAA05TupleE0VyAA7SectionVyAeME04textP0_5colorQrqd___AA5ColorVSgtAM04TextP0Rd__lFQOyAA4TextV_AM06Headerh4TextP0VQo_AA7ForEachVySaySS3key_SS5valuetGSSAA6HStackVyA_yAeMEA2__A3_Qrqd___A6_tAMA7_Rd__lFQOyA9__AM0s4TextP0VQo__AA6SpacerVACyACyACyAeMEA2__A3_Qrqd___A6_tAMA7_Rd__lFQOyA9__AM0s10DetailTextP0VQo_AA30_EnvironmentKeyWritingModifierVySiSgGGA29_yATGGAA12_FrameLayoutVGtGGGAA05EmptyE0VG_A1_yA12_A_yAeAE06toggleP0yQrqd__AA06ToggleP0Rd__lFQOyAA6ToggleVyAM011BasicDetailT0VG_AA012SwitchToggleP0VQo__A53_A53_AeAE5alert_11isPresented7actions7messageQrAA18LocalizedStringKeyV_AA7BindingVySbGqd__yXEqd_0_yXEtAaDRd__AaDRd_0_r0_lFQOyAA6ButtonVyA9_G_A65_A9_Qo_tGA42_GAA5GroupVyA1_yA12_AA0K4LinkVyA49_AK013DebugBrandingE0VGA42_GGA1_yA19_yA_yA12__A24_AK17DebugToggleButton33_B9D9443CE7D68DC472731D157E30BF69LLVtGGA_yA14_ySayAK24DebugInsuranceConfigTypeOGA84_A64_yA19_yA_yAK011DebugDetailT0A79_LLV_A24_AA5ImageVAME05imageP0yQrxAM05ImageP0RzlFQOy_AK014CheckmarkImageP0VQo_tGGGG_A72_yA19_yA_yA22__A24_A94_tGGAK024DebugMenuCustomInsuranceE0VGtGA9_GA1_yA82_A_yA14_ySayAK23DebugEndpointConfigTypeOGA107_A97_G_A72_yA100_AK023DebugMenuCustomEndpointE0VGtGA42_GA1_yA82_A_yA14_ySayAK18DebugIamConfigTypeOGA116_A97_G_A72_yA100_AK024DebugMenuCustomIamConfigE0VGtGA42_GA1_yA12_A14_ySayAK18DebugKvsClientTypeOGA125_A97_GA42_GACyAK30DebugMenuCustomIamThemeSectionVAA20_ValueActionModifierVySSGGA70_yA_yA1_yA12_A_yAeMEA2__A3_Qrqd___A6_tAMA7_Rd__lFQOyAA6PickerVyA22_SSA14_ySayAK9DebugCertVGSSACyA9_AA21_TraitWritingModifierVyAA16TagValueTraitKeyVyA138_GGGGG_A26_Qo__AeAE5sheetA55_9onDismiss7contentQrA62__yycSgqd__yctAaDRd__lFQOyA65__AK019DebugNewCertificateE0VQo_A65_tGA42_G_A1_yA12_A_yA72_yA9_AK08KeychainE0VG_A72_yA9_AK012UserDefaultsE0VGtGA42_GtGGtGG_Qo__Qo__Qo_AA18_AnimationModifierVySbGGD
Original type:
(bound_generic_struct_type decl=SwiftUI.(file).ModifiedContent
  (opaque_type address=0x128998160
    (interface_type=generic_type_param_type depth=1 index=0) conforms_to=SwiftUI.(file).View decl=SwiftUI.(file).View extension.navigationBarTitleDisplayMode
    (substitution_map generic_signature=<τ_0_0 where τ_0_0 : View>
      (substitution τ_0_0 -> some View)
      (conformance type=τ_0_0
        (abstract_conformance protocol=View))))
  (bound_generic_struct_type decl=SwiftUI.(file)._AnimationModifier
    (struct_type decl=Swift.(file).Bool)))
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
Stack dump:
1.	Apple Swift version 5.8-dev (LLVM f0fb631dd1a3a29, Swift 46cd560b5ba32b6)
2.	Compiling with the current language version
3.	Contents of /Users/builder/Library/Developer/Xcode/DerivedData/<redacted>/Objects-normal/arm64/sources-3:
4.	While evaluating request IRGenRequest(IR Generation for file "<redacted>/DebugBuild/swiftUI/DebugMenuView.swift")
5.	While emitting IR SIL function "@$s3proj13DebugMenuViewV4bodyQrvg".
 for getter for body (at <redacted>/DebugBuild/swiftUI/DebugMenuView.swift:17:9)
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):

...
3  libsystem_platform.dylib 0x00000001930c42a4 _sigtramp + 56
4  libsystem_pthread.dylib  0x0000000193095cec pthread_kill + 288
5  libsystem_c.dylib        0x0000000192fcf2c8 abort + 180
6  swift-frontend           0x0000000104fd59c0 (anonymous namespace)::IRGenDebugInfoImpl::getOrCreateType(swift::irgen::DebugTypeInfo) (.cold.22) + 0
7  swift-frontend           0x0000000102a4b02c (anonymous namespace)::IRGenDebugInfoImpl::getOrCreateType(swift::irgen::DebugTypeInfo) + 3392
8  swift-frontend           0x0000000102a4b7e4 (anonymous namespace)::IRGenDebugInfoImpl::createParameterType(llvm::SmallVectorImpl<llvm::Metadata*>&, swift::SILType) + 132
9  swift-frontend           0x0000000102a4b480 (anonymous namespace)::IRGenDebugInfoImpl::createParameterTypes(swift::CanTypeWrapper<swift::SILFunctionType>) + 288
10 swift-frontend           0x0000000102a44bc0 (anonymous namespace)::IRGenDebugInfoImpl::emitFunction(swift::SILDebugScope const*, llvm::Function*, swift::SILFunctionTypeRepresentation, swift::SILType, swift::DeclContext*, llvm::StringRef) + 1348
11 swift-frontend           0x0000000102a4541c (anonymous namespace)::IRGenDebugInfoImpl::emitFunction(swift::SILFunction&, llvm::Function*) + 160
12 swift-frontend           0x0000000102a444ec (anonymous namespace)::IRGenDebugInfoImpl::getOrCreateScope(swift::SILDebugScope const*) + 748
13 swift-frontend           0x0000000102a4360c (anonymous namespace)::IRGenDebugInfoImpl::setCurrentLoc(swift::irgen::IRBuilder&, swift::SILDebugScope const*, swift::SILLocation) + 80
14 swift-frontend           0x0000000102a7f8f0 (anonymous namespace)::IRGenSILFunction::emitSILFunction() + 7824
15 swift-frontend           0x0000000102a7d538 swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 920
16 swift-frontend           0x0000000102938c74 swift::irgen::IRGenerator::emitGlobalTopLevel(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&) + 660
17 swift-frontend           0x0000000102a2e3c8 swift::IRGenRequest::evaluate(swift::Evaluator&, swift::IRGenDescriptor) const + 1600
18 swift-frontend           0x0000000102a7cc94 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 + 196
19 swift-frontend           0x0000000102a3e228 llvm::Expected<swift::IRGenRequest::OutputType> swift::Evaluator::getResultUncached<swift::IRGenRequest>(swift::IRGenRequest const&) + 360
20 swift-frontend           0x0000000102a306f0 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**) + 212
21 swift-frontend           0x000000010271b77c 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*) + 1680
22 swift-frontend           0x000000010271ab24 swift::performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 568
23 swift-frontend           0x00000001027294bc withSemanticAnalysis(swift::CompilerInstance&, swift::FrontendObserver*, llvm::function_ref<bool (swift::CompilerInstance&)>, bool) + 160
24 swift-frontend           0x000000010271c4f0 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2812
25 swift-frontend           0x0000000102590fac swift::mainEntry(int, char const**) + 3220
26 dyld                     0x0000000192d6be50 start + 2544
Command SwiftCompile failed with a nonzero exit code

Steps to reproduce

Expected behavior

Environment

  • Swift compiler version info: Apple Swift version 5.8-dev (LLVM f0fb631dd1a3a29, Swift 46cd560)
  • Xcode version info: 14.2
  • Deployment target: arm64-apple-ios15.0
@thekief thekief added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels labels Mar 23, 2023
@AnthonyLatsis AnthonyLatsis added missing info Resolution: Is missing crucial info such as a test case or a concise description compiler The Swift compiler in itself swift 5.8 demangling Area → compiler: The `libswiftDemangling` library and removed triage needed This issue needs more specific labels labels Mar 23, 2023
@AnthonyLatsis
Copy link
Collaborator

I trust you’re working on extracting a test case?

@AnthonyLatsis AnthonyLatsis added compiler crash crash Bug: A crash, i.e., an abnormal termination of software and removed swift 5.8 demangling Area → compiler: The `libswiftDemangling` library labels Mar 23, 2023
@thekief
Copy link
Author

thekief commented Mar 23, 2023

Yeah, I will work on it and bisect out project and the toolchain. To be honest, creating a test case for name mangling seems to be quite the task. Any idea where to start here?

Should I maybe try to manually demangle the given string and cross-check? I would appreciate any pointer here.

@AnthonyLatsis
Copy link
Collaborator

AnthonyLatsis commented Mar 23, 2023

As with any other compiler-time crash, just try to throw away as much code and dependencies as you can from DebugMenuView.swift whilst spot checking that it still crashes in between iterations. If you manage to contain the crash in a single file, that would be awesome, but a project’s fine too.

@slavapestov slavapestov self-assigned this Mar 31, 2023
@thekief
Copy link
Author

thekief commented Apr 5, 2023

I tried to get a MVP but it seems like the issue stems from an unholy combination of different versions, crashing the compiler in the way.

I guess this will not happen with any sane setup.

@thekief thekief closed this as completed Apr 5, 2023
@AnthonyLatsis AnthonyLatsis added swift 5.8 demangling Area → compiler: The `libswiftDemangling` library labels Apr 5, 2023
@AnthonyLatsis
Copy link
Collaborator

AnthonyLatsis commented Apr 5, 2023

FWIW you are welcome to attach a project for us to reduce — even a large one — in this situation. If you cannot devise a standalone reproducer or disclose the code, there is still an option to report privately via Apple’s feedback assistant and relay the FB number here for compiler engineers to have a look at.

P.S. Re-closing as not planned because that’s what missing info falls under.

@AnthonyLatsis AnthonyLatsis closed this as not planned Won't fix, can't repro, duplicate, stale Apr 5, 2023
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. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software demangling Area → compiler: The `libswiftDemangling` library missing info Resolution: Is missing crucial info such as a test case or a concise description swift 5.8
Projects
None yet
Development

No branches or pull requests

3 participants