Skip to content

Commit 9350a06

Browse files
gbaraldiJeffBezanson
authored andcommitted
Fix unsafe-warn mutiple stacktrace output
1 parent a15e354 commit 9350a06

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/codegen.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2205,11 +2205,12 @@ static void push_frames(jl_codectx_t &ctx, jl_method_instance_t *caller, jl_meth
22052205

22062206
static jl_array_t* build_stack_crumbs(jl_codectx_t &ctx) JL_NOTSAFEPOINT
22072207
{
2208-
jl_method_instance_t *caller = (jl_method_instance_t*)jl_nothing; //nothing serves as a sentinel for the bottom for the stack
2209-
push_frames(ctx, ctx.linfo, (jl_method_instance_t*)jl_nothing);
2208+
static intptr_t counter = 5;
2209+
jl_method_instance_t *caller = (jl_method_instance_t*)counter; //nothing serves as a sentinel for the bottom for the stack
2210+
push_frames(ctx, ctx.linfo, (jl_method_instance_t*)caller);
2211+
counter++;
22102212
jl_array_t *out = jl_alloc_array_1d(jl_array_any_type, 0);
22112213
JL_GC_PUSH1(&out);
2212-
22132214
while (true) {
22142215
auto it = ctx.emission_context.enqueuers.find(caller);
22152216
if (it != ctx.emission_context.enqueuers.end()) {
@@ -2218,6 +2219,7 @@ static jl_array_t* build_stack_crumbs(jl_codectx_t &ctx) JL_NOTSAFEPOINT
22182219
break;
22192220
}
22202221
if (caller) {
2222+
assert(ctx.emission_context.enqueuers.count(caller) == 1);
22212223
if (jl_is_method_instance(caller)) {
22222224
//TODO: Use a subrange when C++20 is a thing
22232225
for (auto it2 = std::get<CallFrames>(it->second).begin(); it2 != (std::prev(std::get<CallFrames>(it->second).end())); ++it2) {

0 commit comments

Comments
 (0)