* [Bug c++/57926] Atomic functions broken with C++ but not C?
[not found] <bug-57926-4@http.gcc.gnu.org/bugzilla/>
@ 2013-07-18 15:50 ` lailavrazda1979 at gmail dot com
2013-07-18 16:06 ` redi at gcc dot gnu.org
` (15 subsequent siblings)
16 siblings, 0 replies; 17+ messages in thread
From: lailavrazda1979 at gmail dot com @ 2013-07-18 15:50 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57926
--- Comment #1 from lailavrazda1979 at gmail dot com ---
Created attachment 30523
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30523&action=edit
Code triggering the bug
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/57926] Atomic functions broken with C++ but not C?
[not found] <bug-57926-4@http.gcc.gnu.org/bugzilla/>
2013-07-18 15:50 ` [Bug c++/57926] Atomic functions broken with C++ but not C? lailavrazda1979 at gmail dot com
@ 2013-07-18 16:06 ` redi at gcc dot gnu.org
2013-07-22 10:08 ` paolo.carlini at oracle dot com
` (14 subsequent siblings)
16 siblings, 0 replies; 17+ messages in thread
From: redi at gcc dot gnu.org @ 2013-07-18 16:06 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57926
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |rejects-valid
Status|UNCONFIRMED |NEW
Last reconfirmed| |2013-07-18
Ever confirmed|0 |1
Severity|major |normal
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The test is broken, i should be the same type as Mutex. This should compile
though:
long Mutex[1];
int AcquireLogMutex(void)
{
return __atomic_exchange_n(Mutex, 1, __ATOMIC_SEQ_CST);
}
void ReleaseLogMutex(void)
{
long i = 0;
__atomic_store(Mutex, &i, __ATOMIC_SEQ_CST);
}
G++ doesn't do the array-to-pointer conversion
There's a simple workaround: just use (long*)Mutex
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/57926] Atomic functions broken with C++ but not C?
[not found] <bug-57926-4@http.gcc.gnu.org/bugzilla/>
2013-07-18 15:50 ` [Bug c++/57926] Atomic functions broken with C++ but not C? lailavrazda1979 at gmail dot com
2013-07-18 16:06 ` redi at gcc dot gnu.org
@ 2013-07-22 10:08 ` paolo.carlini at oracle dot com
2013-07-22 16:37 ` amacleod at redhat dot com
` (13 subsequent siblings)
16 siblings, 0 replies; 17+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-07-22 10:08 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57926
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |amacleod at redhat dot com
--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> ---
CC-ing Andrew for the array->pointer issue. Or is this a more general C++
front-end issue?
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/57926] Atomic functions broken with C++ but not C?
[not found] <bug-57926-4@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2013-07-22 10:08 ` paolo.carlini at oracle dot com
@ 2013-07-22 16:37 ` amacleod at redhat dot com
2013-07-22 17:22 ` paolo.carlini at oracle dot com
` (12 subsequent siblings)
16 siblings, 0 replies; 17+ messages in thread
From: amacleod at redhat dot com @ 2013-07-22 16:37 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57926
--- Comment #4 from Andrew Macleod <amacleod at redhat dot com> ---
Short answer.. I'm not a sure, but it appears to be a g++ thing.
I looks like g++ is using ARRAY_TYPE instead of POINTER_TYPE. the 4.8 branch
does the same thing, but it does seem odd to me. That means anywhere in the
compiler that uses POINTER_TYPE_P() is not going to trigger true for an array
in c++...
Going back to gcc 4.6 which only had __sync operations, the same issue exists:
<x220:/home/compilers/gcc-4_6-branch/build/gcc>cat t.cpp
long int Mutex[1];
int AcquireLogMutex(void)
{
return(__sync_fetch_and_add(Mutex, 1));
}
int main() {}
<x220:/home/compilers/gcc-4_6-branch/build/gcc>./cc1plus t.cpp
int AcquireLogMutex()
t.cpp:5:38: error: incompatible type for argument 1 of ‘__sync_fetch_and_add’
Im stunned this has never been tripped over.
I can fix it in the atomic code, but I don't know what that means to other
languages since I've never paid attention to the detailed meaning of ARRAY_TYPE
vs POINTER_TYPE. Just allowing the ARRAY_TYPE objects to pass the existing
atomic tests of POINTER_TYPE_P or POINTER_TYPE appears to generate all the
correct code and errors for atomics, so I guess thats is the way to go...?
there are only a couple of places the check is made.
>From gcc-bugs-return-426519-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Jul 22 16:42:44 2013
Return-Path: <gcc-bugs-return-426519-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 24340 invoked by alias); 22 Jul 2013 16:42:44 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 22024 invoked by uid 48); 22 Jul 2013 16:40:42 -0000
From: "pchang9 at cs dot wisc.edu" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/57811] Wasted work in find_reloads()
Date: Mon, 22 Jul 2013 16:42:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: middle-end
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: pchang9 at cs dot wisc.edu
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-57811-4-iMGg4dYjBy@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-57811-4@http.gcc.gnu.org/bugzilla/>
References: <bug-57811-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-07/txt/msg01026.txt.bz2
Content-length: 203
http://gcc.gnu.org/bugzilla/show_bug.cgi?idW811
--- Comment #4 from Po-Chun Chang <pchang9 at cs dot wisc.edu> ---
Patch sent to gcc-patches@
http://gcc.gnu.org/ml/gcc-patches/2013-07/msg00930.html
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/57926] Atomic functions broken with C++ but not C?
[not found] <bug-57926-4@http.gcc.gnu.org/bugzilla/>
` (3 preceding siblings ...)
2013-07-22 16:37 ` amacleod at redhat dot com
@ 2013-07-22 17:22 ` paolo.carlini at oracle dot com
2013-07-22 20:15 ` amacleod at redhat dot com
` (11 subsequent siblings)
16 siblings, 0 replies; 17+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-07-22 17:22 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57926
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu.org
--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Thanks a lot Andrew. I think it makes sense to CC Jason.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/57926] Atomic functions broken with C++ but not C?
[not found] <bug-57926-4@http.gcc.gnu.org/bugzilla/>
` (4 preceding siblings ...)
2013-07-22 17:22 ` paolo.carlini at oracle dot com
@ 2013-07-22 20:15 ` amacleod at redhat dot com
2013-07-23 2:35 ` amacleod at redhat dot com
` (10 subsequent siblings)
16 siblings, 0 replies; 17+ messages in thread
From: amacleod at redhat dot com @ 2013-07-22 20:15 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57926
Andrew Macleod <amacleod at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |amacleod at redhat dot com
--- Comment #6 from Andrew Macleod <amacleod at redhat dot com> ---
Created attachment 30535
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30535&action=edit
should fix bug
So this would appear to fix the problem by allowing ARRAY_TYPE as well as
POINTER_TYPE to appear where the atomic pointer is required.
I haven't bootstrapped it or anything yet, but assuming that ARRAY_TYPE from
the g++ front-end means the same as POINTER_TYPE in this context, this would be
the solution and I'll proceed with a test case and proper bootstrap/submission.
You can try it if you want :-) I tried a few different contexts and got the
behaviour I expected in each case.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/57926] Atomic functions broken with C++ but not C?
[not found] <bug-57926-4@http.gcc.gnu.org/bugzilla/>
` (5 preceding siblings ...)
2013-07-22 20:15 ` amacleod at redhat dot com
@ 2013-07-23 2:35 ` amacleod at redhat dot com
2013-07-23 19:08 ` amacleod at redhat dot com
` (9 subsequent siblings)
16 siblings, 0 replies; 17+ messages in thread
From: amacleod at redhat dot com @ 2013-07-23 2:35 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57926
--- Comment #7 from Andrew Macleod <amacleod at redhat dot com> ---
btw, that patch passes bootstrap and a new testcase based on a modified version
of the bug report test.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/57926] Atomic functions broken with C++ but not C?
[not found] <bug-57926-4@http.gcc.gnu.org/bugzilla/>
` (6 preceding siblings ...)
2013-07-23 2:35 ` amacleod at redhat dot com
@ 2013-07-23 19:08 ` amacleod at redhat dot com
2014-01-19 9:24 ` lailavrazda1979 at gmail dot com
` (8 subsequent siblings)
16 siblings, 0 replies; 17+ messages in thread
From: amacleod at redhat dot com @ 2013-07-23 19:08 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57926
Andrew Macleod <amacleod at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rth at gcc dot gnu.org
--- Comment #9 from Andrew Macleod <amacleod at redhat dot com> ---
I don't know either.. that parameter checking stuff is all inherited from the
original __sync code.
resolve_overloaded_builtin() is called avery early and it takes care of
everything, telling the call handling code to not do anything else.
In C it would have to call array_to_pointer_conversion() for arrays, and
decay_conversion for c++.. ugg. that means it needs to be done *before* the
overloaded resolution. Thats pretty ugly.
Im going to copy rth since he wrote this code originally. Maybe he knows the
easy shortcut :-)
Andrew
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/57926] Atomic functions broken with C++ but not C?
[not found] <bug-57926-4@http.gcc.gnu.org/bugzilla/>
` (7 preceding siblings ...)
2013-07-23 19:08 ` amacleod at redhat dot com
@ 2014-01-19 9:24 ` lailavrazda1979 at gmail dot com
2014-04-06 9:04 ` lailavrazda1979 at gmail dot com
` (7 subsequent siblings)
16 siblings, 0 replies; 17+ messages in thread
From: lailavrazda1979 at gmail dot com @ 2014-01-19 9:24 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57926
--- Comment #11 from lailavrazda1979 at gmail dot com ---
I don't mean to be a bother, but this hasn't been updated in a while. Has it
been fixed?
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/57926] Atomic functions broken with C++ but not C?
[not found] <bug-57926-4@http.gcc.gnu.org/bugzilla/>
` (8 preceding siblings ...)
2014-01-19 9:24 ` lailavrazda1979 at gmail dot com
@ 2014-04-06 9:04 ` lailavrazda1979 at gmail dot com
2014-04-07 16:55 ` jason at gcc dot gnu.org
` (6 subsequent siblings)
16 siblings, 0 replies; 17+ messages in thread
From: lailavrazda1979 at gmail dot com @ 2014-04-06 9:04 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57926
--- Comment #12 from lailavrazda1979 at gmail dot com ---
Bug still a problem with latest trunk.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/57926] Atomic functions broken with C++ but not C?
[not found] <bug-57926-4@http.gcc.gnu.org/bugzilla/>
` (9 preceding siblings ...)
2014-04-06 9:04 ` lailavrazda1979 at gmail dot com
@ 2014-04-07 16:55 ` jason at gcc dot gnu.org
2014-04-09 18:22 ` jason at gcc dot gnu.org
` (5 subsequent siblings)
16 siblings, 0 replies; 17+ messages in thread
From: jason at gcc dot gnu.org @ 2014-04-07 16:55 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57926
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|amacleod at redhat dot com |jason at gcc dot gnu.org
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/57926] Atomic functions broken with C++ but not C?
[not found] <bug-57926-4@http.gcc.gnu.org/bugzilla/>
` (10 preceding siblings ...)
2014-04-07 16:55 ` jason at gcc dot gnu.org
@ 2014-04-09 18:22 ` jason at gcc dot gnu.org
2014-04-09 23:58 ` lailavrazda1979 at gmail dot com
` (4 subsequent siblings)
16 siblings, 0 replies; 17+ messages in thread
From: jason at gcc dot gnu.org @ 2014-04-09 18:22 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57926
--- Comment #13 from Jason Merrill <jason at gcc dot gnu.org> ---
Created attachment 32575
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32575&action=edit
patch
This patch forces the decay for C++. We don't need to do anything for C, since
arrays decay immediately when named in the C front end. I think I'm inclined
to wait until after 4.9 to check this in.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/57926] Atomic functions broken with C++ but not C?
[not found] <bug-57926-4@http.gcc.gnu.org/bugzilla/>
` (11 preceding siblings ...)
2014-04-09 18:22 ` jason at gcc dot gnu.org
@ 2014-04-09 23:58 ` lailavrazda1979 at gmail dot com
2014-04-10 12:17 ` jason at gcc dot gnu.org
` (3 subsequent siblings)
16 siblings, 0 replies; 17+ messages in thread
From: lailavrazda1979 at gmail dot com @ 2014-04-09 23:58 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57926
--- Comment #14 from lailavrazda1979 at gmail dot com ---
Why wait? I'm not hugely opposed, but bugfixes are bugfixes, and one more fixed
bug makes a better 4.9 release, right?
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/57926] Atomic functions broken with C++ but not C?
[not found] <bug-57926-4@http.gcc.gnu.org/bugzilla/>
` (12 preceding siblings ...)
2014-04-09 23:58 ` lailavrazda1979 at gmail dot com
@ 2014-04-10 12:17 ` jason at gcc dot gnu.org
2014-04-10 22:40 ` lailavrazda1979 at gmail dot com
` (2 subsequent siblings)
16 siblings, 0 replies; 17+ messages in thread
From: jason at gcc dot gnu.org @ 2014-04-10 12:17 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57926
--- Comment #15 from Jason Merrill <jason at gcc dot gnu.org> ---
(In reply to lailavrazda1979 from comment #14)
> Why wait? I'm not hugely opposed, but bugfixes are bugfixes, and one more
> fixed bug makes a better 4.9 release, right?
Because all changes risk introducing new bugs, and we're very close to 4.9 now.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/57926] Atomic functions broken with C++ but not C?
[not found] <bug-57926-4@http.gcc.gnu.org/bugzilla/>
` (13 preceding siblings ...)
2014-04-10 12:17 ` jason at gcc dot gnu.org
@ 2014-04-10 22:40 ` lailavrazda1979 at gmail dot com
2014-04-11 18:25 ` jason at gcc dot gnu.org
2014-04-15 0:46 ` lailavrazda1979 at gmail dot com
16 siblings, 0 replies; 17+ messages in thread
From: lailavrazda1979 at gmail dot com @ 2014-04-10 22:40 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57926
--- Comment #16 from lailavrazda1979 at gmail dot com ---
Okay, no worries.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/57926] Atomic functions broken with C++ but not C?
[not found] <bug-57926-4@http.gcc.gnu.org/bugzilla/>
` (14 preceding siblings ...)
2014-04-10 22:40 ` lailavrazda1979 at gmail dot com
@ 2014-04-11 18:25 ` jason at gcc dot gnu.org
2014-04-15 0:46 ` lailavrazda1979 at gmail dot com
16 siblings, 0 replies; 17+ messages in thread
From: jason at gcc dot gnu.org @ 2014-04-11 18:25 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57926
--- Comment #17 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Fri Apr 11 18:25:13 2014
New Revision: 209316
URL: http://gcc.gnu.org/viewcvs?rev=209316&root=gcc&view=rev
Log:
PR c++/57926
* c-common.c (sync_resolve_size, get_atomic_generic_size): Call
default_conversion for an array argument.
Added:
trunk/gcc/testsuite/g++.dg/ext/atomic-2.C
Modified:
trunk/gcc/c-family/ChangeLog
trunk/gcc/c-family/c-common.c
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/57926] Atomic functions broken with C++ but not C?
[not found] <bug-57926-4@http.gcc.gnu.org/bugzilla/>
` (15 preceding siblings ...)
2014-04-11 18:25 ` jason at gcc dot gnu.org
@ 2014-04-15 0:46 ` lailavrazda1979 at gmail dot com
16 siblings, 0 replies; 17+ messages in thread
From: lailavrazda1979 at gmail dot com @ 2014-04-15 0:46 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57926
lailavrazda1979 at gmail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #18 from lailavrazda1979 at gmail dot com ---
Patch is checked in, so I'm closing this.
^ permalink raw reply [flat|nested] 17+ messages in thread