public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ilya Enkovich <enkovich.gnu@gmail.com>
To: Jeff Law <law@redhat.com>
Cc: Richard Biener <rguenther@suse.de>,
	Uros Bizjak <ubizjak@gmail.com>,
		"gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH, i386, Pointer Bounds Checker 32/x] Pointer Bounds Checker hooks for i386 target
Date: Wed, 24 Sep 2014 14:42:00 -0000	[thread overview]
Message-ID: <CAMbmDYZkBqOnF_K+b5iKOSmf55Mm35g=18w1ki3=gQvJ5M8zHg@mail.gmail.com> (raw)
In-Reply-To: <5421AB3A.7050300@redhat.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

  reply	other threads:[~2014-09-24 14:42 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-18 19:34 Uros Bizjak
2014-09-19  3:10 ` Jeff Law
2014-09-19 12:16   ` Ilya Enkovich
2014-09-19 12:53 ` Ilya Enkovich
2014-09-19 16:21   ` Uros Bizjak
2014-09-22 15:30     ` Ilya Enkovich
2014-09-22 18:51       ` Uros Bizjak
2014-09-23  6:48         ` Ilya Enkovich
2014-09-23  7:29           ` Uros Bizjak
2014-09-23  7:55         ` Richard Biener
2014-09-23 14:10           ` Ilya Enkovich
2014-09-23 14:16             ` Richard Biener
2014-09-23 17:17             ` Jeff Law
2014-09-24 14:42               ` Ilya Enkovich [this message]
2014-09-22 18:54     ` Jeff Law
  -- strict thread matches above, loose matches on Subject: below --
2014-06-11 14:01 Ilya Enkovich
2014-09-15  7:17 ` Ilya Enkovich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMbmDYZkBqOnF_K+b5iKOSmf55Mm35g=18w1ki3=gQvJ5M8zHg@mail.gmail.com' \
    --to=enkovich.gnu@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=law@redhat.com \
    --cc=rguenther@suse.de \
    --cc=ubizjak@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).