-
-
Notifications
You must be signed in to change notification settings - Fork 428
Segfault (from gc.c) when matching on union of (A iso | B val) #4807
Copy link
Copy link
Labels
triggers releaseMajor issue that when fixed, results in an "emergency" releaseMajor issue that when fixed, results in an "emergency" release
Description
This is loosely based on the match#implicit-matching-on-capabilities-in-the-context-of-union-types example from the tutorial
Code to reproduce
class A
var v: Any val
new create(v': Any val) =>
v = consume v'
class B
actor Foo
var _x: (A iso | B val | None)
let e: Env
new create(e': Env, x': (A iso | B val | None)) => // the B val is essential. If we remove it, the segfault does not occur
e = e'
_x = consume x'
be f() =>
match (_x = None)
| let a: A iso => None
end
actor Main
new create(env: Env) =>
let f_iso = Foo(env, recover A("hello".string()) end)
// Can also use U32(123), Bool(true), etc.
// note that a string without `.string()` doesn't trigger the segfault
f_iso.f()Backtrace
* thread #16, stop reason = EXC_BAD_ACCESS (code=1, address=0x8)
frame #0: 0x0000000100012330 28_gc773_segfault`ponyint_gc_release(gc=0x00000001081788d8, aref=0x000000014817bc00) at gc.c:773:5
770 void* p = obj->address;
771 object_t* obj_local = ponyint_objectmap_getobject(&gc->local, p, &index);
772
-> 773 pony_assert(obj_local->rc >= obj->rc);
774 obj_local->rc -= obj->rc;
775 }
776
Target 0: (28_gc773_segfault) stopped.
(lldb) bt
* thread #16, stop reason = EXC_BAD_ACCESS (code=1, address=0x8)
* frame #0: 0x0000000100012330 28_gc773_segfault`ponyint_gc_release(gc=0x00000001081788d8, aref=0x000000014817bc00) at gc.c:773:5
frame #1: 0x0000000100005acc 28_gc773_segfault`handle_message(ctx=0x000000010817b308, actor=0x0000000108178800, msg=0x000000014817b480) at actor.c:357:10
frame #2: 0x000000010000555c 28_gc773_segfault`ponyint_actor_run(ctx=0x000000010817b308, actor=0x0000000108178800, polling=false) at actor.c:561:20
frame #3: 0x0000000100022208 28_gc773_segfault`run(sched=0x000000010817b2c0) at scheduler.c:1255:23
frame #4: 0x0000000100021408 28_gc773_segfault`run_thread(arg=0x000000010817b2c0) at scheduler.c:1308:3
frame #5: 0x000000019c67fbc8 libsystem_pthread.dylib`_pthread_start + 136
Ponyc version
0.60.5-f79c2390 [debug]
Compiled with: LLVM 18.1.8 -- AppleClang-15.0.0.15000309-arm64
Defaults: pic=true
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
triggers releaseMajor issue that when fixed, results in an "emergency" releaseMajor issue that when fixed, results in an "emergency" release