george.karpenkov added a comment.

> I'm curious if the crash would turn into an assertion failure during 
> getRawSVal() after https://reviews.llvm.org/D38801 is committed.

I guess we would see?

> If this problem is fixed on the checker side (it probably should be - the 
> checker , we can probably put stronger asserts onto types suitable for 
> symbols.

Of course I'm new, but I disagree with this statement: in order to have a 
robust API, the function should not crash, unless the caller violates an 
explicit precondition.
 `getSVal` is just a function for getting a symbolic value for a particular 
statement, it seems totally valid to query it for an expression which type is 
`void`.



================
Comment at: lib/StaticAnalyzer/Core/ProgramState.cpp:265
+  // to the type of T, which is not always the case (e.g. for void).
+  if (!T.isNull() && (T->isIntegralOrEnumerationType() || Loc::isLocType(T))) {
     if (SymbolRef sym = V.getAsSymbol()) {
----------------
NoQ wrote:
> If a type is an integral or enumeration type or a Loc type, then it is 
> definitely not null.
But the check itself will crash if the type is null.


https://reviews.llvm.org/D39862



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to