public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/64255] New: failures with -O2 optimization on i >= 0 ? (unsigned long) i : - (unsigned long) i
@ 2014-12-10 15:31 vincent-gcc at vinc17 dot net
  2014-12-10 15:38 ` [Bug c/64255] " mpolacek at gcc dot gnu.org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: vincent-gcc at vinc17 dot net @ 2014-12-10 15:31 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 64255
           Summary: failures with -O2 optimization on i >= 0 ? (unsigned
                    long) i : - (unsigned long) i
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vincent-gcc at vinc17 dot net

I get failures when building and testing MPFR with:

gcc (Debian 20141209-1) 5.0.0 20141209 (experimental) [trunk revision 218514]

on x86_64, using:

./configure --enable-assert=full CC=gcc-snapshot 'CFLAGS=-Wall -O2 -g'

Using -O1 only makes the problems disappear.

If I simplify the MPFR code to:

int
mpfr_set_si_2exp (mpfr_ptr x, long i, mpfr_exp_t e, mpfr_rnd_t rnd_mode)
{
  if (i == 0)
    {
      return 0;
    }
  else
    {
      unsigned long ai;

      ai = i >= 0 ? (unsigned long) i : - (unsigned long) i;
      if ((i >= 0 ? (unsigned long) i : - (unsigned long) i) != ai)
        printf ("Error!\n");
      printf ("i = %ld\n", i);
      printf ("ai = %lX\n", ai);
      return 0;
    }
}

in set_si_2exp.c, and call:

  mpfr_set_si_2exp (x, 1, 0, 0);

I get:

i = 1
ai = FFFFFFFFFFFFFFFF

If I remove the

      if ((i >= 0 ? (unsigned long) i : - (unsigned long) i) != ai)
        printf ("Error!\n");

test, I get:

i = 1
ai = 1

as expected.

I don't know why, but I didn't manage to get a standalone testcase.


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

* [Bug c/64255] failures with -O2 optimization on i >= 0 ? (unsigned long) i : - (unsigned long) i
  2014-12-10 15:31 [Bug c/64255] New: failures with -O2 optimization on i >= 0 ? (unsigned long) i : - (unsigned long) i vincent-gcc at vinc17 dot net
@ 2014-12-10 15:38 ` mpolacek at gcc dot gnu.org
  2014-12-10 16:51 ` vincent-gcc at vinc17 dot net
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-12-10 15:38 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2014-12-10
                 CC|                            |mpolacek at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Without the standalone test case we can't do much, unfortunately.  Would you
have at least the preprocessed source?


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

* [Bug c/64255] failures with -O2 optimization on i >= 0 ? (unsigned long) i : - (unsigned long) i
  2014-12-10 15:31 [Bug c/64255] New: failures with -O2 optimization on i >= 0 ? (unsigned long) i : - (unsigned long) i vincent-gcc at vinc17 dot net
  2014-12-10 15:38 ` [Bug c/64255] " mpolacek at gcc dot gnu.org
@ 2014-12-10 16:51 ` vincent-gcc at vinc17 dot net
  2014-12-10 16:54 ` vincent-gcc at vinc17 dot net
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: vincent-gcc at vinc17 dot net @ 2014-12-10 16:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Vincent Lefèvre <vincent-gcc at vinc17 dot net> ---
Created attachment 34242
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34242&action=edit
testcase part 1 (tst1.c)
>From gcc-bugs-return-470145-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Dec 10 16:52:11 2014
Return-Path: <gcc-bugs-return-470145-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 11300 invoked by alias); 10 Dec 2014 16:52:11 -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 11272 invoked by uid 48); 10 Dec 2014 16:52:08 -0000
From: "vincent-gcc at vinc17 dot net" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/64255] failures with -O2 optimization on i >= 0 ? (unsigned long) i : - (unsigned long) i
Date: Wed, 10 Dec 2014 16:52: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: 5.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: major
X-Bugzilla-Who: vincent-gcc at vinc17 dot net
X-Bugzilla-Status: WAITING
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: attachments.created
Message-ID: <bug-64255-4-tHXLzgR7MX@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-64255-4@http.gcc.gnu.org/bugzilla/>
References: <bug-64255-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: 2014-12/txt/msg01152.txt.bz2
Content-length: 256

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

