public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/67089] New: [4.8/4.9/5/6 Regression] Integer overflow checks not optimized on x86/x86_64
@ 2015-08-01 10:59 m.mukovnikov at gmail dot com
  2015-08-03  8:37 ` [Bug target/67089] " m.mukovnikov at gmail dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: m.mukovnikov at gmail dot com @ 2015-08-01 10:59 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 67089
           Summary: [4.8/4.9/5/6 Regression] Integer overflow checks not
                    optimized on x86/x86_64
           Product: gcc
           Version: 5.2.1
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: m.mukovnikov at gmail dot com
  Target Milestone: ---

Starting from 4.8.3, gcc does not optimize integer overflow and underflow
checks inserting a redundant cmp instruction in both 32-bit and 64-bit modes.
Having git-bisected the revisions, I found out r204088 (by pr58779) had added
such behavior.

--------------- example ---------------
extern void underflow(void) __attribute__((noreturn));
unsigned sub(unsigned a, unsigned b)
{
    unsigned r = a - b;
    if (r > a) underflow();
    return r;
}
------------ gcc-4.8.2 -O1 ------------
sub(unsigned int, unsigned int):
    movl    %edi, %eax
    subl    %esi, %eax /* CF is set on overflow */
    jae .L4            /* jae = jnb = jnc = 73h */
    subq    $8, %rsp
    call    underflow()
.L4:
    rep; ret
------------ gcc-4.8.3 -O1 ------------
sub(unsigned int, unsigned int):
    movl    %edi, %eax
    subl    %esi, %eax
    cmpl    %eax, %edi  /* absolutely redundant */
    jnb .L4
    subq    $8, %rsp
    call    underflow()
.L4:
    rep ret
---------------------------------------


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

* [Bug target/67089] [4.8/4.9/5/6 Regression] Integer overflow checks not optimized on x86/x86_64
  2015-08-01 10:59 [Bug target/67089] New: [4.8/4.9/5/6 Regression] Integer overflow checks not optimized on x86/x86_64 m.mukovnikov at gmail dot com
@ 2015-08-03  8:37 ` m.mukovnikov at gmail dot com
  2015-08-03  9:36 ` ubizjak at gmail dot com
  2015-10-16  8:26 ` [Bug target/67089] [4.9/5/6 " rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: m.mukovnikov at gmail dot com @ 2015-08-03  8:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Mike <m.mukovnikov at gmail dot com> ---
(In reply to Uroš Bizjak from comment #1)
> We shouldn't do this, and it reflected in PR58779.
But can't we improve the logic to satisfy both pr58779 and pr67089? The
absolute metric is code quality, and with all due respect, the code can be
better in this very case.
>From gcc-bugs-return-493918-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Aug 03 08:40:36 2015
Return-Path: <gcc-bugs-return-493918-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 126727 invoked by alias); 3 Aug 2015 08:40:36 -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 126251 invoked by uid 48); 3 Aug 2015 08:40:31 -0000
From: "gnugcc at marino dot st" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/58583] [c++11] ICE with invalid non-static data member initialization in template
Date: Mon, 03 Aug 2015 08:40: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: 4.9.0
X-Bugzilla-Keywords: accepts-invalid, ice-on-invalid-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: gnugcc at marino dot st
X-Bugzilla-Status: RESOLVED
X-Bugzilla-Resolution: FIXED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: nathan at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: cc
Message-ID: <bug-58583-4-ikefDiDy7k@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-58583-4@http.gcc.gnu.org/bugzilla/>
References: <bug-58583-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-08/txt/msg00060.txt.bz2
Content-length: 750

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

John Marino <gnugcc at marino dot st> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gnugcc at marino dot st

--- Comment #6 from John Marino <gnugcc at marino dot st> ---
so apparently this patch caused a lot of failures:
https://gcc.gnu.org/ml/gcc-patches/2015-06/msg01062.html

However, I don't see people complaining anymore, nor do I see it on other
testsuite result posts.

However, we're still seeing this on DragonFly:
https://gcc.gnu.org/ml/gcc-testresults/2015-08/msg00196.html

What was the final conclusion?
Is it a dejagnu problem or what?


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

