[PATCH] Enable experimental TSAN support for Ada

Richard Biener richard.guenther@gmail.com
Fri Jan 9 10:13:00 GMT 2015


On Mon, Jan 5, 2015 at 9:00 PM, Jeff Law <law@redhat.com> wrote:
> On 01/03/15 06:49, Bernd Edlinger wrote:
>>
>> Hi,
>>
>> I was experimenting with enabling TSAN for Ada recently.
>> I think this gives rather interesting results.
>>
>> The Instrumentation worked almost out of the box, we just have
>> the problem that it is not gimple-OK to fold something like
>> "& VIEW_CONVERT_EXPR(x)", and this happens in Ada all the time.
>>
>> Boot-Strapped and regression-tested on x86_64-linux-gnu.
>> OK for trunk?
>>
>>
>> Thanks
>> Bernd.
>>
>>
>>
>> changelog-tsan-ada.txt
>>
>>
>> gcc/ChangeLog:
>> 2015-01-03  Bernd Edlinger<bernd.edlinger@hotmail.de>
>>
>>         Enable experimental TSAN support for Ada.
>>         * tsan.c (instrument_expr): Handle VIEW_CONVERT_EXPR.
>
> OK for the trunk with a comment before the new block of code indicating why
> we need to handle VIEW_CONVERT_EXPR specially here (specifically we can't
> call build_fold_addr_expr on the VIEW_CONVERT_EXPR).

There may be multiple VIEW_CONVERT_EXPRs in a reference chain
so simply stripping the outermost only doesn't work (the assert).

I wonder why you do all the special-casing when you have already
called get_inner_reference on the reference.  The address is
simply &base + offset + bitpos / BITS_PER_UNIT, the bitfield
case is detectable via bitpos % BITS_PER_UNIT != 0.

Sth else I noticed, instead of checking points-to in the weird way
you do you simply want if (DECL_P (base) && !may_be_aliased (base)).

Richard.

> Jeff
>



More information about the Gcc-patches mailing list