--- Comment #3 from Vincent Lefèvre <vincent-gcc at vinc17 dot net> ---
Created attachment 34243
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34243&action=edit
testcase part 2 (tst2.c)
>From gcc-bugs-return-470146-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Dec 10 16:53:09 2014
Return-Path: <gcc-bugs-return-470146-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 13759 invoked by alias); 10 Dec 2014 16:53:08 -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 13694 invoked by uid 55); 10 Dec 2014 16:53:03 -0000
From: "wschmidt at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/64225] [4.8/4.9 Regression] -funsafe-math-optimizations generates call to pow where multiply instruction would do
Date: Wed, 10 Dec 2014 16:53: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.2
X-Bugzilla-Keywords: missed-optimization
X-Bugzilla-Severity: normal
X-Bugzilla-Who: wschmidt at gcc dot gnu.org
X-Bugzilla-Status: ASSIGNED
X-Bugzilla-Priority: P2
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.8.4
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-64225-4-mnemhE4MJ1@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-64225-4@http.gcc.gnu.org/bugzilla/>
References: <bug-64225-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: 2014-12/txt/msg01153.txt.bz2
Content-length: 658

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

--- Comment #15 from Bill Schmidt <wschmidt at gcc dot gnu.org> ---
Author: wschmidt
Date: Wed Dec 10 16:52:29 2014
New Revision: 218586

URL: https://gcc.gnu.org/viewcvs?rev!8586&root=gcc&view=rev
Log:
2014-12-10  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

    Backport from mainline:
    2014-12-09  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

    PR middle-end/64225
    * tree-ssa-reassoc.c (acceptable_pow_call): Disable transformation
    for BUILT_IN_POW when flag_errno_math is present.


Modified:
    branches/gcc-4_9-branch/gcc/ChangeLog
    branches/gcc-4_9-branch/gcc/tree-ssa-reassoc.c


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

* [Bug c/64255] failures with -O2 optimization on i >= 0 ? (unsigned long) i : - (unsigned long) i
  2014-12-10 15:31 [Bug c/64255] New: failures with -O2 optimization on i >= 0 ? (unsigned long) i : - (unsigned long) i vincent-gcc at vinc17 dot net
  2014-12-10 15:38 ` [Bug c/64255] " mpolacek at gcc dot gnu.org
  2014-12-10 16:51 ` vincent-gcc at vinc17 dot net
@ 2014-12-10 16:54 ` vincent-gcc at vinc17 dot net
  2014-12-10 17:29 ` [Bug c/64255] [5 Regression] " trippels at gcc dot gnu.org
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: vincent-gcc at vinc17 dot net @ 2014-12-10 16:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Vincent Lefèvre <vincent-gcc at vinc17 dot net> ---
(In reply to Marek Polacek from comment #1)
> Without the standalone test case we can't do much, unfortunately.  Would you
> have at least the preprocessed source?

It was actually a standalone test case, but one needs separate compilation to
run it:

$ gcc-snapshot -Wall -Wextra -O2 -c tst1.c
$ gcc-snapshot -Wall -Wextra -O2 -c tst2.c
$ gcc-snapshot tst1.o tst2.o -o tst
$ ./tst
i = 1
ai = FFFFFFFFFFFFFFFF
>From gcc-bugs-return-470148-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Dec 10 16:54:01 2014
Return-Path: <gcc-bugs-return-470148-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 14742 invoked by alias); 10 Dec 2014 16:54:01 -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 14633 invoked by uid 48); 10 Dec 2014 16:53:55 -0000
From: "dominiq at lps dot ens.fr" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/64210] [5 Regression] FAIL: gcc.target/i386/avx512vl-(vmovdqa64|vpbroadcastd)-1.c  ... with -fpic
Date: Wed, 10 Dec 2014 16:54:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: target
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: dominiq at lps dot ens.fr
X-Bugzilla-Status: ASSIGNED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: jakub at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 5.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-64210-4-8ltTCO5Xgd@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-64210-4@http.gcc.gnu.org/bugzilla/>
References: <bug-64210-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: 2014-12/txt/msg01155.txt.bz2
Content-length: 5165

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

