[cfe-commits] r157478 - in /cfe/trunk: lib/StaticAnalyzer/Core/ExprEngineC.cpp test/Analysis/cxx11-crashes.cpp
Anna Zaks
ganna at apple.com
Tue May 29 11:05:54 PDT 2012
There seems to be more to it... I am deferring the further investigation. This case is very rare; we can add support to it with the rest of C++ stuff.
Thanks,
Anna.
On May 25, 2012, at 9:39 AM, Jordy Rose wrote:
> Do we even need to conjure a new value here? reinterpret_cast on a location should be the same as static_cast or C-style casts, right? (At least when we're not dealing with fptr<->ptr conversions or different memory segments.)
>
> Of course, I might be missing something.
>
>
> On May 25, 2012, at 12:02, Anna Zaks wrote:
>
>> Author: zaks
>> Date: Fri May 25 11:02:16 2012
>> New Revision: 157478
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=157478&view=rev
>> Log:
>> [analyzer] Don't crash on LValBitCast
>>
>> Modified:
>> cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineC.cpp
>> cfe/trunk/test/Analysis/cxx11-crashes.cpp
>>
>> Modified: cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineC.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineC.cpp?rev=157478&r1=157477&r2=157478&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineC.cpp (original)
>> +++ cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineC.cpp Fri May 25 11:02:16 2012
>> @@ -279,7 +279,6 @@
>> case CK_Dependent:
>> case CK_ArrayToPointerDecay:
>> case CK_BitCast:
>> - case CK_LValueBitCast:
>> case CK_IntegralCast:
>> case CK_NullToPointer:
>> case CK_IntegralToPointer:
>> @@ -378,7 +377,8 @@
>> case CK_UserDefinedConversion:
>> case CK_ConstructorConversion:
>> case CK_VectorSplat:
>> - case CK_MemberPointerToBoolean: {
>> + case CK_MemberPointerToBoolean:
>> + case CK_LValueBitCast: {
>> // Recover some path-sensitivty by conjuring a new value.
>> QualType resultType = CastE->getType();
>> if (CastE->isGLValue())
>>
>> Modified: cfe/trunk/test/Analysis/cxx11-crashes.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/cxx11-crashes.cpp?rev=157478&r1=157477&r2=157478&view=diff
>> ==============================================================================
>> --- cfe/trunk/test/Analysis/cxx11-crashes.cpp (original)
>> +++ cfe/trunk/test/Analysis/cxx11-crashes.cpp Fri May 25 11:02:16 2012
>> @@ -57,3 +57,10 @@
>> bool s[25];
>> addressof(s);
>> }
>> +
>> +// radar://11487525 Don't crash on CK_LValueBitCast.
>> +bool begin(double *it) {
>> + typedef bool type[25];
>> + bool *a = reinterpret_cast<type &>(*( reinterpret_cast<char *>( it )));
>> + return *a;
>> +}
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
More information about the cfe-commits
mailing list