[llvm-bugs] [Bug 16745] Static analyzer incorrectly models a synthesized assignment operator

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Nov 6 11:16:23 PST 2016


https://llvm.org/bugs/show_bug.cgi?id=16745

Devin Coughlin <dcoughlin at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #11 from Devin Coughlin <dcoughlin at apple.com> ---
This false positive no longer manifests and it looks like Sema was indeed
changed to create distinct DeclRefExprs for __i0. I'm going to mark this as
RESOLVED.

Here is an AST dump from ToT:
| `-CXXMethodDecl 0x7ffd2d869bd0 <col:8> col:8 implicit used operator= 'struct
B &(struct B &) noexcept(false)' inline
|   |-ParmVarDecl 0x7ffd2d869d00 <col:8> col:8 used 'struct B &'
|   `-CompoundStmt 0x7ffd2d86a378 <col:8>
|     |-BinaryOperator 0x7ffd2d869ee0 <col:8> 'int' lvalue '='
|     | |-MemberExpr 0x7ffd2d869e30 <col:8> 'int' lvalue ->a 0x7ffd2d84a9e0
|     | | `-CXXThisExpr 0x7ffd2d869e18 <col:8> 'struct B *' this
|     | `-ImplicitCastExpr 0x7ffd2d869ec8 <col:8> 'int' <LValueToRValue>
|     |   `-MemberExpr 0x7ffd2d869e90 <col:8> 'int' lvalue .a 0x7ffd2d84a9e0
|     |     `-DeclRefExpr 0x7ffd2d869e68 <col:8> 'struct B' lvalue ParmVar
0x7ffd2d869d00 '' 'struct B &'
|     |-ForStmt 0x7ffd2d86a2f0 <col:8>
|     | |-DeclStmt 0x7ffd2d869fa0 <col:8>
|     | | `-VarDecl 0x7ffd2d869f20 <col:8> col:8 used __i0 'unsigned long'
cinit
|     | |   `-IntegerLiteral 0x7ffd2d869f80 <col:8> 'unsigned long' 0
|     | |-<<<NULL>>>
|     | |-BinaryOperator 0x7ffd2d86a220 <col:8> '_Bool' '!='
|     | | |-ImplicitCastExpr 0x7ffd2d86a270 <col:8> 'unsigned long'
<LValueToRValue>
|     | | | `-DeclRefExpr 0x7ffd2d86a248 <col:8> 'unsigned long' lvalue Var
0x7ffd2d869f20 '__i0' 'unsigned long'
|     | | `-IntegerLiteral 0x7ffd2d86a288 <col:8> 'unsigned long' 1
|     | |-UnaryOperator 0x7ffd2d86a2a8 <col:8> 'unsigned long' lvalue prefix
'++'
|     | | `-DeclRefExpr 0x7ffd2d86a2c8 <col:8> 'unsigned long' lvalue Var
0x7ffd2d869f20 '__i0' 'unsigned long'
|     | `-CXXMemberCallExpr 0x7ffd2d86a1f0 <col:8> 'struct A' lvalue
|     |   |-MemberExpr 0x7ffd2d86a0c0 <col:8> '<bound member function type>'
.operator= 0x7ffd2d84a740
|     |   | `-ArraySubscriptExpr 0x7ffd2d86a088 <col:8> 'struct A' lvalue
|     |   |   |-ImplicitCastExpr 0x7ffd2d86a070 <col:8> 'struct A *'
<ArrayToPointerDecay>
|     |   |   | `-MemberExpr 0x7ffd2d869ff8 <col:8> 'struct A [1]' lvalue ->b
0x7ffd2d84ab58
|     |   |   |   `-CXXThisExpr 0x7ffd2d869fe0 <col:8> 'struct B *' this
|     |   |   `-ImplicitCastExpr 0x7ffd2d86a058 <col:8> 'unsigned long'
<LValueToRValue>
|     |   |     `-DeclRefExpr 0x7ffd2d86a030 <col:8> 'unsigned long' lvalue Var
0x7ffd2d869f20 '__i0' 'unsigned long'
|     |   `-ArraySubscriptExpr 0x7ffd2d86a1c8 <col:8> 'struct A' lvalue
|     |     |-ImplicitCastExpr 0x7ffd2d86a1b0 <col:8> 'struct A *'
<ArrayToPointerDecay>
|     |     | `-MemberExpr 0x7ffd2d86a138 <col:8> 'struct A [1]' lvalue .b
0x7ffd2d84ab58
|     |     |   `-DeclRefExpr 0x7ffd2d86a110 <col:8> 'struct B' lvalue ParmVar
0x7ffd2d869d00 '' 'struct B &'
|     |     `-ImplicitCastExpr 0x7ffd2d86a198 <col:8> 'unsigned long'
<LValueToRValue>
|     |       `-DeclRefExpr 0x7ffd2d86a170 <col:8> 'unsigned long' lvalue Var
0x7ffd2d869f20 '__i0' 'unsigned long'
|     `-ReturnStmt 0x7ffd2d86a360 <col:8>
|       `-UnaryOperator 0x7ffd2d86a340 <col:8> 'struct B' lvalue prefix '*'
|         `-CXXThisExpr 0x7ffd2d86a328 <col:8> 'struct B *' this

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20161106/ecd9f536/attachment.html>


More information about the llvm-bugs mailing list