--- Comment #2 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> Created attachment 34241 [details]
> gcc5-pr64210.patch
>
> Untested fix.

Works for me! Thanks. With the patch, using make -k check-gcc
RUNTESTFLAGS="i386.exp --target_board=unix'{-m32,-m64}'" I get

        === gcc tests ==
Schedule of variations:
    unix/-m32
    unix/-m64

Running target unix/-m32
Using /sw64/share/dejagnu/baseboards/unix.exp as board description file for
target.
Using /sw64/share/dejagnu/config/unix.exp as generic interface file for target.
Using /opt/gcc/work/gcc/testsuite/config/default.exp as
tool-and-target-specific interface file.
Running /opt/gcc/work/gcc/testsuite/gcc.target/i386/i386.exp ...
FAIL: gcc.target/i386/avx512bw-vpbroadcastb-1.c (internal compiler error)
FAIL: gcc.target/i386/avx512bw-vpbroadcastb-1.c (test for excess errors)
FAIL: gcc.target/i386/avx512bw-vpbroadcastb-1.c scan-assembler-times
vpbroadcastb[ \\t]+[^{\n]*%zmm[0-9]+(?:\n|[ \\t]+#) 2
FAIL: gcc.target/i386/avx512bw-vpbroadcastb-1.c scan-assembler-times
vpbroadcastb[ \\t]+[^{\n]*%zmm[0-9]+{%k[1-7]}(?:\n|[ \\t]+#) 2
FAIL: gcc.target/i386/avx512bw-vpbroadcastb-1.c scan-assembler-times
vpbroadcastb[ \\t]+[^{\n]*%zmm[0-9]+{%k[1-7]}{z}(?:\n|[ \\t]+#) 2
FAIL: gcc.target/i386/avx512bw-vpbroadcastb-1.c scan-assembler-times
vpbroadcastb[ \\t]+[^{\n]*%ymm[0-9]+{%k[1-7]}(?:\n|[ \\t]+#) 2
FAIL: gcc.target/i386/avx512bw-vpbroadcastb-1.c scan-assembler-times
vpbroadcastb[ \\t]+[^{\n]*%ymm[0-9]+{%k[1-7]}{z}(?:\n|[ \\t]+#) 2
FAIL: gcc.target/i386/avx512bw-vpbroadcastb-1.c scan-assembler-times
vpbroadcastb[ \\t]+[^{\n]*%xmm[0-9]+{%k[1-7]}(?:\n|[ \\t]+#) 2
FAIL: gcc.target/i386/avx512bw-vpbroadcastb-1.c scan-assembler-times
vpbroadcastb[ \\t]+[^{\n]*%xmm[0-9]+{%k[1-7]}{z}(?:\n|[ \\t]+#) 2
FAIL: gcc.target/i386/avx512bw-vpbroadcastw-1.c (internal compiler error)
FAIL: gcc.target/i386/avx512bw-vpbroadcastw-1.c (test for excess errors)
FAIL: gcc.target/i386/avx512bw-vpbroadcastw-1.c scan-assembler-times
vpbroadcastw[ \\t]+[^{\n]*%zmm[0-9]+(?:\n|[ \\t]+#) 2
FAIL: gcc.target/i386/avx512bw-vpbroadcastw-1.c scan-assembler-times
vpbroadcastw[ \\t]+[^{\n]*%zmm[0-9]+{%k[1-7]}(?:\n|[ \\t]+#) 2
FAIL: gcc.target/i386/avx512bw-vpbroadcastw-1.c scan-assembler-times
vpbroadcastw[ \\t]+[^{\n]*%zmm[0-9]+{%k[1-7]}{z}(?:\n|[ \\t]+#) 2
FAIL: gcc.target/i386/avx512bw-vpbroadcastw-1.c scan-assembler-times
vpbroadcastw[ \\t]+[^{\n]*%ymm[0-9]+{%k[1-7]}(?:\n|[ \\t]+#) 2
FAIL: gcc.target/i386/avx512bw-vpbroadcastw-1.c scan-assembler-times
vpbroadcastw[ \\t]+[^{\n]*%ymm[0-9]+{%k[1-7]}{z}(?:\n|[ \\t]+#) 2
FAIL: gcc.target/i386/avx512bw-vpbroadcastw-1.c scan-assembler-times
vpbroadcastw[ \\t]+[^{\n]*%xmm[0-9]+{%k[1-7]}(?:\n|[ \\t]+#) 2
FAIL: gcc.target/i386/avx512bw-vpbroadcastw-1.c scan-assembler-times
vpbroadcastw[ \\t]+[^{\n]*%xmm[0-9]+{%k[1-7]}{z}(?:\n|[ \\t]+#) 2
FAIL: gcc.target/i386/avx512f-gather-5.c scan-assembler-times
gather[^\n]*zmm[0-9]{%k[1-7]}(?:\n|[ \\t]+#) 2
FAIL: gcc.target/i386/avx512f-kandnw-1.c scan-assembler-times kandnw[
\\t]+[^{\n]*%k[0-7](?:\n|[ \\t]+#) 1
FAIL: gcc.target/i386/fuse-caller-save-rec.c scan-assembler-not push
FAIL: gcc.target/i386/fuse-caller-save-rec.c scan-assembler-not pop
FAIL: gcc.target/i386/fuse-caller-save-rec.c scan-assembler-times
addl\t%[re]?dx, %[re]?ax 1
FAIL: gcc.target/i386/fuse-caller-save-xmm.c scan-assembler-times addpd\t%xmm1,
%xmm0 1
FAIL: gcc.target/i386/fuse-caller-save-xmm.c scan-assembler-times
movapd\t%xmm0, %xmm1 1
FAIL: gcc.target/i386/fuse-caller-save.c scan-assembler-not push
FAIL: gcc.target/i386/fuse-caller-save.c scan-assembler-not pop
FAIL: gcc.target/i386/fuse-caller-save.c scan-assembler-times
addl\t%[re]?d[ix], %[re]?ax 1
FAIL: gcc.target/i386/pr49095.c scan-assembler-not test[lq]

        === gcc Summary for unix/-m32 ==
# of expected passes        8140
# of unexpected failures    29
# of expected failures        4
# of unsupported tests        2051
Running target unix/-m64
Using /sw64/share/dejagnu/baseboards/unix.exp as board description file for
target.
Using /sw64/share/dejagnu/config/unix.exp as generic interface file for target.
Using /opt/gcc/work/gcc/testsuite/config/default.exp as
tool-and-target-specific interface file.
Running /opt/gcc/work/gcc/testsuite/gcc.target/i386/i386.exp ...
FAIL: gcc.target/i386/pr49866.c (test for excess errors)
FAIL: gcc.target/i386/pr61599-1.c (test for excess errors)
FAIL: gcc.target/i386/pr63538.c scan-assembler movabs

        === gcc Summary for unix/-m64 ==
# of expected passes        8346
# of unexpected failures    3
# of expected failures        4
# of unresolved testcases    1
# of unsupported tests        2030

        === gcc Summary ==
# of expected passes        16486
# of unexpected failures    32
# of expected failures        8
# of unresolved testcases    1
# of unsupported tests        4081
/opt/gcc/build_w/gcc/xgcc  version 5.0.0 20141210 (experimental) [trunk
revision 218584p27] (GCC)

The first failing tests are pr64254 and the fuse-caller-save* failing tests are
due to r216154 (see pr63534 comment 69: yes I know a should open a new PR for
them).


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

* [Bug c/64255] [5 Regression] failures with -O2 optimization on i >= 0 ? (unsigned long) i : - (unsigned long) i
  2014-12-10 15:31 [Bug c/64255] New: failures with -O2 optimization on i >= 0 ? (unsigned long) i : - (unsigned long) i vincent-gcc at vinc17 dot net
                   ` (2 preceding siblings ...)
  2014-12-10 16:54 ` vincent-gcc at vinc17 dot net
@ 2014-12-10 17:29 ` trippels at gcc dot gnu.org
  2014-12-10 17:37 ` mpolacek at gcc dot gnu.org
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: trippels at gcc dot gnu.org @ 2014-12-10 17:29 UTC (permalink / raw)
  To: gcc-bugs

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

Markus Trippelsdorf <trippels at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
             Status|WAITING                     |NEW
                 CC|                            |trippels at gcc dot gnu.org
   Target Milestone|---                         |5.0
            Summary|failures with -O2           |[5 Regression] failures
                   |optimization on i >= 0 ?    |with -O2 optimization on i
                   |(unsigned long) i : -       |>= 0 ? (unsigned long) i :
                   |(unsigned long) i           |- (unsigned long) i
           Severity|major                       |normal

--- Comment #5 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
Confirmed. Testcase can be combined to one file:

markus@x4 tmp % cat test.c
#include <stdio.h>

__attribute__((noinline))
int f (long i)
{
  if (i == 0)
    {
      return 0;
    }
  else
    {
      unsigned long ai;

      ai = i >= 0 ? (unsigned long) i : - (unsigned long) i;
      if ((i >= 0 ? (unsigned long) i : - (unsigned long) i) != ai)
        printf ("Error!\n");
      printf ("i = %ld\n", i);
      printf ("ai = %lX\n", ai);
      return 0;
    }
}
int main (void)
{
  f (1);
  return 0;
}


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

* [Bug c/64255] [5 Regression] failures with -O2 optimization on i >= 0 ? (unsigned long) i : - (unsigned long) i
  2014-12-10 15:31 [Bug c/64255] New: failures with -O2 optimization on i >= 0 ? (unsigned long) i : - (unsigned long) i vincent-gcc at vinc17 dot net
                   ` (3 preceding siblings ...)
  2014-12-10 17:29 ` [Bug c/64255] [5 Regression] " trippels at gcc dot gnu.org
@ 2014-12-10 17:37 ` mpolacek at gcc dot gnu.org
  2014-12-10 17:44 ` mpolacek at gcc dot gnu.org
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-12-10 17:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
A better version:

void __attribute__ ((noinline, noclone))
bar (long int i)
{
  asm ("");
}

int __attribute__ ((noinline, noclone))
f (long i)
{
  if (i == 0)
    return 0;
  else
    {
      unsigned long ai = i >= 0 ? (unsigned long) i : -(unsigned long) i;
      if ((i >= 0 ? (unsigned long) i : -(unsigned long) i) != ai)
        bar (0);
      bar (i);
      return ai;
    }
}

int
main (void)
{
  if (f (1) != 1)
    __builtin_abort ();
}


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

* [Bug c/64255] [5 Regression] failures with -O2 optimization on i >= 0 ? (unsigned long) i : - (unsigned long) i
  2014-12-10 15:31 [Bug c/64255] New: failures with -O2 optimization on i >= 0 ? (unsigned long) i : - (unsigned long) i vincent-gcc at vinc17 dot net
                   ` (4 preceding siblings ...)
  2014-12-10 17:37 ` mpolacek at gcc dot gnu.org
@ 2014-12-10 17:44 ` mpolacek at gcc dot gnu.org
  2014-12-10 17:45 ` jakub at gcc dot gnu.org
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-12-10 17:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
-fno-if-conversion seems to help.


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

* [Bug c/64255] [5 Regression] failures with -O2 optimization on i >= 0 ? (unsigned long) i : - (unsigned long) i
  2014-12-10 15:31 [Bug c/64255] New: failures with -O2 optimization on i >= 0 ? (unsigned long) i : - (unsigned long) i vincent-gcc at vinc17 dot net
                   ` (5 preceding siblings ...)
  2014-12-10 17:44 ` mpolacek at gcc dot gnu.org
@ 2014-12-10 17:45 ` jakub at gcc dot gnu.org
  2014-12-10 17:46 ` [Bug rtl-optimization/64255] " pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-12-10 17:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I had:
__attribute__((noinline, noclone))
void
bar (long i, unsigned long j)
{
  if (i != 1 || j != 1)
    __builtin_abort ();
}

__attribute__((noinline, noclone))
void
foo (long i)
{
  unsigned long j;

  if (!i)
    return;
  j = i >= 0 ? (unsigned long) i : - (unsigned long) i;
  if ((i >= 0 ? (unsigned long) i : - (unsigned long) i) != j)
    __builtin_abort ();
  bar (i, j);
}

int
main ()
{
  foo (1);
  return 0;
}

In any case, regressed with r217646, works with -O0/-O1, or -O2 -m32, fails
with -O2 (on x86_64-linux).


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

* [Bug rtl-optimization/64255] [5 Regression] failures with -O2 optimization on i >= 0 ? (unsigned long) i : - (unsigned long) i
  2014-12-10 15:31 [Bug c/64255] New: failures with -O2 optimization on i >= 0 ? (unsigned long) i : - (unsigned long) i vincent-gcc at vinc17 dot net
                   ` (6 preceding siblings ...)
  2014-12-10 17:45 ` jakub at gcc dot gnu.org
@ 2014-12-10 17:46 ` pinskia at gcc dot gnu.org
  2014-12-10 18:04 ` trippels at gcc dot gnu.org
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-12-10 17:46 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c                           |rtl-optimization

--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Marek Polacek from comment #7)
> -fno-if-conversion seems to help.

Then this is most likely a Dup of another bug which has a few version of a
patch posted now.


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

* [Bug rtl-optimization/64255] [5 Regression] failures with -O2 optimization on i >= 0 ? (unsigned long) i : - (unsigned long) i
  2014-12-10 15:31 [Bug c/64255] New: failures with -O2 optimization on i >= 0 ? (unsigned long) i : - (unsigned long) i vincent-gcc at vinc17 dot net
                   ` (7 preceding siblings ...)
  2014-12-10 17:46 ` [Bug rtl-optimization/64255] " pinskia at gcc dot gnu.org
@ 2014-12-10 18:04 ` trippels at gcc dot gnu.org
  2014-12-10 18:15 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: trippels at gcc dot gnu.org @ 2014-12-10 18:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #9)
> (In reply to Marek Polacek from comment #7)
> > -fno-if-conversion seems to help.
> 
> Then this is most likely a Dup of another bug which has a few version of a
> patch posted now.

PR63917?


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

* [Bug rtl-optimization/64255] [5 Regression] failures with -O2 optimization on i >= 0 ? (unsigned long) i : - (unsigned long) i
  2014-12-10 15:31 [Bug c/64255] New: failures with -O2 optimization on i >= 0 ? (unsigned long) i : - (unsigned long) i vincent-gcc at vinc17 dot net
                   ` (8 preceding siblings ...)
  2014-12-10 18:04 ` trippels at gcc dot gnu.org
@ 2014-12-10 18:15 ` pinskia at gcc dot gnu.org
  2014-12-11 10:28 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-12-10 18:15 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Depends on|                            |63917

--- Comment #11 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Markus Trippelsdorf from comment #10)
> > Then this is most likely a Dup of another bug which has a few version of a
> > patch posted now.
> 
> PR63917?
yes.


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

* [Bug rtl-optimization/64255] [5 Regression] failures with -O2 optimization on i >= 0 ? (unsigned long) i : - (unsigned long) i
  2014-12-10 15:31 [Bug c/64255] New: failures with -O2 optimization on i >= 0 ? (unsigned long) i : - (unsigned long) i vincent-gcc at vinc17 dot net
                   ` (9 preceding siblings ...)
  2014-12-10 18:15 ` pinskia at gcc dot gnu.org
@ 2014-12-11 10:28 ` rguenth at gcc dot gnu.org
  2014-12-12  9:01 ` trippels at gcc dot gnu.org
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-12-11 10:28 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1


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

* [Bug rtl-optimization/64255] [5 Regression] failures with -O2 optimization on i >= 0 ? (unsigned long) i : - (unsigned long) i
  2014-12-10 15:31 [Bug c/64255] New: failures with -O2 optimization on i >= 0 ? (unsigned long) i : - (unsigned long) i vincent-gcc at vinc17 dot net
                   ` (10 preceding siblings ...)
  2014-12-11 10:28 ` rguenth at gcc dot gnu.org
@ 2014-12-12  9:01 ` trippels at gcc dot gnu.org
  2014-12-12  9:01 ` trippels at gcc dot gnu.org
  2014-12-12 12:44 ` jakub at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: trippels at gcc dot gnu.org @ 2014-12-12  9:01 UTC (permalink / raw)
  To: gcc-bugs

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

Markus Trippelsdorf <trippels at gcc dot gnu.org> changed:

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

--- Comment #12 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
Fixed by r218658.


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

* [Bug rtl-optimization/64255] [5 Regression] failures with -O2 optimization on i >= 0 ? (unsigned long) i : - (unsigned long) i
  2014-12-10 15:31 [Bug c/64255] New: failures with -O2 optimization on i >= 0 ? (unsigned long) i : - (unsigned long) i vincent-gcc at vinc17 dot net
                   ` (11 preceding siblings ...)
  2014-12-12  9:01 ` trippels at gcc dot gnu.org
@ 2014-12-12  9:01 ` trippels at gcc dot gnu.org
  2014-12-12 12:44 ` jakub at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: trippels at gcc dot gnu.org @ 2014-12-12  9:01 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64255
Bug 64255 depends on bug 63917, which changed state.

Bug 63917 Summary: [5 Regression] r217646 caused many failures
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63917

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


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

* [Bug rtl-optimization/64255] [5 Regression] failures with -O2 optimization on i >= 0 ? (unsigned long) i : - (unsigned long) i
  2014-12-10 15:31 [Bug c/64255] New: failures with -O2 optimization on i >= 0 ? (unsigned long) i : - (unsigned long) i vincent-gcc at vinc17 dot net
                   ` (12 preceding siblings ...)
  2014-12-12  9:01 ` trippels at gcc dot gnu.org
@ 2014-12-12 12:44 ` jakub at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-12-12 12:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #13 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Author: jakub
Date: Fri Dec 12 12:43:34 2014
New Revision: 218665

URL: https://gcc.gnu.org/viewcvs?rev=218665&root=gcc&view=rev
Log:
    PR rtl-optimization/64255
    * gcc.c-torture/execute/pr64255.c: New test.

    PR rtl-optimization/64260
    * gcc.c-torture/execute/pr64260.c: New test.

Added:
    trunk/gcc/testsuite/gcc.c-torture/execute/pr64255.c
    trunk/gcc/testsuite/gcc.c-torture/execute/pr64260.c
Modified:
    trunk/gcc/testsuite/ChangeLog


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

end of thread, other threads:[~2014-12-12 12:44 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-10 15:31 [Bug c/64255] New: failures with -O2 optimization on i >= 0 ? (unsigned long) i : - (unsigned long) i vincent-gcc at vinc17 dot net
2014-12-10 15:38 ` [Bug c/64255] " mpolacek at gcc dot gnu.org
2014-12-10 16:51 ` vincent-gcc at vinc17 dot net
2014-12-10 16:54 ` vincent-gcc at vinc17 dot net
2014-12-10 17:29 ` [Bug c/64255] [5 Regression] " trippels at gcc dot gnu.org
2014-12-10 17:37 ` mpolacek at gcc dot gnu.org
2014-12-10 17:44 ` mpolacek at gcc dot gnu.org
2014-12-10 17:45 ` jakub at gcc dot gnu.org
2014-12-10 17:46 ` [Bug rtl-optimization/64255] " pinskia at gcc dot gnu.org
2014-12-10 18:04 ` trippels at gcc dot gnu.org
2014-12-10 18:15 ` pinskia at gcc dot gnu.org
2014-12-11 10:28 ` rguenth at gcc dot gnu.org
2014-12-12  9:01 ` trippels at gcc dot gnu.org
2014-12-12  9:01 ` trippels at gcc dot gnu.org
2014-12-12 12:44 ` jakub 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).