Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upSegfault in an unconditional drop call after a match #30530
Comments
sfackler
added
I-crash
I-nominated
T-compiler
labels
Dec 22, 2015
This comment has been minimized.
This comment has been minimized.
|
It looks like |
This comment has been minimized.
This comment has been minimized.
|
Seems like a case where we failed to initialize the temporary storage slot to 0, even though it is only conditionally initialized. cc @pnkfelix |
This comment has been minimized.
This comment has been minimized.
|
Looks like it might be the same problem as #29092 |
pnkfelix
self-assigned this
Jan 7, 2016
This comment has been minimized.
This comment has been minimized.
|
triage: P-high |
rust-highfive
added
P-high
and removed
I-nominated
labels
Jan 7, 2016
This comment has been minimized.
This comment has been minimized.
Yes, this looks right. In particular, the code in trans is structured in a somewhat misleading way: there's this The problem, I think, is that there is no guarantee that the populate call will dominates the cleanup code generated at the end of the scope. The I'm not completely sure the best way to fix this quickly. My current plan is to try to inject initialization code (for types that need the drop flag) that will run right after the Update: (not sure if the above hypothesis is 100% right; I'm reviewing the logic from |
This comment has been minimized.
This comment has been minimized.
|
oh: mod build { ... fn Alloca(cx, ty, name) -> ValueRef { AllocaFcx(cx.fcx, ty, name) } ... } |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@pnkfelix Yeah, we put all the allocas at the top of the entry BB. Doing otherwise results in dynamic stack manipulation which isn't the best in LLVM (IIRC you can stack overflow by having an alloca in a loop - presumably missing a |
This comment has been minimized.
This comment has been minimized.
|
@eddyb right, its actually perfectly sensible; I just worry (or worried) that some people may have the wrong impression based on the function signature(s). |
sfackler commentedDec 22, 2015
This code will segfault running drop glue for
Box<Box<Fn()>>, even though a value of that type is not actually created.Interestingly, it exits successfully if the second match body is wrapped in a block.