Could a gatekeeper please review this patch?
https://bugs.open64.net/show_bug.cgi?id=750

See case attached in bug report.
This happens because s2.b1m reference in s2 = s1 is through vtable, it is
not aliased with directly filed access s2.b1m in if condition. Then WOPT
propagate s2.b1m’s init value 0 to if condition.

In ConstraintGraph::processExpr, if expr is adding a pointer with an unknown
offset,  the added pointer may points to ohter unknown offset now,
conservatively adjust pointer's CG Node ST's modulus.
AdjustPointsToForKCycle is used for this purpose, kcycle value got from
pointed type's size.

In this case, s2 + ((*(s2.vtable)).B1_offset) expression is not correctly
handled, its IR is below.
        U8U8LDID 0 <2,28,this> T<77,anon_ptr.,8> {cgnode 31}
      U8U8ILOAD 0 T<74,S,8> T<77,anon_ptr.,8> <field_id:1> {cgnode 41}
{alias_tag 10}
    I8I8ILOAD -24 T<5,.predef_I8,8> T<121,anon_ptr.,8> {cgnode 42}
{alias_tag 9}
    U8U8LDID 0 <2,28,this> T<106,anon_ptr.,8> {cgnode 31}
  U8ADD {cgnode 43}

Pointer is U8U8LDID 0 <2,28,this> T<106,anon_ptr.,8> {cgnode 31}
Offset is I8I8ILOAD -24 T<5,.predef_I8,8> T<121,anon_ptr.,8> {cgnode 42}
{alias_tag 9}
Current imeplemtation is get pointer's type from cgnode's ST type, which is
B2.
However on U8U8LDID 0 <2,28,this> T<106,anon_ptr.,8> {cgnode 31}, its
WN_type is B1. Correct type is B1.

Fix is in ConstraintGraph::processExpr, when setting kcycle for cgNode, if
Wn has pecified TY, use WN node's type.

Attachment: bug750.patch
Description: Binary data

------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel

Reply via email to