This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, i386, Pointer Bounds Checker 32/x] Pointer Bounds Checker hooks for i386 target
- From: Ilya Enkovich <enkovich dot gnu at gmail dot com>
- To: Jeff Law <law at redhat dot com>
- Cc: Richard Biener <rguenther at suse dot de>, Uros Bizjak <ubizjak at gmail dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 24 Sep 2014 18:42:25 +0400
- Subject: Re: [PATCH, i386, Pointer Bounds Checker 32/x] Pointer Bounds Checker hooks for i386 target
- Authentication-results: sourceware.org; auth=none
- References: <CAFULd4aeUY1_K0vHgq57RPX8HqgJJ7t1LGK+qpEnn4LkYJ2wOg at mail dot gmail dot com> <20140919122338 dot GG50194 at msticlxl57 dot ims dot intel dot com> <CAFULd4a51Dy7BukD7AemD=pPq_gXtPjZ=ChfeBLYESYW=+B=AQ at mail dot gmail dot com> <20140922153029 dot GA35262 at msticlxl57 dot ims dot intel dot com> <CAFULd4YzL25+rvjk1KrH2y3PN4bsZ3QxRX1QN9v8W55h53wDww at mail dot gmail dot com> <alpine dot LSU dot 2 dot 11 dot 1409230945090 dot 20733 at zhemvz dot fhfr dot qr> <20140923141008 dot GE35262 at msticlxl57 dot ims dot intel dot com> <5421AB3A dot 7050300 at redhat dot com>
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
- References:
- Re: [PATCH, i386, Pointer Bounds Checker 32/x] Pointer Bounds Checker hooks for i386 target
- Re: [PATCH, i386, Pointer Bounds Checker 32/x] Pointer Bounds Checker hooks for i386 target
- Re: [PATCH, i386, Pointer Bounds Checker 32/x] Pointer Bounds Checker hooks for i386 target
- Re: [PATCH, i386, Pointer Bounds Checker 32/x] Pointer Bounds Checker hooks for i386 target
- Re: [PATCH, i386, Pointer Bounds Checker 32/x] Pointer Bounds Checker hooks for i386 target
- Re: [PATCH, i386, Pointer Bounds Checker 32/x] Pointer Bounds Checker hooks for i386 target
- Re: [PATCH, i386, Pointer Bounds Checker 32/x] Pointer Bounds Checker hooks for i386 target
- Re: [PATCH, i386, Pointer Bounds Checker 32/x] Pointer Bounds Checker hooks for i386 target