Fix #18079 Illegal storage access compiling call with nested ref/deref (#20738)

* add test case
* refactoring transformAddrDeref and fix #18079
* fix jsgen
This commit is contained in:
Bung 2022-11-04 16:54:45 +08:00 • committed by GitHub
commit ecc8f61fe4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 38 additions and 9 deletions

View file

@ -1422,6 +1422,13 @@ proc genAddr(p: PProc, n: PNode, r: var TCompRes) =
gen(p, n[0], r)
of nkHiddenDeref:
gen(p, n[0], r)
of nkDerefExpr:
var x = n[0]
if n.kind == nkHiddenAddr:
x = n[0][0]
if n.typ.skipTypes(abstractVar).kind != tyOpenArray:
x.typ = n.typ
gen(p, x, r)
of nkHiddenAddr:
gen(p, n[0], r)
of nkConv: