On Apr 10, 2012, at 8:51 PM, Richard Smith wrote:

> On Tue, Apr 10, 2012 at 1:59 PM, Anna Zaks <[email protected]> wrote:
> Added: cfe/trunk/test/Analysis/dynamic-cast.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/dynamic-cast.cpp?rev=154434&view=auto
> ==============================================================================
> --- cfe/trunk/test/Analysis/dynamic-cast.cpp (added)
> +++ cfe/trunk/test/Analysis/dynamic-cast.cpp Tue Apr 10 15:59:00 2012
> [...] 
> +// False negatives.
> +
> +// Symbolic regions are not typed, so we cannot deduce that the cast will
> +// always fail in this case.
> 
> The cast won't always fail:
> 
> class D : public B, public C {};
> int main() {
>   D d;
>   testDynCastFail1(&d);
> }
> 

Thanks Richard! Looks like we cannot tell for sure unless we see the object 
creation site.

We still should track Types of symbolic regions in cases it can be proved that 
the cast succeeds, but should special case and not assume that the cast fails 
if the region is symbolic.

I'll commit an amended test case.

> +int testDynCastFail1(class C *c) {
> +  B *b = 0;
> +  b = dynamic_cast<B*>(c);
> +  return b->m;
> +}

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to