public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/62031] New: Different results between O2 and O3 for gcc-4.7.2-5 (Debian 4.7.2-5)
@ 2014-08-06  7:27 tomasz.ostaszewski at interia dot pl
  2014-08-06  8:40 ` [Bug c/62031] " mikpelinux at gmail dot com
                   ` (18 more replies)
  0 siblings, 19 replies; 20+ messages in thread
From: tomasz.ostaszewski at interia dot pl @ 2014-08-06  7:27 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 62031
           Summary: Different results between O2 and O3 for gcc-4.7.2-5
                    (Debian 4.7.2-5)
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tomasz.ostaszewski at interia dot pl

Created attachment 33255
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33255&action=edit
problematic code, preprocessed

Hello, 

My little program produces different results when compiled with O2 and O3
options. Turning on/off '-fstrict-aliasing' does not make any difference. 

#include <stdlib.h>
#include <stdio.h>

#define NUM_OF_STATES 4
typedef unsigned int entry_t[2];
typedef struct entries_item { entry_t metricEntries_[0]; } entries_item_t;

void test_00(size_t numOfStates, entries_item_t* p_bm, const unsigned int*
polyArray,
                      size_t polyArraySize) {
    size_t idx;
    unsigned int hlp0, hlp1;
    for (idx = 0; idx < numOfStates; ++idx) {
        size_t idy;

        hlp0 = (idx << 1) | 0x00;
        hlp1 = (idx << 1) | 0x01;
        p_bm->metricEntries_[idx][0] = 0;
        p_bm->metricEntries_[idx][1] = 0;
        for (idy = 0; idy < polyArraySize; ++idy) {
            p_bm->metricEntries_[idx][0] |= __builtin_parity(hlp0 &
polyArray[idy]) << idy;
            p_bm->metricEntries_[idx][1] |= __builtin_parity(hlp1 &
polyArray[idy]) << idy;
#if 0
            fprintf(stderr, "%4.4u : %8.8x %8.8x\n", __LINE__,
p_bm->metricEntries_[idx][0], p_bm->metricEntries_[idx][1]);
#endif
        }
    }
    fprintf(stderr, "%4.4u :", __LINE__);
    for (idx = 0; idx < numOfStates; ++idx) {
        fprintf(stderr, "%2u:%2u ", p_bm->metricEntries_[idx][0],
p_bm->metricEntries_[idx][1]);
    }
    fprintf(stderr, "\n");
}

int main(__attribute__((unused)) int argc, __attribute__((unused)) char** argv)
{
    unsigned int polyArray[] = { 0x07, 0x05 };
    entries_item_t* pBranchMetrics;

    pBranchMetrics = malloc(sizeof(entry_t) * NUM_OF_STATES);
    test_00(NUM_OF_STATES, pBranchMetrics, polyArray, sizeof(polyArray) /
sizeof(polyArray[0]));
    free(pBranchMetrics);
    return 0;
}

When compiled with O2 produces a correct result:
0029 : 0: 3  1: 2  3: 0  2: 1 

When compiled with O3 produces an incorrect result:
0029 : 0: 2  0: 2  2: 0  2: 0 

Suprisingly, changing #if 0 to #if 1 forces program to produce correct results.
Also adding the 'static' keyword before 'void test_00' also changes program to
produce a correct result. Also, changing zero sized array to fixed array (size
1) also makes the problem go away. 

Valgrind does not report any violations in either case (O2/O3). Both gcc-4.6.3
and clang 3.5.0 produce correct results with O3. 

problematic gcc version: 
$ gcc --verbose
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i486-linux-gnu/4.7/lto-wrapper
Target: i486-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.7.2-5'
--with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs
--enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.7 --enable-shared --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object
--enable-plugin --enable-objc-gc --enable-targets=all --with-arch-32=i586
--with-tune=generic --enable-checking=release --build=i486-linux-gnu
--host=i486-linux-gnu --target=i486-linux-gnu
Thread model: posix
gcc version 4.7.2 (Debian 4.7.2-5) 

