parent
bd57f0cd32
commit
d6e1b5c070
2 changed files with 22 additions and 1 deletions
|
|
@ -2450,6 +2450,8 @@ proc genStmtList(p: BProc, n: PNode) =
|
||||||
genStmtListExprImpl:
|
genStmtListExprImpl:
|
||||||
genStmts(p, n[^1])
|
genStmts(p, n[^1])
|
||||||
|
|
||||||
|
from parampatterns import isLValue
|
||||||
|
|
||||||
proc upConv(p: BProc, n: PNode, d: var TLoc) =
|
proc upConv(p: BProc, n: PNode, d: var TLoc) =
|
||||||
var a: TLoc
|
var a: TLoc
|
||||||
initLocExpr(p, n[0], a)
|
initLocExpr(p, n[0], a)
|
||||||
|
|
@ -2468,6 +2470,10 @@ proc upConv(p: BProc, n: PNode, d: var TLoc) =
|
||||||
linefmt(p, cpsStmts, "if (!#isObj($1, $2)){ #raiseObjectConversionError(); $3}$n",
|
linefmt(p, cpsStmts, "if (!#isObj($1, $2)){ #raiseObjectConversionError(); $3}$n",
|
||||||
[r, checkFor, raiseInstr(p)])
|
[r, checkFor, raiseInstr(p)])
|
||||||
if n[0].typ.kind != tyObject:
|
if n[0].typ.kind != tyObject:
|
||||||
|
if n.isLValue:
|
||||||
|
putIntoDest(p, d, n,
|
||||||
|
"(*(($1*) (&($2))))" % [getTypeDesc(p.module, n.typ), rdLoc(a)], a.storage)
|
||||||
|
else:
|
||||||
putIntoDest(p, d, n,
|
putIntoDest(p, d, n,
|
||||||
"(($1) ($2))" % [getTypeDesc(p.module, n.typ), rdLoc(a)], a.storage)
|
"(($1) ($2))" % [getTypeDesc(p.module, n.typ), rdLoc(a)], a.storage)
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
15
tests/ccgbugs/t14160.nim
Normal file
15
tests/ccgbugs/t14160.nim
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
type
|
||||||
|
TPassContext = object of RootObj
|
||||||
|
PPassContext = ref TPassContext
|
||||||
|
|
||||||
|
PCtx = ref object of TPassContext
|
||||||
|
a: int
|
||||||
|
|
||||||
|
ModuleGraph = object
|
||||||
|
vm: RootRef
|
||||||
|
|
||||||
|
proc main() =
|
||||||
|
var g = ModuleGraph(vm: new(Pctx))
|
||||||
|
PCtx(g.vm) = nil #This generates invalid C code
|
||||||
|
|
||||||
|
main()
|
||||||
Loading…
Add table
Add a link
Reference in a new issue