public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Bernd Edlinger <bernd.edlinger@hotmail.de>
To: Tom de Vries <Tom_deVries@mentor.com>
Cc: Dmitry Vyukov <dvyukov@google.com>,
	"gcc-patches@gcc.gnu.org"	<gcc-patches@gcc.gnu.org>,
	Jakub Jelinek <jakub@redhat.com>,
	Dodji Seketeli	<dodji@redhat.com>,
	Kostya Serebryany <kcc@google.com>,
	"thread-sanitizer@googlegroups.com"
	<thread-sanitizer@googlegroups.com>
Subject: Re: [RFC, PR68580] Handle pthread_create error in tsan testsuite
Date: Mon, 15 Feb 2016 09:07:00 -0000	[thread overview]
Message-ID: <HE1PR07MB090529F0173D75A4621D5FD6E4AC0@HE1PR07MB0905.eurprd07.prod.outlook.com> (raw)

On 15/02/16 09:07, Tom de Vries wrote:
>>On 15/02/16 08:24, Dmitry Vyukov wrote:
>>
>>    If we are talking about pr 68580, then I would try:
>>    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68580#c2
>>    first.
>
> As I tried to explain in the follow-up comment ( https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68580#c3 ),
> since unfortunately I have no reliable way of reproducing the failure, there's no defined way to 'try' something.

But your proposed patch is also only guessing.
Sure pthread_create can fail, as malloc and mmap.
But if that is the reason for the failure it would happen
just randomly, everywhere.

Why do you think that only this test case shows the problem?

I think Dmitry's comment may be right on the point.

In pr65400-1.c we have
int v; int q; int o; 

be 4 byte aligned integers.
and at least
v and q share the same 8-byte tsan shadow memory slot.

v and q are modified simultaniously, and each update
can be lost.

The barrier wont help here, as it only synchronizes
accesses on v.

So I think either we change int => long long
or add __attribute__((aligned(8))) to the variable declarations,
to make sure that each of them goes into a different memory
slot.


Regards,
Bernd.


             reply	other threads:[~2016-02-15  9:07 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-15  9:07 Bernd Edlinger [this message]
2016-02-15  9:15 ` Dmitry Vyukov
2016-02-15 10:45 ` Tom de Vries
2016-02-15 10:56   ` Dmitry Vyukov
2016-02-15 11:29     ` Bernd Edlinger
2016-02-15 12:05       ` Dmitry Vyukov
2016-02-15 12:44         ` AW: " Bernd Edlinger
2016-02-15 12:46           ` Dmitry Vyukov
2016-02-15 19:26       ` Mike Stump
2016-02-15 19:34         ` Dmitry Vyukov
2016-02-18 11:36       ` Tom de Vries
2016-02-18 20:19         ` Bernd Edlinger
2016-02-18 21:31           ` Jakub Jelinek
  -- strict thread matches above, loose matches on Subject: below --
2016-02-15  6:01 Tom de Vries
2016-02-15  7:18 ` Dmitry Vyukov
2016-02-15  7:25   ` Dmitry Vyukov
2016-02-15  8:07     ` Tom de Vries

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=HE1PR07MB090529F0173D75A4621D5FD6E4AC0@HE1PR07MB0905.eurprd07.prod.outlook.com \
    --to=bernd.edlinger@hotmail.de \
    --cc=Tom_deVries@mentor.com \
    --cc=dodji@redhat.com \
    --cc=dvyukov@google.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=kcc@google.com \
    --cc=thread-sanitizer@googlegroups.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).