@@ -609,15 +609,16 @@ proc aliases*(obj, field: PNode): bool =
609609
610610proc useInstrTargets * (ins: Instr ; loc: PNode ): bool =
611611 assert ins.kind == use
612- sameTrees (ins.n, loc) or
613- ins.n.aliases (loc) or loc.aliases (ins.n) # We can come here if loc is 'x.f' and ins.n is 'x' or the other way round.
612+ result = sameTrees (ins.n, loc) or
613+ ins.n.aliases (loc) or loc.aliases (ins.n)
614+ # We can come here if loc is 'x.f' and ins.n is 'x' or the other way round.
614615 # use x.f; question: does it affect the full 'x'? No.
615616 # use x; question does it affect 'x.f'? Yes.
616617
617618proc defInstrTargets * (ins: Instr ; loc: PNode ): bool =
618619 assert ins.kind == def
619- sameTrees (ins.n, loc) or
620- ins.n. aliases (loc) # We can come here if loc is 'x.f' and ins.n is 'x' or the other way round.
620+ result = sameTrees (ins.n, loc) or ins.n. aliases (loc)
621+ # We can come here if loc is 'x.f' and ins.n is 'x' or the other way round.
621622 # def x.f; question: does it affect the full 'x'? No.
622623 # def x; question: does it affect the 'x.f'? Yes.
623624
@@ -678,6 +679,10 @@ proc genDef(c: var Con; n: PNode) =
678679 c.code.add Instr (n: n, kind: def)
679680 elif isAnalysableFieldAccess (n, c.owner):
680681 c.code.add Instr (n: n, kind: def)
682+ else :
683+ # bug #13314: An assignment to t5.w = -5 is a usage of 't5'
684+ # we still need to gather the use information:
685+ gen (c, n)
681686
682687proc genCall (c: var Con ; n: PNode ) =
683688 gen (c, n[0 ])
0 commit comments