[llvm-bugs] [Bug 35506] New: [Analyzer- Loop Widen] Assertion `!InitValWithAdjustments.getAs<Loc>() || Loc::isLocType(Result->getType()) || Result->getType()->isMemberPointerType()' failed.

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Dec 2 02:51:11 PST 2017


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

            Bug ID: 35506
           Summary: [Analyzer- Loop Widen] Assertion
                    `!InitValWithAdjustments.getAs<Loc>() ||
                    Loc::isLocType(Result->getType()) ||
                    Result->getType()->isMemberPointerType()' failed.
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
          Assignee: dcoughlin at apple.com
          Reporter: movietravelcode at outlook.com
                CC: llvm-bugs at lists.llvm.org

When I use the command "$clang++ --analyze -Xanalyzer -analyzer-checker=alpha
-Xanalyzer -analyzer-config -Xanalyzer widen-loops=true test.cpp" will get an
assertion failure. Although the assert is in
"ExprEngine::createTemporaryRegionIfNeeded()", I found this error eventually
caused by loop widen. When there is a loop in constructor, the analyzer will
invalidate the `this` pointer when I set `widen-loops=true`. As we know, `this`
pointer is `prvalue expression` actually, see
http://en.cppreference.com/w/cpp/language/this.

class BlockId
{
public:
        BlockId(const int parm);
};

int count = 0;
const int global = 10;
void goo(BlockId id);

BlockId::BlockId(const int parm)
{
        const int num = 10;
        do {
                count = count - num;
        } while (count--);
        count = num + parm;
}

int main()
{
        // goo(10);
        goo(BlockId(10));
}

-- 
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/20171202/60b6bb89/attachment.html>


More information about the llvm-bugs mailing list