[llvm-commits] AddressSanitizer GCD tests on Mac: prevent optimization, enable.

Alexander Potapenko glider at google.com
Tue Dec 6 03:04:08 PST 2011


Including asan_test_utils.h is not possible, because 'extern "C"' and
'template' is not valid ObjC code.
Let it be volatile, otherwise we'll need to write a separate
asan_test_utils for ObjC, which'll be an overkill.

On Mon, Dec 5, 2011 at 11:04 PM, Kostya Serebryany <kcc at google.com> wrote:
> I wonder if you can reuse Ident() from tests/asan_test_utils.h instead of
> using volatile.
> Like this:
>   char *mem = Ident(malloc(10));
>
> // This function returns its parameter but in such a way that compiler
>
>
> // can not prove it.
>
>
> template<class T>
>
>
> __attribute__((noinline))
>
>
> static T Ident(T t) {
> ...
>
>
> --kcc
>
>
> On Mon, Dec 5, 2011 at 12:44 AM, Alexander Potapenko <glider at google.com>
> wrote:
>>
>> Fix GCD tests for AddressSanitizer on Mac.
>> The following patch declares the char* vars holding the memory
>> allocations as volatile, which prevents the compiler from optimizing
>> them and breaking the tests.
>> I'm also enabling the tests by default, as the GCD support in ASan
>> runtime library is quite stable already.
>>
>> --
>> Alexander Potapenko
>> Software Engineer
>> Google Moscow
>
>



-- 
Alexander Potapenko
Software Engineer
Google Moscow




More information about the llvm-commits mailing list