public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: Thomas Schwinge <thomas@codesourcery.com>
Cc: Martin Sebor <msebor@gmail.com>,
	libstdc++@gcc.gnu.org,        gcc-patches@gcc.gnu.org,
	Marek Polacek <polacek@redhat.com>,
	       "Joseph S. Myers" <joseph@codesourcery.com>,
	Jeff Law <law@redhat.com>
Subject: Re: [PR c/68966] Restore atomic builtins usage in libstdc++-v3
Date: Tue, 05 Apr 2016 11:01:00 -0000	[thread overview]
Message-ID: <20160405110148.GE5814@redhat.com> (raw)
In-Reply-To: <87zitrbz0o.fsf@hertz.schwinge.homeip.net>

On 21/03/16 17:01 +0100, Thomas Schwinge wrote:
>Hi!
>
>On Mon, 21 Mar 2016 15:01:49 +0000, Jonathan Wakely <jwakely@redhat.com> wrote:
>> On 21/03/16 13:08 +0100, Thomas Schwinge wrote:
>> >Per my (admittedly, not in-depth) reading of libstdc++-v3 source code,
>> >the _GLIBCXX_ATOMIC_BUILTINS conditional is only used in combination with
>> >the _Atomic_word data type, which in
>> >libstdc++-v3/doc/xml/manual/concurrency_extensions.xml is described as "a
>> >signed integral type" (so, matching the semantics as clarified by your
>> >patch).  That makes sense: it's used to keep reference counts, for
>> >example.  So, it seems sound to just remove the bool atomics check.
>>
>> I agree that it doesn't make any sense to check whether atomics work
>> for bool when we only care about them for _Atomic_word, however ...
>
>(Please review that it really is used only for that; I have only done a
>quick scan of the libstdc++-v3 sources.)

My own checking agreed.

>> This would change the value of _GLIBCXX_ATOMIC_BUILTINS for any target
>> which was already failing the check for bool but passing it for the
>> other types. We would now switch to using atomic builtins where we
>> previously didn't use them, which could be a problem. I don't know if
>> there are any targets that would be affected, and if it would cause an
>> actual problem.
>
>Assuming there are no other reasons that could have caused the bool
>atomics checks to fail

A target without 1-byte atomics might fail the bool checks, but pass
the int and short ones.

>(under the condition that the short and int ones
>did and still do succeed), my patch just restores the state of a few
>months ago, before Martin's bool atomics warning patch got committed.
>So, I think it is safe to commit.
>
>> Would leaving the bool check in place, but just removing the
>> __atomic_fetch_add() part be better? It should still fix the
>> regression, but is less likely to change behaviour for targets that
>> were never using the builtins.
>
>Yes, we could do that, but while I have not verified this, I assume that
>it's very unlikely that there exists a configuration where the bool
>atomics checks already used to fail but the short and int ones did and
>still do succeed.  Anyway, that's not my decision to make.  ;-)

Well I guess it's mine, and this is a fairly serious regression (is it
tracked in Bugzilla anywhere?) so the patch is OK for trunk.

  reply	other threads:[~2016-04-05 11:01 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-23  4:46 [PATCH] c/68966 - atomic_fetch_* on atomic_bool not diagnosed Martin Sebor
2016-01-02  7:43 ` Jeff Law
2016-01-04  3:03   ` Martin Sebor
2016-01-04 15:22     ` Marek Polacek
2016-01-05  1:18       ` Martin Sebor
2016-01-05 10:51         ` Marek Polacek
2016-01-05 18:47           ` Martin Sebor
2016-01-06 11:50             ` Marek Polacek
2016-01-06 23:38               ` Martin Sebor
2016-01-07  0:08                 ` Mike Stump
2016-01-07 12:07                 ` Marek Polacek
2016-01-08  1:00                   ` Martin Sebor
2016-03-21 12:35 ` [PR c/68966] Restore atomic builtins usage in libstdc++-v3 (was: [PATCH] c/68966 - atomic_fetch_* on atomic_bool not diagnosed) Thomas Schwinge
2016-03-21 15:12   ` Jonathan Wakely
2016-03-21 16:04     ` [PR c/68966] Restore atomic builtins usage in libstdc++-v3 Thomas Schwinge
2016-04-05 11:01       ` Jonathan Wakely [this message]
2016-04-05 18:08         ` Jonathan Wakely
2016-04-05 19:04           ` Jonathan Wakely

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=20160405110148.GE5814@redhat.com \
    --to=jwakely@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=joseph@codesourcery.com \
    --cc=law@redhat.com \
    --cc=libstdc++@gcc.gnu.org \
    --cc=msebor@gmail.com \
    --cc=polacek@redhat.com \
    --cc=thomas@codesourcery.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).