This is an archive of the discontinued LLVM Phabricator instance.

[analyzer] Resolve the crash in ReturnUndefChecker
ClosedPublic

Authored by george.karpenkov on Aug 24 2018, 6:47 PM.

Details

Summary

By making sure the returned value from getKnownSVal is consistent with the value used inside expression engine.

PR38427

Diff Detail

Repository
rC Clang

Event Timeline

NoQ accepted this revision.Aug 29 2018, 12:00 PM
NoQ added inline comments.
clang/lib/StaticAnalyzer/Checkers/UndefResultChecker.cpp
66–67 ↗(On Diff #162536)

Yup, this function, by contract, trying to explain why does ExprEngine think that the value is undefined, and it knows that ExprEngine would only decide that if the operands are known.

The assertion is good but i guess it'd be great to document this contract more explicitly.

clang/test/Analysis/casts.c
192–200 ↗(On Diff #162536)

Emm, how come that test was already there?

This revision is now accepted and ready to land.Aug 29 2018, 12:00 PM
This revision was automatically updated to reflect the committed changes.
This revision was automatically updated to reflect the committed changes.