public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug inline-asm/68084] New: Inverted conditions generated for x86 inline assembly "flag output constraints"
@ 2015-10-25  1:25 richardpku at gmail dot com
  2015-10-25  7:52 ` [Bug inline-asm/68084] " gccbugzilla at limegreensocks dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: richardpku at gmail dot com @ 2015-10-25  1:25 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68084

            Bug ID: 68084
           Summary: Inverted conditions generated for x86 inline assembly
                    "flag output constraints"
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: inline-asm
          Assignee: unassigned at gcc dot gnu.org
          Reporter: richardpku at gmail dot com
  Target Milestone: ---

I have been trying out the new "flag output constraints" feature in inline
assembly ("=@ccCC"), and have found GCC sometimes incorrectly generates
inverted conditions in assembler code.

The minimal test case is as follows:


_Bool dec_ref(unsigned *p)
{
  _Bool r;
  asm ("cmp %2, %1" : "=@ccae"(r) : "m"(*p), "ri"(2));
  if (r)
    return __atomic_sub_fetch(p, 1, __ATOMIC_RELEASE) == 0;
  return 1;
}


GCC (6.0.0 20151024) generates the following assembler code:


dec_ref:
        cmp $2, (%rdi)
        movl    $1, %eax
        jc      .L7
        rep ret
        .p2align 4,,10
        .p2align 3
.L7:
        lock subl       $1, (%rdi)
        sete    %al
        ret


where "jc" is incorrect. It should be "jnc".

Interestingly, GCC generates the expected code if "=@ccae" is written as
"=@ccnb" (ae and nb are synonymous).


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug inline-asm/68084] Inverted conditions generated for x86 inline assembly "flag output constraints"
  2015-10-25  1:25 [Bug inline-asm/68084] New: Inverted conditions generated for x86 inline assembly "flag output constraints" richardpku at gmail dot com
@ 2015-10-25  7:52 ` gccbugzilla at limegreensocks dot com
  2015-10-25 13:12 ` ubizjak at gmail dot com
  2015-10-25 13:24 ` ubizjak at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: gccbugzilla at limegreensocks dot com @ 2015-10-25  7:52 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68084

David <gccbugzilla at limegreensocks dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gccbugzilla@limegreensocks.
                   |                            |com

--- Comment #1 from David <gccbugzilla at limegreensocks dot com> ---
Created attachment 36580
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36580&action=edit
Possible fix

As I read the code, I think the logic for 'ae' is just backwards.  Try this.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug inline-asm/68084] Inverted conditions generated for x86 inline assembly "flag output constraints"
  2015-10-25  1:25 [Bug inline-asm/68084] New: Inverted conditions generated for x86 inline assembly "flag output constraints" richardpku at gmail dot com
  2015-10-25  7:52 ` [Bug inline-asm/68084] " gccbugzilla at limegreensocks dot com
@ 2015-10-25 13:12 ` ubizjak at gmail dot com
  2015-10-25 13:24 ` ubizjak at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: ubizjak at gmail dot com @ 2015-10-25 13:12 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68084

Uroš Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2015-10-25
           Assignee|unassigned at gcc dot gnu.org      |ubizjak at gmail dot com
   Target Milestone|---                         |6.0
     Ever confirmed|0                           |1

--- Comment #2 from Uroš Bizjak <ubizjak at gmail dot com> ---
Oh, indeed.

I'll fix this in a moment.
>From gcc-bugs-return-500502-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sun Oct 25 13:21:37 2015
Return-Path: <gcc-bugs-return-500502-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 24171 invoked by alias); 25 Oct 2015 13:21:37 -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 24132 invoked by uid 55); 25 Oct 2015 13:21:33 -0000
From: "uros at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug inline-asm/68084] Inverted conditions generated for x86 inline assembly "flag output constraints"
Date: Sun, 25 Oct 2015 13:21:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: inline-asm
X-Bugzilla-Version: 6.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: uros at gcc dot gnu.org
X-Bugzilla-Status: ASSIGNED
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: ubizjak at gmail dot com
X-Bugzilla-Target-Milestone: 6.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-68084-4-N4U2eU35bD@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-68084-4@http.gcc.gnu.org/bugzilla/>
References: <bug-68084-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: 2015-10/txt/msg02057.txt.bz2
Content-length: 606

https://gcc.gnu.org/bugzilla/show_bug.cgi?idh084

--- Comment #3 from uros at gcc dot gnu.org ---
Author: uros
Date: Sun Oct 25 13:21:01 2015
New Revision: 229296

URL: https://gcc.gnu.org/viewcvs?rev"9296&root=gcc&view=rev
Log:
        PR target/68084
        * config/i386/i386.c (ix86_md_asm_adjust) [case 'a']: Use NE code
        for =@ccae.

testsuite/ChangeLog:

        PR target/68084
        * gcc.target/i386/pr68084.c: New test.


Added:
    trunk/gcc/testsuite/gcc.target/i386/pr68084.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/i386/i386.c
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug inline-asm/68084] Inverted conditions generated for x86 inline assembly "flag output constraints"
  2015-10-25  1:25 [Bug inline-asm/68084] New: Inverted conditions generated for x86 inline assembly "flag output constraints" richardpku at gmail dot com
  2015-10-25  7:52 ` [Bug inline-asm/68084] " gccbugzilla at limegreensocks dot com
  2015-10-25 13:12 ` ubizjak at gmail dot com
@ 2015-10-25 13:24 ` ubizjak at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: ubizjak at gmail dot com @ 2015-10-25 13:24 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68084

Uroš Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Uroš Bizjak <ubizjak at gmail dot com> ---
Fixed.
>From gcc-bugs-return-500504-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sun Oct 25 13:26:34 2015
Return-Path: <gcc-bugs-return-500504-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 30671 invoked by alias); 25 Oct 2015 13:26:34 -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 30644 invoked by uid 48); 25 Oct 2015 13:26:30 -0000
From: "dominiq at lps dot ens.fr" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/68078] segfault with allocate and stat for derived types with default initialization
Date: Sun, 25 Oct 2015 13:26:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: fortran
X-Bugzilla-Version: 6.0
X-Bugzilla-Keywords: wrong-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: dominiq at lps dot ens.fr
X-Bugzilla-Status: WAITING
X-Bugzilla-Resolution:
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: bug_status cf_reconfirmed_on everconfirmed
Message-ID: <bug-68078-4-2JwsLZ2RTX@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-68078-4@http.gcc.gnu.org/bugzilla/>
References: <bug-68078-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: 2015-10/txt/msg02059.txt.bz2
Content-length: 546

https://gcc.gnu.org/bugzilla/show_bug.cgi?idh078

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|2015-10-24 00:00:00         |2015-10-25
     Ever confirmed|0                           |1

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Confirmed from 4.8 up to trunk (6.0). Duplicate of pr59796?


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-10-25 13:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-25  1:25 [Bug inline-asm/68084] New: Inverted conditions generated for x86 inline assembly "flag output constraints" richardpku at gmail dot com
2015-10-25  7:52 ` [Bug inline-asm/68084] " gccbugzilla at limegreensocks dot com
2015-10-25 13:12 ` ubizjak at gmail dot com
2015-10-25 13:24 ` ubizjak at gmail dot com

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).