-
- Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Closed
Copy link
Description
Description
This code breaks using devel compiler
!nim c
import std/macros macro foo(a: openArray[string] = []): string = echo a # Segfault doesn't happen if this is removed newLit "" proc bar(a: static[openArray[string]] = []) = const tmp = foo(a) assert compiles(bar())GDB shows it segfaulting in ORC
0x00005555557a4b6a in nimDecRefIsLastDyn (p_p0=p_p0@entry=0x5555556e33b9 <dealloc+9>) at /home/user/.choosenim/toolchains/nim-#devel/lib/system/orc.nim:495 495 dec cell.rc, rcIncrement (gdb) where #0 0x00005555557a4b6a in nimDecRefIsLastDyn (p_p0=p_p0@entry=0x5555556e33b9 <dealloc+9>) at /home/user/.choosenim/toolchains/nim-#devel/lib/system/orc.nim:495 #1 0x00005555557a79bf in eqdestroy___ast_u3777 (dest_p0=0x5555556e33b9 <dealloc+9>) at /home/user/Documents/projects/Nim/compiler/ast.nim:1233 #2 0x0000555555c7b7d2 in semConstExpr__sem_u668 (c_p0=c_p0@entry=0x7ffff5ef8060, n_p1=0x7ffff2249360, expectedType_p2=expectedType_p2@entry=0x0) at /home/user/Documents/projects/Nim/compiler/ast.nim:1233 Nim Version
Nim Compiler Version 2.1.1 [Linux: amd64]
Compiled at 2023-10-31
Copyright (c) 2006-2023 by Andreas Rumpf
git hash: f61311f
active boot switches: -d:release
Current Output
Segfaults Expected Output
Doesn't segfault Possible Solution
No response
Additional Information
Bisected locally and found that #22032 is the cause