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

[SR-5200] IRGen Verification failure with classes inheriting from a Codable base class #47776

Closed
harlanhaskins opened this issue Jun 12, 2017 · 2 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 IRGen LLVM IR generation type checker Area → compiler: Semantic analysis

Comments

@harlanhaskins
Copy link
Collaborator

Previous ID SR-5200
Radar rdar://problem/32720658
Original Reporter @harlanhaskins
Type Bug
Status Resolved
Resolution Duplicate

Attachment: Download

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, CompilerCrash, IRGen, TypeChecker
Assignee @harlanhaskins
Priority Medium

md5: 31029bb214683d9de6ddd60bde8123ed

duplicates:

  • SR-5075 Swift 4 compiler crash: unexpected storage type that differs from type-of-rvalue

Issue Description:

I've managed to reduce a crash to the attached file. It seems to be something fishy with resolving the synthesized CodingKeys in the super or subclass.

IntToPtr source must be an integral
  %48 = inttoptr %T12CodableCrash1AC* %27 to %T12CodableCrash1BC*, !dbg !254
<unknown>:0: error: fatal error encountered during compilation; please file a bug report with your project and the crash log
<unknown>:0: note: Broken function found, compilation aborted!
0  swift                    0x000000010f89c3aa PrintStackTraceSignalHandler(void*) + 42
1  swift                    0x000000010f89b7e6 SignalHandler(int) + 662
2  libsystem_platform.dylib 0x00007fffcb62aefa _sigtramp + 26
3  libsystem_platform.dylib 0x00000001110a9498 _sigtramp + 1168631224
4  libsystem_c.dylib        0x00007fffcb46b14a abort + 127
5  swift                    0x000000010c26ab67 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*)::$_0::__invoke(void*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool) + 551
6  swift                    0x000000010f8599bb llvm::report_fatal_error(llvm::Twine const&, bool) + 571
7  swift                    0x000000010f85977a llvm::report_fatal_error(char const*, bool) + 42
8  swift                    0x000000010f82fc76 (anonymous namespace)::VerifierLegacyPass::runOnFunction(llvm::Function&) + 54
9  swift                    0x000000010f7dd16a llvm::FPPassManager::runOnFunction(llvm::Function&) + 506
10 swift                    0x000000010f7e4cc9 llvm::legacy::FunctionPassManagerImpl::run(llvm::Function&) + 377
11 swift                    0x000000010f7e4aba llvm::legacy::FunctionPassManager::run(llvm::Function&) + 410
12 swift                    0x000000010c3db238 swift::performLLVM(swift::IRGenOptions&, swift::DiagnosticEngine*, llvm::sys::SmartMutex<false>*, llvm::GlobalVariable*, llvm::Module*, llvm::TargetMachine*, swift::version::Version const&, llvm::StringRef) + 5128
13 swift                    0x000000010c26f5bb performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 19019
14 swift                    0x000000010c269304 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 7332
15 swift                    0x000000010c21f728 main + 12248
16 libdyld.dylib            0x00007fffcb3c7515 start + 1

1.  Running pass 'Module Verifier' on function '@_T012CodableCrash1BCACs7Decoder_p4from_tKcfc'

Additionally, if I remove the init(from🙂 in the superclass, I get a bad diagnostic saying I haven't implemented the requirement.

/Users/harlan/Desktop/CodableCrash/CodableCrash/main.swift:13:1: error: 'required' initializer 'init(from:)' must be provided by subclass of 'A'
}
^
<unknown>:0: note: 'required' initializer is declared in superclass here
@harlanhaskins
Copy link
Collaborator Author

@swift-ci create

@harlanhaskins
Copy link
Collaborator Author

On master, this no longer manifests in the IR verifier, it causes an assertion in SILGen.

unexpected storage type that differs from type-of-rvalue
UNREACHABLE executed at SILGenLValue.cpp:2782!

The issue is while emitting SIL for the superDecoder call.
Storing the superDecoder to a temporary and passing the temporary successfully compiles.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added the crash Bug: A crash, i.e., an abnormal termination of software label Dec 12, 2022
This issue was closed.
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 IRGen LLVM IR generation type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

2 participants