[cfe-commits] r156932 - /cfe/trunk/test/Analysis/string.c
Jordan Rose
jediknil at belkadan.com
Wed May 16 14:12:05 PDT 2012
I did put it in a separate file (comparison-implicit-casts.cpp). I considered adding the target triple but decided that once we were dealing with bool comparisons instead of int, it shouldn't be a problem. The test should be successful on /any/ platform now.
I did just check the standard, though, and sizeof(bool) is not guaranteed to be 1. I'll have that test run under i386 and x86_64.
Jordy
On May 16, 2012, at 16:59, Anna Zaks wrote:
> How about putting it in a separate file and test on only one target (add -triple x86_64 to the command line)?
>
> Anna.
> On May 16, 2012, at 1:37 PM, Jordy Rose wrote:
>
>> I should have known when I wrote the comment about requiring sizeof(size_t) > sizeof(1 == 1) that this was going to come back to haunt me. This worked before because we could early-exit and /avoid/ triggering warnings, but clang_analyzer_eval with -verify is a little stronger...
>>
>> Moved the test to a C++ file in r156941. If any platform has sizeof(size_t) == sizeof(bool), we're in trouble, but I don't think we support any of those. :-)
>>
>> Thanks for handling this, Anna.
>>
>> Jordy
>>
>>
>> On May 16, 2012, at 14:46, Anna Zaks wrote:
>>
>>> Author: zaks
>>> Date: Wed May 16 13:46:25 2012
>>> New Revision: 156932
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=156932&view=rev
>>> Log:
>>> [analyzer] Revert a regression committed in r156920.
>>>
>>> This breaks the build with -triple i386-apple-darwin9.
>>>
>>> Modified:
>>> cfe/trunk/test/Analysis/string.c
>>>
>>> Modified: cfe/trunk/test/Analysis/string.c
>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/string.c?rev=156932&r1=156931&r2=156932&view=diff
>>> ==============================================================================
>>> --- cfe/trunk/test/Analysis/string.c (original)
>>> +++ cfe/trunk/test/Analysis/string.c Wed May 16 13:46:25 2012
>>> @@ -1062,12 +1062,11 @@
>>>
>>> // Constrain the length of x.
>>> if (strlen(x) != value) return;
>>> -
>>> // Test relational operators.
>>> - clang_analyzer_eval(strlen(x) >= 2); // expected-warning{{TRUE}}
>>> - clang_analyzer_eval(2 <= strlen(x)); // expected-warning{{TRUE}}
>>> + if (strlen(x) < 2) { (void)*(char*)0; } // no-warning
>>> + if (2 > strlen(x)) { (void)*(char*)0; } // no-warning
>>>
>>> // Test equality operators.
>>> - clang_analyzer_eval(strlen(x) != 1); // expected-warning{{TRUE}}
>>> - clang_analyzer_eval(1 != strlen(x)); // expected-warning{{TRUE}}
>>> + if (strlen(x) == 1) { (void)*(char*)0; } // no-warning
>>> + if (1 == strlen(x)) { (void)*(char*)0; } // no-warning
>>> }
>>>
>>>
>>> _______________________________________________
>>> 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