This is an archive of the discontinued LLVM Phabricator instance.

[analyzer] Fix a crash regression on casting opaque symbolic pointers from unrelated base classes to derived classes.
ClosedPublic

Authored by NoQ on Sep 17 2018, 1:32 PM.

Details

Summary

Commit D51191 causes a crash when a pointer to a completely unrelated type UnrelatedT (eg., opaque struct pattern) is being casted from base class BaseT to derived class DerivedT, which results in an ill-formed region Derived{SymRegion{$<UnrelatedT x>}, DerivedT}.

I guess we should prevent these from appearing somehow.

Diff Detail

Repository
rC Clang

Event Timeline

NoQ created this revision.Sep 17 2018, 1:32 PM
NoQ updated this revision to Diff 165821.Sep 17 2018, 1:33 PM

Add a bit more discussion into the comments.

george.karpenkov accepted this revision.Sep 17 2018, 1:40 PM
This revision is now accepted and ready to land.Sep 17 2018, 1:40 PM
NoQ updated this revision to Diff 165854.Sep 17 2018, 5:53 PM

Add a defensive check that prevents more crashes if the source type is not a class at all.

This revision was automatically updated to reflect the committed changes.
This revision was automatically updated to reflect the committed changes.