Assembler:
$as --version
GNU assembler (GNU Binutils for Debian) 2.22
Copyright 2011 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or later.
This program has absolutely no warranty.
This assembler was configured for a target of `i486-linux-gnu'.

System:
Linux debian-vm-x86 3.2.0-4-686-pae #1 SMP Debian 3.2.60-1+deb7u3 i686
GNU/Linux

LibC:
 /lib/i386-linux-gnu/libc-2.13.so 
GNU C Library (Debian EGLIBC 2.13-38+deb7u3) stable release version 2.13, by
Roland McGrath et al.
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 4.4.7.
Compiled on a Linux 3.2.57 system on 2014-07-09.
Available extensions:
    crypt add-on version 2.1 by Michael Glad and others
    GNU Libidn by Simon Josefsson
    Native POSIX Threads Library by Ulrich Drepper et al
    BIND-8.2.3-T5B
libc ABIs: UNIQUE IFUNC
For bug reporting instructions, please see:
<http://www.debian.org/Bugs/>.


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

* [Bug c/62031] Different results between O2 and O3 for gcc-4.7.2-5 (Debian 4.7.2-5)
  2014-08-06  7:27 [Bug c/62031] New: Different results between O2 and O3 for gcc-4.7.2-5 (Debian 4.7.2-5) tomasz.ostaszewski at interia dot pl
@ 2014-08-06  8:40 ` mikpelinux at gmail dot com
  2014-08-06  8:56 ` [Bug tree-optimization/62031] [4.8/4.9/4.10 Regression] Different results between O2 and O2 -fpredictive-commoning rguenth at gcc dot gnu.org
                   ` (17 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: mikpelinux at gmail dot com @ 2014-08-06  8:40 UTC (permalink / raw)
  To: gcc-bugs

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

Mikael Pettersson <mikpelinux at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mikpelinux at gmail dot com

--- Comment #1 from Mikael Pettersson <mikpelinux at gmail dot com> ---
I can reproduce with 4.8.3 and 4.9.1.  -fsanitize={address,undefined} finds
nothing to complain about.


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

* [Bug tree-optimization/62031] [4.8/4.9/4.10 Regression] Different results between O2 and O2 -fpredictive-commoning
  2014-08-06  7:27 [Bug c/62031] New: Different results between O2 and O3 for gcc-4.7.2-5 (Debian 4.7.2-5) tomasz.ostaszewski at interia dot pl
  2014-08-06  8:40 ` [Bug c/62031] " mikpelinux at gmail dot com
@ 2014-08-06  8:56 ` rguenth at gcc dot gnu.org
  2014-08-06 10:54 ` mpolacek at gcc dot gnu.org
                   ` (16 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-08-06  8:56 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
      Known to work|                            |4.3.4
           Keywords|                            |wrong-code
   Last reconfirmed|                            |2014-08-06
          Component|c                           |tree-optimization
                 CC|                            |rguenth at gcc dot gnu.org
     Ever confirmed|0                           |1
            Summary|Different results between   |[4.8/4.9/4.10 Regression]
                   |O2 and O3 for gcc-4.7.2-5   |Different results between
                   |(Debian 4.7.2-5)            |O2 and O2
                   |                            |-fpredictive-commoning
   Target Milestone|---                         |4.8.4
      Known to fail|                            |4.7.4, 4.9.1

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
-O2 -fpredictive-commoning fails as well (thus culprit found).


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

* [Bug tree-optimization/62031] [4.8/4.9/4.10 Regression] Different results between O2 and O2 -fpredictive-commoning
  2014-08-06  7:27 [Bug c/62031] New: Different results between O2 and O3 for gcc-4.7.2-5 (Debian 4.7.2-5) tomasz.ostaszewski at interia dot pl
  2014-08-06  8:40 ` [Bug c/62031] " mikpelinux at gmail dot com
  2014-08-06  8:56 ` [Bug tree-optimization/62031] [4.8/4.9/4.10 Regression] Different results between O2 and O2 -fpredictive-commoning rguenth at gcc dot gnu.org
@ 2014-08-06 10:54 ` mpolacek at gcc dot gnu.org
  2014-08-06 11:36 ` rguenth at gcc dot gnu.org
                   ` (15 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-08-06 10:54 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mpolacek at gcc dot gnu.org

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Started with r175704.


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

* [Bug tree-optimization/62031] [4.8/4.9/4.10 Regression] Different results between O2 and O2 -fpredictive-commoning
  2014-08-06  7:27 [Bug c/62031] New: Different results between O2 and O3 for gcc-4.7.2-5 (Debian 4.7.2-5) tomasz.ostaszewski at interia dot pl
                   ` (2 preceding siblings ...)
  2014-08-06 10:54 ` mpolacek at gcc dot gnu.org
@ 2014-08-06 11:36 ` rguenth at gcc dot gnu.org
  2014-08-14 12:43 ` [Bug tree-optimization/62031] [4.8/4.9/5 " rguenth at gcc dot gnu.org
                   ` (14 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-08-06 11:36 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Mine then.


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

* [Bug tree-optimization/62031] [4.8/4.9/5 Regression] Different results between O2 and O2 -fpredictive-commoning
  2014-08-06  7:27 [Bug c/62031] New: Different results between O2 and O3 for gcc-4.7.2-5 (Debian 4.7.2-5) tomasz.ostaszewski at interia dot pl
                   ` (3 preceding siblings ...)
  2014-08-06 11:36 ` rguenth at gcc dot gnu.org
@ 2014-08-14 12:43 ` rguenth at gcc dot gnu.org
  2014-08-15  7:51 ` rguenth at gcc dot gnu.org
                   ` (13 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-08-14 12:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
For some reason predictive commoning thinks that the loads of
p_bm->metricEntries_[idx][0] and [1] are invariant in the innermost loop.
Because:

(Data Dep:
#(Data Ref:
#  bb: 9
#  stmt: _14 = p_bm_10(D)->metricEntries_[idx_40][0];
#  ref: p_bm_10(D)->metricEntries_[idx_40][0];
#  base_object: *p_bm_10(D);
#  Access function 0: 0
#  Access function 1: idx_40
#  Access function 2: 0
#)
#(Data Ref:
#  bb: 9
#  stmt: p_bm_10(D)->metricEntries_[idx_40][0] = _24;
#  ref: p_bm_10(D)->metricEntries_[idx_40][0];
#  base_object: *p_bm_10(D);
#  Access function 0: 0
#  Access function 1: idx_40
#  Access function 2: 0
#)
    (no dependence)
)

err...?  There is a anti-dependence here.

Oh.  Data dependence in dr_may_alias_p happily uses DR_BASE_OBJECT as
input to the alias oracle but in this case DR_BASE_OBJECT is *p_bm_10(D)
which is an object of size 0 ...

 <mem_ref 0x7ffff686a280
    type <record_type 0x7ffff68691f8 entries_item_t type_0 BLK
        size <integer_cst 0x7ffff66c4ca8 constant 0>

I have a patch.


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

* [Bug tree-optimization/62031] [4.8/4.9/5 Regression] Different results between O2 and O2 -fpredictive-commoning
  2014-08-06  7:27 [Bug c/62031] New: Different results between O2 and O3 for gcc-4.7.2-5 (Debian 4.7.2-5) tomasz.ostaszewski at interia dot pl
                   ` (4 preceding siblings ...)
  2014-08-14 12:43 ` [Bug tree-optimization/62031] [4.8/4.9/5 " rguenth at gcc dot gnu.org
@ 2014-08-15  7:51 ` rguenth at gcc dot gnu.org
  2014-10-15  7:37 ` [Bug tree-optimization/62031] [4.8/4.9 " rguenth at gcc dot gnu.org
                   ` (12 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-08-15  7:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Fri Aug 15 07:50:40 2014
New Revision: 214006

URL: https://gcc.gnu.org/viewcvs?rev=214006&root=gcc&view=rev
Log:
2014-08-15  Richard Biener  <rguenther@suse.de>

    PR tree-optimization/62031
    * tree-data-ref.c (dr_analyze_indices): Do not set
    DR_UNCONSTRAINED_BASE.
    (dr_may_alias_p): All indirect accesses have to go the
    formerly DR_UNCONSTRAINED_BASE path.
    * tree-data-ref.h (struct indices): Remove
    unconstrained_base member.
    (DR_UNCONSTRAINED_BASE): Remove.

    * gcc.dg/torture/pr62031.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.dg/torture/pr62031.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-data-ref.c
    trunk/gcc/tree-data-ref.h


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

* [Bug tree-optimization/62031] [4.8/4.9 Regression] Different results between O2 and O2 -fpredictive-commoning
  2014-08-06  7:27 [Bug c/62031] New: Different results between O2 and O3 for gcc-4.7.2-5 (Debian 4.7.2-5) tomasz.ostaszewski at interia dot pl
                   ` (5 preceding siblings ...)
  2014-08-15  7:51 ` rguenth at gcc dot gnu.org
@ 2014-10-15  7:37 ` rguenth at gcc dot gnu.org
  2014-10-15 15:11 ` [Bug tree-optimization/62031] [4.8 " clyon at gcc dot gnu.org
                   ` (11 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-10-15  7:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Wed Oct 15 07:37:20 2014
New Revision: 216236

URL: https://gcc.gnu.org/viewcvs?rev=216236&root=gcc&view=rev
Log:
2014-10-15  Richard Biener  <rguenther@suse.de>

    Backport from mainline
    2014-08-15  Richard Biener  <rguenther@suse.de>

    PR tree-optimization/62031
    * tree-data-ref.c (dr_analyze_indices): Do not set
    DR_UNCONSTRAINED_BASE.
    (dr_may_alias_p): All indirect accesses have to go the
    formerly DR_UNCONSTRAINED_BASE path.
    * tree-data-ref.h (struct indices): Remove
    unconstrained_base member.
    (DR_UNCONSTRAINED_BASE): Remove.

    * gcc.dg/torture/pr62031.c: New testcase.

Added:
    branches/gcc-4_9-branch/gcc/testsuite/gcc.dg/torture/pr62031.c
Modified:
    branches/gcc-4_9-branch/gcc/ChangeLog
    branches/gcc-4_9-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_9-branch/gcc/tree-data-ref.c
    branches/gcc-4_9-branch/gcc/tree-data-ref.h


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

* [Bug tree-optimization/62031] [4.8 Regression] Different results between O2 and O2 -fpredictive-commoning
  2014-08-06  7:27 [Bug c/62031] New: Different results between O2 and O3 for gcc-4.7.2-5 (Debian 4.7.2-5) tomasz.ostaszewski at interia dot pl
                   ` (6 preceding siblings ...)
  2014-10-15  7:37 ` [Bug tree-optimization/62031] [4.8/4.9 " rguenth at gcc dot gnu.org
@ 2014-10-15 15:11 ` clyon at gcc dot gnu.org
  2014-10-15 15:14 ` clyon at gcc dot gnu.org
                   ` (10 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: clyon at gcc dot gnu.org @ 2014-10-15 15:11 UTC (permalink / raw)
  To: gcc-bugs

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

clyon at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clyon at gcc dot gnu.org

--- Comment #8 from clyon at gcc dot gnu.org ---
The added testcase (gcc/testsuite/gcc.dg/torture/pr62031.c) FAILs at execution
on all the arm* targets I validate.

They PASS on aarch64 targets though.

The logs only show:
PASS: gcc.dg/torture/pr62031.c  -O0  (test for excess errors)
FAIL: gcc.dg/torture/pr62031.c  -O0  execution test
etc....


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

* [Bug tree-optimization/62031] [4.8 Regression] Different results between O2 and O2 -fpredictive-commoning
  2014-08-06  7:27 [Bug c/62031] New: Different results between O2 and O3 for gcc-4.7.2-5 (Debian 4.7.2-5) tomasz.ostaszewski at interia dot pl
                   ` (7 preceding siblings ...)
  2014-10-15 15:11 ` [Bug tree-optimization/62031] [4.8 " clyon at gcc dot gnu.org
@ 2014-10-15 15:14 ` clyon at gcc dot gnu.org
  2014-10-16  7:56 ` rguenther at suse dot de
                   ` (9 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: clyon at gcc dot gnu.org @ 2014-10-15 15:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from clyon at gcc dot gnu.org ---
Forgot to mention that my observation is true on trunk and 4.9 branch.

I didn't notice it earlier because I run validations for every commit on the
4.9 branch, and not as often on trunk.


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

* [Bug tree-optimization/62031] [4.8 Regression] Different results between O2 and O2 -fpredictive-commoning
  2014-08-06  7:27 [Bug c/62031] New: Different results between O2 and O3 for gcc-4.7.2-5 (Debian 4.7.2-5) tomasz.ostaszewski at interia dot pl
                   ` (8 preceding siblings ...)
  2014-10-15 15:14 ` clyon at gcc dot gnu.org
@ 2014-10-16  7:56 ` rguenther at suse dot de
  2014-10-16  9:31 ` rguenth at gcc dot gnu.org
                   ` (8 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: rguenther at suse dot de @ 2014-10-16  7:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from rguenther at suse dot de <rguenther at suse dot de> ---
On Wed, 15 Oct 2014, clyon at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62031
> 
> --- Comment #9 from clyon at gcc dot gnu.org ---
> Forgot to mention that my observation is true on trunk and 4.9 branch.
> 
> I didn't notice it earlier because I run validations for every commit on the
> 4.9 branch, and not as often on trunk.

Can you please try to investigate?  (does it only fail at -O0?!)


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

* [Bug tree-optimization/62031] [4.8 Regression] Different results between O2 and O2 -fpredictive-commoning
  2014-08-06  7:27 [Bug c/62031] New: Different results between O2 and O3 for gcc-4.7.2-5 (Debian 4.7.2-5) tomasz.ostaszewski at interia dot pl
                   ` (9 preceding siblings ...)
  2014-10-16  7:56 ` rguenther at suse dot de
@ 2014-10-16  9:31 ` rguenth at gcc dot gnu.org
  2014-10-16  9:56 ` clyon at gcc dot gnu.org
                   ` (7 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-10-16  9:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to rguenther@suse.de from comment #10)
> On Wed, 15 Oct 2014, clyon at gcc dot gnu.org wrote:
> 
> > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62031
> > 
> > --- Comment #9 from clyon at gcc dot gnu.org ---
> > Forgot to mention that my observation is true on trunk and 4.9 branch.
> > 
> > I didn't notice it earlier because I run validations for every commit on the
> > 4.9 branch, and not as often on trunk.
> 
> Can you please try to investigate?  (does it only fail at -O0?!)

Especially please state if you are cross-testing and one target triplet that
shows the failure.


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

* [Bug tree-optimization/62031] [4.8 Regression] Different results between O2 and O2 -fpredictive-commoning
  2014-08-06  7:27 [Bug c/62031] New: Different results between O2 and O3 for gcc-4.7.2-5 (Debian 4.7.2-5) tomasz.ostaszewski at interia dot pl
                   ` (10 preceding siblings ...)
  2014-10-16  9:31 ` rguenth at gcc dot gnu.org
@ 2014-10-16  9:56 ` clyon at gcc dot gnu.org
  2014-10-16 12:28 ` clyon at gcc dot gnu.org
                   ` (6 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: clyon at gcc dot gnu.org @ 2014-10-16  9:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from clyon at gcc dot gnu.org ---
Sorry, I thought you had the setup needed to reproduce the tests.

I am using qemu.

All execution tests fail (not only -O0), for instance with GCC configured as:
--target=arm-none-eabi --with-mode=arm --with-cpu=cortex-a9

FAIL: gcc.dg/torture/pr62031.c  -O0  execution test
FAIL: gcc.dg/torture/pr62031.c  -O1  execution test
FAIL: gcc.dg/torture/pr62031.c  -O2  execution test
FAIL: gcc.dg/torture/pr62031.c  -O3 -fomit-frame-pointer  execution test
FAIL: gcc.dg/torture/pr62031.c  -O3 -fomit-frame-pointer -funroll-loops 
execution test
FAIL: gcc.dg/torture/pr62031.c  -O3 -fomit-frame-pointer -funroll-all-loops
-finline-functions  execution test
FAIL: gcc.dg/torture/pr62031.c  -O3 -g  execution test
FAIL: gcc.dg/torture/pr62031.c  -Os  execution test
FAIL: gcc.dg/torture/pr62031.c  -O2 -flto -fno-use-linker-plugin
-flto-partition=none  execution test
FAIL: gcc.dg/torture/pr62031.c  -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects  execution test


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

* [Bug tree-optimization/62031] [4.8 Regression] Different results between O2 and O2 -fpredictive-commoning
  2014-08-06  7:27 [Bug c/62031] New: Different results between O2 and O3 for gcc-4.7.2-5 (Debian 4.7.2-5) tomasz.ostaszewski at interia dot pl
                   ` (11 preceding siblings ...)
  2014-10-16  9:56 ` clyon at gcc dot gnu.org
@ 2014-10-16 12:28 ` clyon at gcc dot gnu.org
  2014-10-20  7:48 ` clyon at gcc dot gnu.org
                   ` (5 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: clyon at gcc dot gnu.org @ 2014-10-16 12:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #13 from clyon at gcc dot gnu.org ---
To be more specific, I'm using qemu 2.0.0.

But I've switched to a new x86_64 host running Ubuntu-14.04, and the tests
pass.

I observed the failures when using a x86_64 host running Red-Hat 5.

And qemu-2.0.0 in both cases.

I am going to take a further look at the RHEL5 (I need to restart the builds
manually).


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

* [Bug tree-optimization/62031] [4.8 Regression] Different results between O2 and O2 -fpredictive-commoning
  2014-08-06  7:27 [Bug c/62031] New: Different results between O2 and O3 for gcc-4.7.2-5 (Debian 4.7.2-5) tomasz.ostaszewski at interia dot pl
                   ` (12 preceding siblings ...)
  2014-10-16 12:28 ` clyon at gcc dot gnu.org
@ 2014-10-20  7:48 ` clyon at gcc dot gnu.org
  2014-11-26 13:16 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: clyon at gcc dot gnu.org @ 2014-10-20  7:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #14 from clyon at gcc dot gnu.org ---
I confirm what I observed is a testsuite harness problem, for which I proposed
a patch here:
https://gcc.gnu.org/ml/gcc-patches/2014-10/msg01792.html

dejagnu-1.5 (as shipped with Ubuntu 14.04) masks the problem I was facing with
dejagnu-1.4.4-X as shipped with RHEL5).


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

* [Bug tree-optimization/62031] [4.8 Regression] Different results between O2 and O2 -fpredictive-commoning
  2014-08-06  7:27 [Bug c/62031] New: Different results between O2 and O3 for gcc-4.7.2-5 (Debian 4.7.2-5) tomasz.ostaszewski at interia dot pl
                   ` (14 preceding siblings ...)
  2014-11-26 13:16 ` rguenth at gcc dot gnu.org
@ 2014-11-26 13:16 ` rguenth at gcc dot gnu.org
  2015-05-27 14:21 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-11-26 13:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #15 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Wed Nov 26 13:15:16 2014
New Revision: 218079

URL: https://gcc.gnu.org/viewcvs?rev=218079&root=gcc&view=rev
Log:
2014-11-26  Richard Biener  <rguenther@suse.de>

    Backport from mainline
    2014-10-08  Richard Biener  <rguenther@suse.de>

    PR tree-optimization/61969
    * tree-nrv.c (pass_nrv::execute): Properly test for automatic
    variables.

    2014-08-15  Richard Biener  <rguenther@suse.de>

    PR tree-optimization/62031
    * tree-data-ref.c (dr_analyze_indices): Do not set
    DR_UNCONSTRAINED_BASE.
    (dr_may_alias_p): All indirect accesses have to go the
    formerly DR_UNCONSTRAINED_BASE path.
    * tree-data-ref.h (struct indices): Remove
    unconstrained_base member.
    (DR_UNCONSTRAINED_BASE): Remove.

    * gcc.dg/torture/pr62031.c: New testcase.

    2014-10-10  Richard Biener  <rguenther@suse.de>

    PR tree-optimization/63379
    * tree-vect-slp.c (vect_get_constant_vectors): Do not compute
    a neutral operand for min/max when it is not a reduction chain.

    * gcc.dg/vect/pr63379.c: New testcase.

    2014-11-07  Richard Biener  <rguenther@suse.de>

    PR tree-optimization/63605
    * fold-const.c (fold_binary_loc): Properly use element_precision
    for types that may not be scalar.

    * gcc.dg/vect/pr63605.c: New testcase.

    2014-10-28  Richard Biener  <rguenther@suse.de>

    PR middle-end/63665
    * fold-const.c (fold_comparison): Properly guard simplifying
    against INT_MAX/INT_MIN with !TYPE_OVERFLOW_WRAPS.

    * gcc.dg/pr63665.c: New testcase.

Added:
    branches/gcc-4_8-branch/gcc/testsuite/gcc.dg/pr63665.c
    branches/gcc-4_8-branch/gcc/testsuite/gcc.dg/torture/pr62031.c
    branches/gcc-4_8-branch/gcc/testsuite/gcc.dg/vect/pr63379.c
    branches/gcc-4_8-branch/gcc/testsuite/gcc.dg/vect/pr63605.c
Modified:
    branches/gcc-4_8-branch/gcc/ChangeLog
    branches/gcc-4_8-branch/gcc/fold-const.c
    branches/gcc-4_8-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_8-branch/gcc/tree-data-ref.c
    branches/gcc-4_8-branch/gcc/tree-data-ref.h
    branches/gcc-4_8-branch/gcc/tree-nrv.c
    branches/gcc-4_8-branch/gcc/tree-vect-slp.c


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

* [Bug tree-optimization/62031] [4.8 Regression] Different results between O2 and O2 -fpredictive-commoning
  2014-08-06  7:27 [Bug c/62031] New: Different results between O2 and O3 for gcc-4.7.2-5 (Debian 4.7.2-5) tomasz.ostaszewski at interia dot pl
                   ` (13 preceding siblings ...)
  2014-10-20  7:48 ` clyon at gcc dot gnu.org
@ 2014-11-26 13:16 ` rguenth at gcc dot gnu.org
  2014-11-26 13:16 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-11-26 13:16 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
      Known to fail|                            |4.8.3

--- Comment #16 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.


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

* [Bug tree-optimization/62031] [4.8 Regression] Different results between O2 and O2 -fpredictive-commoning
  2014-08-06  7:27 [Bug c/62031] New: Different results between O2 and O3 for gcc-4.7.2-5 (Debian 4.7.2-5) tomasz.ostaszewski at interia dot pl
                   ` (15 preceding siblings ...)
  2014-11-26 13:16 ` rguenth at gcc dot gnu.org
@ 2015-05-27 14:21 ` rguenth at gcc dot gnu.org
  2015-06-03  7:39 ` rguenth at gcc dot gnu.org
  2015-06-03 13:50 ` rguenth at gcc dot gnu.org
  18 siblings, 0 replies; 20+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-05-27 14:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #17 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Wed May 27 14:20:48 2015
New Revision: 223759

URL: https://gcc.gnu.org/viewcvs?rev=223759&root=gcc&view=rev
Log:
2015-05-27  Richard Biener  <rguenther@suse.de>

        PR tree-optimization/66272
        Revert parts of
        2014-08-15  Richard Biener  <rguenther@suse.de>

        PR tree-optimization/62031
        * tree-data-ref.c (dr_analyze_indices): Do not set
        DR_UNCONSTRAINED_BASE.
        (dr_may_alias_p): All indirect accesses have to go the
        formerly DR_UNCONSTRAINED_BASE path.
        * tree-data-ref.h (struct indices): Remove
        unconstrained_base member.
        (DR_UNCONSTRAINED_BASE): Remove.

        * gcc.dg/torture/pr66272.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.dg/torture/pr66272.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-data-ref.c
    trunk/gcc/tree-data-ref.h


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

* [Bug tree-optimization/62031] [4.8 Regression] Different results between O2 and O2 -fpredictive-commoning
  2014-08-06  7:27 [Bug c/62031] New: Different results between O2 and O3 for gcc-4.7.2-5 (Debian 4.7.2-5) tomasz.ostaszewski at interia dot pl
                   ` (16 preceding siblings ...)
  2015-05-27 14:21 ` rguenth at gcc dot gnu.org
@ 2015-06-03  7:39 ` rguenth at gcc dot gnu.org
  2015-06-03 13:50 ` rguenth at gcc dot gnu.org
  18 siblings, 0 replies; 20+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-06-03  7:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #18 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Wed Jun  3 07:39:06 2015
New Revision: 224059

URL: https://gcc.gnu.org/viewcvs?rev=224059&root=gcc&view=rev
Log:
2015-06-03  Richard Biener  <rguenther@suse.de>

        Backport from mainline
        2015-06-02  Richard Biener  <rguenther@suse.de>

        PR debug/65549
        * dwarf2out.c (lookup_context_die): New function.
        (resolve_addr): Avoid forcing a full DIE for the
        target of a DW_TAG_GNU_call_site during late compilation.
        Instead create a stub DIE without a type if we have a
        context DIE present.

        * g++.dg/lto/pr65549_0.C: New testcase.

        2015-06-01  Richard Biener  <rguenther@suse.de>

        PR tree-optimization/66280
        * tree-vect-slp.c (vect_detect_hybrid_slp_stmts): Fix pattern
        def-use walking.

        * g++.dg/torture/pr66280.C: New testcase.
        * g++.dg/torture/pr66280-2.C: Likewise.

        2015-05-27  Richard Biener  <rguenther@suse.de>

        PR tree-optimization/66272
        Revert parts of
        2014-08-15  Richard Biener  <rguenther@suse.de>

        PR tree-optimization/62031
        * tree-data-ref.c (dr_analyze_indices): Do not set
        DR_UNCONSTRAINED_BASE.
        (dr_may_alias_p): All indirect accesses have to go the
        formerly DR_UNCONSTRAINED_BASE path.
        * tree-data-ref.h (struct indices): Remove
        unconstrained_base member.
        (DR_UNCONSTRAINED_BASE): Remove.

        * gcc.dg/torture/pr66272.c: New testcase.

        2015-05-21  Richard Biener  <rguenther@suse.de>

        PR c++/66211
        * match.pd: Guard pattern optimzing (int)(float)int
        conversions to apply only on GIMPLE.

        * g++.dg/conversion/pr66211.C: New testcase.
        * gcc.dg/tree-ssa/forwprop-18.c: Adjust.

        2015-05-13  Richard Biener  <rguenther@suse.de>

        PR tree-optimization/66123
        * tree-ssa-dom.c (propagate_rhs_into_lhs): Check if we found
        a taken edge.

        * gcc.dg/torture/pr66123.c: New testcase.

Added:
    branches/gcc-5-branch/gcc/testsuite/g++.dg/conversion/pr66211.C
    branches/gcc-5-branch/gcc/testsuite/g++.dg/lto/pr65549_0.C
    branches/gcc-5-branch/gcc/testsuite/g++.dg/torture/pr66280-2.C
    branches/gcc-5-branch/gcc/testsuite/g++.dg/torture/pr66280.C
    branches/gcc-5-branch/gcc/testsuite/gcc.dg/torture/pr66123.c
    branches/gcc-5-branch/gcc/testsuite/gcc.dg/torture/pr66272.c
Modified:
    branches/gcc-5-branch/gcc/ChangeLog
    branches/gcc-5-branch/gcc/dwarf2out.c
    branches/gcc-5-branch/gcc/match.pd
    branches/gcc-5-branch/gcc/testsuite/ChangeLog
    branches/gcc-5-branch/gcc/testsuite/gcc.dg/tree-ssa/forwprop-18.c
    branches/gcc-5-branch/gcc/tree-data-ref.c
    branches/gcc-5-branch/gcc/tree-data-ref.h
    branches/gcc-5-branch/gcc/tree-ssa-dom.c
    branches/gcc-5-branch/gcc/tree-vect-slp.c


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

* [Bug tree-optimization/62031] [4.8 Regression] Different results between O2 and O2 -fpredictive-commoning
  2014-08-06  7:27 [Bug c/62031] New: Different results between O2 and O3 for gcc-4.7.2-5 (Debian 4.7.2-5) tomasz.ostaszewski at interia dot pl
                   ` (17 preceding siblings ...)
  2015-06-03  7:39 ` rguenth at gcc dot gnu.org
@ 2015-06-03 13:50 ` rguenth at gcc dot gnu.org
  18 siblings, 0 replies; 20+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-06-03 13:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #20 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Wed Jun  3 13:50:11 2015
New Revision: 224081

URL: https://gcc.gnu.org/viewcvs?rev=224081&root=gcc&view=rev
Log:
2015-06-03  Richard Biener  <rguenther@suse.de>

        Backport from mainline
        2015-05-26  Michael Matz  <matz@suse.de>

        PR middle-end/66251
        * tree-vect-stmts.c (vect_create_vectorized_demotion_stmts): Always set
        STMT_VINFO_VEC_STMT, also with SLP.

        * gcc.dg/vect/pr66251.c: New test.

        2015-05-22  Richard Biener  <rguenther@suse.de>

        PR tree-optimization/66251
        * tree-vect-stmts.c (vectorizable_conversion): Properly
        set STMT_VINFO_VEC_STMT even for the SLP case.

        * gfortran.fortran-torture/compile/pr66251.f90: New testcase.

        2015-03-23  Richard Biener  <rguenther@suse.de>

        PR tree-optimization/65518
        * tree-vect-stmts.c (vectorizable_load): Reject single-element
        interleaving cases we generate absymal code for.

        * gcc.dg/vect/pr65518.c: New testcase.

        2015-05-13  Richard Biener  <rguenther@suse.de>

        PR tree-optimization/66123
        * tree-ssa-dom.c (propagate_rhs_into_lhs): Check if we found
        a taken edge.

        * gcc.dg/torture/pr66123.c: New testcase.

        2015-05-27  Richard Biener  <rguenther@suse.de>

        PR tree-optimization/66272
        Revert parts of
        2014-08-15  Richard Biener  <rguenther@suse.de>

        PR tree-optimization/62031
        * tree-data-ref.c (dr_analyze_indices): Do not set
        DR_UNCONSTRAINED_BASE.
        (dr_may_alias_p): All indirect accesses have to go the
        formerly DR_UNCONSTRAINED_BASE path.
        * tree-data-ref.h (struct indices): Remove
        unconstrained_base member.
        (DR_UNCONSTRAINED_BASE): Remove.

        * gcc.dg/torture/pr66272.c: New testcase.

Added:
    branches/gcc-4_8-branch/gcc/testsuite/gcc.dg/torture/pr66123.c
    branches/gcc-4_8-branch/gcc/testsuite/gcc.dg/torture/pr66272.c
    branches/gcc-4_8-branch/gcc/testsuite/gcc.dg/vect/pr65518.c
    branches/gcc-4_8-branch/gcc/testsuite/gcc.dg/vect/pr66251.c
   
branches/gcc-4_8-branch/gcc/testsuite/gfortran.fortran-torture/compile/pr66251.f90
Modified:
    branches/gcc-4_8-branch/gcc/ChangeLog
    branches/gcc-4_8-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_8-branch/gcc/tree-data-ref.c
    branches/gcc-4_8-branch/gcc/tree-data-ref.h
    branches/gcc-4_8-branch/gcc/tree-ssa-dom.c
    branches/gcc-4_8-branch/gcc/tree-vect-stmts.c


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

end of thread, other threads:[~2015-06-03 13:50 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-06  7:27 [Bug c/62031] New: Different results between O2 and O3 for gcc-4.7.2-5 (Debian 4.7.2-5) tomasz.ostaszewski at interia dot pl
2014-08-06  8:40 ` [Bug c/62031] " mikpelinux at gmail dot com
2014-08-06  8:56 ` [Bug tree-optimization/62031] [4.8/4.9/4.10 Regression] Different results between O2 and O2 -fpredictive-commoning rguenth at gcc dot gnu.org
2014-08-06 10:54 ` mpolacek at gcc dot gnu.org
2014-08-06 11:36 ` rguenth at gcc dot gnu.org
2014-08-14 12:43 ` [Bug tree-optimization/62031] [4.8/4.9/5 " rguenth at gcc dot gnu.org
2014-08-15  7:51 ` rguenth at gcc dot gnu.org
2014-10-15  7:37 ` [Bug tree-optimization/62031] [4.8/4.9 " rguenth at gcc dot gnu.org
2014-10-15 15:11 ` [Bug tree-optimization/62031] [4.8 " clyon at gcc dot gnu.org
2014-10-15 15:14 ` clyon at gcc dot gnu.org
2014-10-16  7:56 ` rguenther at suse dot de
2014-10-16  9:31 ` rguenth at gcc dot gnu.org
2014-10-16  9:56 ` clyon at gcc dot gnu.org
2014-10-16 12:28 ` clyon at gcc dot gnu.org
2014-10-20  7:48 ` clyon at gcc dot gnu.org
2014-11-26 13:16 ` rguenth at gcc dot gnu.org
2014-11-26 13:16 ` rguenth at gcc dot gnu.org
2015-05-27 14:21 ` rguenth at gcc dot gnu.org
2015-06-03  7:39 ` rguenth at gcc dot gnu.org
2015-06-03 13:50 ` 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).