public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrew MacLeod <amacleod@redhat.com>
To: Aldy Hernandez <aldyh@redhat.com>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>,
	       Richard Guenther <richard.guenther@gmail.com>,
	       Ian Lance Taylor <ian@airs.com>,
	Jakub Jelinek <jakub@redhat.com>
Subject: Re: [path] PR 54900: store data race in if-conversion pass
Date: Mon, 15 Oct 2012 14:25:00 -0000	[thread overview]
Message-ID: <507C1721.4080700@redhat.com> (raw)
In-Reply-To: <507C015F.2090508@redhat.com>

On 10/15/2012 08:28 AM, Aldy Hernandez wrote:
>
> I am having a bit of a problem coming up with a generic testcase. 
> Perhaps Andrew or others have an idea.
>
> The attached testcase fails to trigger without the patch, because 
> AFAICT we have no way of testing an addition of zero to a memory 
> location:
>
>         cmpl    $1, flag(%rip)
>         setb    %al
>         addl    %eax, dont_write(%rip)
>
> In the simulate-thread harness I can test the environment before an 
> instruction, and after an instruction, but adding 0 to *dont_write 
> produces no measurable effects, particularly in a back-end independent 
> manner.  Ideas?

Hum. isn't that clever.   Well, the instruction is executed pretty much 
atomically... so a write of the same value becomes very difficult to 
detect, and impossible within the existing harness. And I dont think a 
hardware watch point can catch that...

The only way I can think of is if you put 'dont_write' into a section 
which will trap if it is written to...  I don't know the details of 
doing such a thing or how you monitor the trap within the harness...

Other than that I'm not sure we can detect this with our current set of 
tools, for the longer term we'd need a write detector.  I don't suppose 
something like systemtap can detect writes like this?

Andrew

  reply	other threads:[~2012-10-15 14:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-15 12:53 Aldy Hernandez
2012-10-15 14:25 ` Andrew MacLeod [this message]
2012-10-16 17:32 ` Ian Lance Taylor
2012-10-16 17:33   ` Jakub Jelinek
2012-10-17  0:33     ` Aldy Hernandez
2012-10-17  0:54       ` Ian Lance Taylor
2012-10-19  1:41         ` Aldy Hernandez
2012-10-17  0:26   ` Aldy Hernandez
2012-10-17  0:54     ` Ian Lance Taylor
2012-10-17  4:54     ` Richard Henderson
2012-10-17  5:18       ` Jeff Law
2012-10-17 21:48         ` Aldy Hernandez

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=507C1721.4080700@redhat.com \
    --to=amacleod@redhat.com \
    --cc=aldyh@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=ian@airs.com \
    --cc=jakub@redhat.com \
    --cc=richard.guenther@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).