Fix unsound transform pass (#8633)
When a `var openArray[T]` function parameter goes trough the `transformAddrDeref` pass we may lose the `var` specifier, leading to nasty crashes at runtime.
This commit is contained in:
parent
9a7e6be62f
commit
c04404635b
4 changed files with 22 additions and 0 deletions
8
tests/ccgbugs/topenarraycast.nim
Normal file
8
tests/ccgbugs/topenarraycast.nim
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
proc foo[T](s: var openArray[T]): T =
|
||||
for x in s: result += x
|
||||
|
||||
proc bar(xyz: var seq[int]) =
|
||||
doAssert 6 == (seq[int](xyz)).foo()
|
||||
|
||||
var t = @[1,2,3]
|
||||
bar(t)
|
||||
Loading…
Add table
Add a link
Reference in a new issue