This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, i386, Pointer Bounds Checker 32/x] Pointer Bounds Checker hooks for i386 target


2014-09-23 21:17 GMT+04:00 Jeff Law <law@redhat.com>:
> On 09/23/14 08:10, Ilya Enkovich wrote:
>>>
>>> Please use fold_convert (size_ptr, build_fold_addr_expr (var)).
>>>
>>> Is 'var' always accessed via a size_t effective type?  Watch out
>>> for TBAA issues if not.  (if it is, why is 'var' not of type size_t
>>> or size_t[]?)
>>
>>
>> var has pointer bounds type.  I have to initialize it by parts and
>> thus access it as a couple of integers having size of a pointer (I
>> use integer instead of pointer because non poiner arithmetic is
>> used).  Size type is not the best for this purpose and therefore I
>> replace it with pointer_sized_int_node.
>>
>> So I have accesses of var's parts as integers and accesses of whole
>> var as bounds.  Should I expect some problems from TBAA here?  How
>> can I avoid problems with TBAA if any exists?
>
> In general, anytime you access a hunk of memory using two different types,
> then you run the risk of problems with TBAA.  In the case of bounds, we
> aren't exposing them to usercode, so you just have to worry about the
> refs/sets that you create.
>
> I think you could create an alias set for the bounds and attach it to every
> load/store if you aren't type safe for all the loads/stores.  That will
> create a dependency between all the bounds loads/stores, but not with
> unrelated loads/stores.   Alternately ensure all the loads/stores are in
> alias set 0, but that will likely have performance implications.

I access parts of bounds using pointer_sized_int_node only in
constructors which initialize static bound variables.  These
constructors do not have other usages of these vars and all other
usages of these vars in other functions use bounds type for access.
That should make me safe from TBAA point of view.

Ilya

>
> Jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]