* [Bug target/67089] [4.8/4.9/5/6 Regression] Integer overflow checks not optimized on x86/x86_64
  2015-08-01 10:59 [Bug target/67089] New: [4.8/4.9/5/6 Regression] Integer overflow checks not optimized on x86/x86_64 m.mukovnikov at gmail dot com
  2015-08-03  8:37 ` [Bug target/67089] " m.mukovnikov at gmail dot com
@ 2015-08-03  9:36 ` ubizjak at gmail dot com
  2015-10-16  8:26 ` [Bug target/67089] [4.9/5/6 " rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: ubizjak at gmail dot com @ 2015-08-03  9:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Mike from comment #2)
> (In reply to Uroš Bizjak from comment #1)
> > We shouldn't do this, and it reflected in PR58779.
> But can't we improve the logic to satisfy both pr58779 and pr67089? The
> absolute metric is code quality, and with all due respect, the code can be
> better in this very case.

I don't see a way. pr58779 will generate:

(set (pc)
    (if_then_else (gtu (plus:SI (reg:SI 86 [ D.1769 ])
                (const_int -1 [0xffffffffffffffff]))
            (reg:SI 86 [ D.1769 ]))
        (label_ref 22)
        (pc)))

which can be also represented as:

(set (pc)
    (if_then_else (gtu (minus:SI (reg:SI 86 [ D.1769 ])
                (const_int 1 [0x1]))
            (reg:SI 86 [ D.1769 ]))
        (label_ref 22)
        (pc)))

and before pr58779 was fixed, these two equivalent insns would result in
swapped condition, as evident from the diff:

     case GTU:                  /* CF=0 & ZF=0 */
     case LEU:                  /* CF=1 | ZF=1 */
-      /* Detect overflow checks.  They need just the carry flag.  */
-      if (GET_CODE (op0) == MINUS
-         && rtx_equal_p (op1, XEXP (op0, 0)))
-       return CCCmode;
-      else
-       return CCmode;
+      return CCmode;

and the part where GTU is emitted:

@@ -14103,8 +14103,6 @@
         Those same assemblers have the same but opposite lossage on cmov.  */
       if (mode == CCmode)
        suffix = fp ? "nbe" : "a";
-      else if (mode == CCCmode)
-       suffix = "b";
       else
        gcc_unreachable ();
       break;
>From gcc-bugs-return-493922-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Aug 03 09:47:42 2015
Return-Path: <gcc-bugs-return-493922-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 17744 invoked by alias); 3 Aug 2015 09:47:41 -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 17716 invoked by uid 48); 3 Aug 2015 09:47:38 -0000
From: "vries at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug other/67098] New: Documentation --with-stage1-ldflags does not mention default -static-libstdc++ -static-libgcc
Date: Mon, 03 Aug 2015 09:47:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: other
X-Bugzilla-Version: 6.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: trivial
X-Bugzilla-Who: vries at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
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_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone
Message-ID: <bug-67098-4@http.gcc.gnu.org/bugzilla/>
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: 2015-08/txt/msg00064.txt.bz2
Content-length: 1908

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

            Bug ID: 67098
           Summary: Documentation --with-stage1-ldflags does not mention
                    default -static-libstdc++ -static-libgcc
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: trivial
          Priority: P3
         Component: other
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

https://gcc.gnu.org/install/configure.html:
...
--with-stage1-ldflags=flags
    This option may be used to set linker flags to be used when linking stage 1
of GCC. These are also used when linking GCC if configured with
--disable-bootstrap. By default no special flags are used. 
...

But in configure we have:
...
# Linker flags to use for stage1 or when not bootstrapping.

# Check whether --with-stage1-ldflags was given.
if test "${with_stage1_ldflags+set}" = set; then :
  withval=$with_stage1_ldflags; if test "$withval" = "no" -o "$withval" =
"yes"; then
   stage1_ldflags=
 else
   stage1_ldflags=$withval
 fi
else
  stage1_ldflags=
 # In stage 1, default to linking libstdc++ and libgcc statically with GCC
 # if supported.  But if the user explicitly specified the libraries to use,
 # trust that they are doing what they want.
 if test "$stage1_libs" = "" -a "$have_static_libs" = yes; then
   stage1_ldflags="-static-libstdc++ -static-libgcc"
 fi
fi
...

So the doc should be something like:
...
--with-stage1-ldflags=flags
    This option may be used to set linker flags to be used when linking stage 1
of GCC. These are also used when linking GCC if configured with
--disable-bootstrap.  If neither –with-stage1-libs nor –with-host-libstdcxx is
set to a value, then the default is ‘-static-libstdc++ -static-libgcc’, if
supported.
...
>From gcc-bugs-return-493923-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Aug 03 09:59:23 2015
Return-Path: <gcc-bugs-return-493923-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 36109 invoked by alias); 3 Aug 2015 09:59:23 -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 33849 invoked by uid 48); 3 Aug 2015 09:59:19 -0000
From: "vries at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug other/67099] New: Documentation --with-host-libstdcxx is outdated, mentions ppl
Date: Mon, 03 Aug 2015 09:59:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: other
X-Bugzilla-Version: 6.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: trivial
X-Bugzilla-Who: vries at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
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_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone
Message-ID: <bug-67099-4@http.gcc.gnu.org/bugzilla/>
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: 2015-08/txt/msg00065.txt.bz2
Content-length: 1352

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

            Bug ID: 67099
           Summary: Documentation --with-host-libstdcxx is outdated,
                    mentions ppl
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: trivial
          Priority: P3
         Component: other
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

https://gcc.gnu.org/install/configure.html:
...
--with-host-libstdcxx=linker-args
    If you are linking with a static copy of PPL, you can use this option to
specify how the linker should find the standard C++ library used internally by
PPL. Typical values of linker-args might be ‘-lstdc++’ or
‘-Wl,-Bstatic,-lstdc++,-Bdynamic -lm’. If you are linking with a shared copy of
PPL, you probably do not need this option; shared library dependencies will
cause the linker to search for the standard C++ library automatically. 
...

PPL is not supported anymore. The only function of with-host-libstdcxx seems to
be to set other configure flags to a default. So a more accurate doc would be:
...
--with-host-libstdcxx=linker-args
Sets default value for --with-stage1-libs and --with-boot-libs. Sets default
value for --with-boot-ldflags to empty.
...
>From gcc-bugs-return-493924-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Aug 03 10:04:35 2015
Return-Path: <gcc-bugs-return-493924-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 44584 invoked by alias); 3 Aug 2015 10:04:35 -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 44470 invoked by uid 55); 3 Aug 2015 10:04:31 -0000
From: "mikael at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/64921] [4.9/5/6 Regression] FAIL: gfortran.dg/class_allocate_18.f90
Date: Mon, 03 Aug 2015 10:04: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: 5.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: mikael at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P4
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.9.4
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-64921-4-4npcdp3J39@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-64921-4@http.gcc.gnu.org/bugzilla/>
References: <bug-64921-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-08/txt/msg00066.txt.bz2
Content-length: 694

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

--- Comment #25 from Mikael Morin <mikael at gcc dot gnu.org> ---
Author: mikael
Date: Mon Aug  3 10:03:55 2015
New Revision: 226493

URL: https://gcc.gnu.org/viewcvs?rev"6493&root=gcc&view=rev
Log:
Fix random class_allocate_18.f90 failure

        PR fortran/64921
gcc/fortran/
        * class.c (generate_finalization_wrapper): Set finalization
        procedure symbol's always_explicit attribute.
gcc/testsuite/
        * gfortran.dg/class_allocate_20.f90: New.


Added:
    trunk/gcc/testsuite/gfortran.dg/class_allocate_20.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/class.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug target/67089] [4.9/5/6 Regression] Integer overflow checks not optimized on x86/x86_64
  2015-08-01 10:59 [Bug target/67089] New: [4.8/4.9/5/6 Regression] Integer overflow checks not optimized on x86/x86_64 m.mukovnikov at gmail dot com
  2015-08-03  8:37 ` [Bug target/67089] " m.mukovnikov at gmail dot com
  2015-08-03  9:36 ` ubizjak at gmail dot com
@ 2015-10-16  8:26 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-10-16  8:26 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |x86_64-*-*, i?86-*-*
           Priority|P3                          |P2
             Status|UNCONFIRMED                 |NEW
           Keywords|                            |missed-optimization
   Last reconfirmed|                            |2015-10-16
     Ever confirmed|0                           |1
            Summary|[4.8/4.9/5/6 Regression]    |[4.9/5/6 Regression]
                   |Integer overflow checks not |Integer overflow checks not
                   |optimized on x86/x86_64     |optimized on x86/x86_64
   Target Milestone|---                         |4.9.4


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

end of thread, other threads:[~2015-10-16  8:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-01 10:59 [Bug target/67089] New: [4.8/4.9/5/6 Regression] Integer overflow checks not optimized on x86/x86_64 m.mukovnikov at gmail dot com
2015-08-03  8:37 ` [Bug target/67089] " m.mukovnikov at gmail dot com
2015-08-03  9:36 ` ubizjak at gmail dot com
2015-10-16  8:26 ` [Bug target/67089] [4.9/5/6 " rguenth at gcc dot gnu.org

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