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-7996] Assertion failure in PredictableMemOpt #50529

Closed
ChristopherRogers opened this issue Jun 14, 2018 · 4 comments
Closed

[SR-7996] Assertion failure in PredictableMemOpt #50529

ChristopherRogers opened this issue Jun 14, 2018 · 4 comments
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 SILOptimizer Area → compiler: SIL optimization passes

Comments

@ChristopherRogers
Copy link
Contributor

Previous ID SR-7996
Radar rdar://problem/41161408
Original Reporter @ChristopherRogers
Type Bug
Status Resolved
Resolution Done
Environment

Swift 4.2-dev master branch (823ed14), macOS 10.13.5

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, CompilerCrash, SILOptimizer
Assignee None
Priority Medium

md5: 94f6f6da4c41891b8a1f9354e15874ed

Issue Description:

... "Unknown access path instruction", line 139 in computeSubelement().

It can be triggered by compiling the following code with -O:

func foo<T>(_ t: T?) -> T? {
  let v = t!
  bar(v)
  return v
}

func bar<T>(_: T?) { }

_ = foo(42)

The SIL instruction that triggers it is the second init_enum_data_addr instruction (for preparing the return value).

There are other assertions in the file (saying that enum projections aren't supported) testing against the error value for computeSubelement()–except for the one codepath that triggers this. That, and the fact that the generated code works (with assertions off) leads me to think that maybe this one assertion just needs to be removed to fix this. I don't know enough about SIL to know if this is a sign of something going wrong elsewhere or what. I'd be willing to look into it some more if someone could nudge me in the right direction.

@belkadan
Copy link
Contributor

cc @gottesmm, @atrick

@belkadan
Copy link
Contributor

@swift-ci create

@gottesmm
Copy link
Member

This is fall out from

5bfd8e1

That commit moved PredictableMemOpts into the performance pipeline and it is seeing instructions that it is unfamiliar with. PredictableMemOpts is tied pretty close to SILGen. I am going to do a quick go over to see if we are asserting where we should bail in Canonical SIL.

@belkadan
Copy link
Contributor

Michael fixed this in

master: #17543
4.2: #17598

@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 SILOptimizer Area → compiler: SIL optimization passes
Projects
None yet
Development

No branches or pull requests

4 participants