This is an archive of the discontinued LLVM Phabricator instance.

[Analyzer] Fix for SValBuilder expressions rearrangement
ClosedPublic

Authored by baloghadamsoftware on Apr 12 2018, 1:31 AM.

Details

Summary

Expression rearrangement in SValBuilder (see rL329780) crashes with an assert if the type of the integer is different from the type of the symbol. This fix adds a check that prevents rearrangement in such cases.

Diff Detail

Event Timeline

NoQ added inline comments.Apr 12 2018, 12:41 PM
lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
443
  1. Therefore i conclude that this check should be moved to the branch around comment 3., and it'd become redundant here.
455–456
  1. We have expected LSym to be of this type.
469
  1. It holds on this branch.
474
  1. But not necessarily on that branch.
486
  1. We check that RSym is of the correct type, but LSym remains unchecked.
491
  1. Type of LInt here is guaranteed to be equal to the type of LSym, because that's how we construct symbols. Which was supposed to also be equal to SingleTy, but we didn't check for that.

Updated according to the comments.

NoQ accepted this revision.Apr 13 2018, 10:58 AM

Yup thanks!

This revision is now accepted and ready to land.Apr 13 2018, 10:58 AM
This revision was automatically updated to reflect the committed changes.