From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16405 invoked by alias); 22 Jul 2013 16:37:26 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 13387 invoked by uid 48); 22 Jul 2013 16:35:24 -0000 From: "amacleod at redhat dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/57926] Atomic functions broken with C++ but not C? Date: Mon, 22 Jul 2013 16:37:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: unknown X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: amacleod at redhat dot com X-Bugzilla-Status: NEW 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: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-07/txt/msg01025.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D57926 --- Comment #4 from Andrew Macleod --- 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 bran= ch 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 arr= ay in c++... Going back to gcc 4.6 which only had __sync operations, the same issue exis= ts: cat t.cpp long int Mutex[1]; int AcquireLogMutex(void) { return(__sync_fetch_and_add(Mutex, 1)); } int main() {} ./cc1plus t.cpp int AcquireLogMutex() t.cpp:5:38: error: incompatible type for argument 1 of =E2=80=98__sync_fetc= h_and_add=E2=80=99 Im stunned this has never been tripped over.=20 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...?= =20=20=20 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: 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: List-Archive: List-Post: List-Help: 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" 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: In-Reply-To: References: 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?id=57811 --- Comment #4 from Po-Chun Chang --- Patch sent to gcc-patches@ http://gcc.gnu.org/ml/gcc-patches/2013-07/msg00930.html