public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/59047] New: wrong code for bitfields at -O3 on x86_64-linux-gnu
@ 2013-11-08  9:21 su at cs dot ucdavis.edu
  2013-11-08 10:14 ` [Bug tree-optimization/59047] [4.9 Regression] " mpolacek at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: su at cs dot ucdavis.edu @ 2013-11-08  9:21 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59047

            Bug ID: 59047
           Summary: wrong code for bitfields at -O3 on x86_64-linux-gnu
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu

The current gcc trunk miscompiles the following testcase on x86_64-linux-gnu at
-O3 (in both 32-bit and 64-bit modes). 

This is a regression from 4.8.x.

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-trunk/configure
--enable-languages=c,c++,objc,obj-c++,fortran,lto --disable-werror
--enable-checking=release --with-gmp=/usr/local/gcc-trunk
--with-mpfr=/usr/local/gcc-trunk --with-mpc=/usr/local/gcc-trunk
--with-cloog=/usr/local/gcc-trunk --prefix=/usr/local/gcc-trunk
Thread model: posix
gcc version 4.9.0 20131108 (experimental) [trunk revision 204560] (GCC) 
$ 
$ gcc-trunk -O2 small.c; a.out
1
$ gcc-4.8.2 -O3 small.c; a.out
1
$ 
$ gcc-trunk -O3 small.c; a.out
0
$ 


--------------------------------------


int printf (const char *, ...);

struct
{
  int f0;
  int f1:1;
  int f2:2;
} a = {0, 0, 1};

int b, c, *d, e, f;

int
fn1 ()
{
  for (; b < 1; ++b)
    {
      for (e = 0; e < 1; e = 1)
    {
      int **g = &d;
      *g = &c;
    } 
      *d = 0;
      f = a.f1;
      if (f)
    return 0;
    }
  return 0;
}

int
main ()
{
  fn1 ();
  printf ("%d\n", b);
  return 0;
}


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

* [Bug tree-optimization/59047] [4.9 Regression] wrong code for bitfields at -O3 on x86_64-linux-gnu
  2013-11-08  9:21 [Bug tree-optimization/59047] New: wrong code for bitfields at -O3 on x86_64-linux-gnu su at cs dot ucdavis.edu
@ 2013-11-08 10:14 ` mpolacek at gcc dot gnu.org
  2013-11-08 10:27 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-11-08 10:14 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59047

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
      Known to work|                            |4.8.2
           Keywords|                            |wrong-code
   Last reconfirmed|                            |2013-11-08
                 CC|                            |mpolacek at gcc dot gnu.org
     Ever confirmed|0                           |1
            Summary|wrong code for bitfields at |[4.9 Regression] wrong code
                   |-O3 on x86_64-linux-gnu     |for bitfields at -O3 on
                   |                            |x86_64-linux-gnu
   Target Milestone|---                         |4.9.0
      Known to fail|                            |4.9.0

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed.


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

* [Bug tree-optimization/59047] [4.9 Regression] wrong code for bitfields at -O3 on x86_64-linux-gnu
  2013-11-08  9:21 [Bug tree-optimization/59047] New: wrong code for bitfields at -O3 on x86_64-linux-gnu su at cs dot ucdavis.edu
  2013-11-08 10:14 ` [Bug tree-optimization/59047] [4.9 Regression] " mpolacek at gcc dot gnu.org
@ 2013-11-08 10:27 ` rguenth at gcc dot gnu.org
  2013-11-08 12:49 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-11-08 10:27 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59047

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 #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Triggered by predictive commoning fix.  Mine.


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

* [Bug tree-optimization/59047] [4.9 Regression] wrong code for bitfields at -O3 on x86_64-linux-gnu
  2013-11-08  9:21 [Bug tree-optimization/59047] New: wrong code for bitfields at -O3 on x86_64-linux-gnu su at cs dot ucdavis.edu
  2013-11-08 10:14 ` [Bug tree-optimization/59047] [4.9 Regression] " mpolacek at gcc dot gnu.org
  2013-11-08 10:27 ` rguenth at gcc dot gnu.org
@ 2013-11-08 12:49 ` rguenth at gcc dot gnu.org
  2013-11-08 12:49 ` rguenth at gcc dot gnu.org
  2013-11-18 15:14 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-11-08 12:49 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59047

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Fri Nov  8 12:49:10 2013
New Revision: 204566

URL: http://gcc.gnu.org/viewcvs?rev=204566&root=gcc&view=rev
Log:
2013-11-08  Richard Biener  <rguenther@suse.de>

    PR tree-optimization/59047
    * tree-predcom.c (ref_at_iteration): Handle bitfield accesses
    properly.

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

Added:
    trunk/gcc/testsuite/gcc.dg/torture/pr59047.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-predcom.c


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

* [Bug tree-optimization/59047] [4.9 Regression] wrong code for bitfields at -O3 on x86_64-linux-gnu
  2013-11-08  9:21 [Bug tree-optimization/59047] New: wrong code for bitfields at -O3 on x86_64-linux-gnu su at cs dot ucdavis.edu
                   ` (2 preceding siblings ...)
  2013-11-08 12:49 ` rguenth at gcc dot gnu.org
@ 2013-11-08 12:49 ` rguenth at gcc dot gnu.org
  2013-11-18 15:14 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-11-08 12:49 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59047

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

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

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


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

* [Bug tree-optimization/59047] [4.9 Regression] wrong code for bitfields at -O3 on x86_64-linux-gnu
  2013-11-08  9:21 [Bug tree-optimization/59047] New: wrong code for bitfields at -O3 on x86_64-linux-gnu su at cs dot ucdavis.edu
                   ` (3 preceding siblings ...)
  2013-11-08 12:49 ` rguenth at gcc dot gnu.org
@ 2013-11-18 15:14 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-11-18 15:14 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59047

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Mon Nov 18 15:13:14 2013
New Revision: 204965

URL: http://gcc.gnu.org/viewcvs?rev=204965&root=gcc&view=rev
Log:
2013-11-18  Richard Biener  <rguenther@suse.de>

    Backport from mainline
    2013-10-21  Richard Biener  <rguenther@suse.de>

    PR tree-optimization/58794
    * fold-const.c (operand_equal_p): Compare FIELD_DECL operand
    of COMPONENT_REFs with OEP_CONSTANT_ADDRESS_OF left in place.

    * c-c++-common/torture/pr58794-1.c: New testcase.
    * c-c++-common/torture/pr58794-2.c: Likewise.

    2013-10-21  Richard Biener  <rguenther@suse.de>

    PR middle-end/58742
    * fold-const.c (fold_binary_loc): Fold ((T) (X /[ex] C)) * C
    to (T) X for sign-changing conversions (or no conversion).

    * c-c++-common/fold-divmul-1.c: New testcase.

    2013-11-06  Richard Biener  <rguenther@suse.de>

    PR tree-optimization/58653
    * tree-predcom.c (ref_at_iteration): Rewrite to generate
    a MEM_REF.
    (prepare_initializers_chain): Adjust.

    * gcc.dg/tree-ssa/predcom-6.c: New testcase.
    * gcc.dg/tree-ssa/predcom-7.c: Likewise.

    PR tree-optimization/59047
    * tree-predcom.c (ref_at_iteration): Handle bitfield accesses
    properly.

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

    2013-10-15  Richard Biener  <rguenther@suse.de>

    PR tree-optimization/58143
    * tree-ssa-loop-im.c (arith_code_with_undefined_signed_overflow):
    New function.
    (rewrite_to_defined_overflow): Likewise.
    (move_computations_dom_walker::before_dom): Rewrite stmts
    with undefined signed overflow that are not always executed
    into unsigned arithmetic.

    * gcc.dg/torture/pr58143-1.c: New testcase.
    * gcc.dg/torture/pr58143-2.c: Likewise.
    * gcc.dg/torture/pr58143-3.c: Likewise.

Added:
    branches/gcc-4_8-branch/gcc/testsuite/c-c++-common/fold-divmul-1.c
    branches/gcc-4_8-branch/gcc/testsuite/c-c++-common/torture/pr58794-1.c
    branches/gcc-4_8-branch/gcc/testsuite/c-c++-common/torture/pr58794-2.c
    branches/gcc-4_8-branch/gcc/testsuite/gcc.dg/torture/pr58143-1.c
    branches/gcc-4_8-branch/gcc/testsuite/gcc.dg/torture/pr58143-2.c
    branches/gcc-4_8-branch/gcc/testsuite/gcc.dg/torture/pr58143-3.c
    branches/gcc-4_8-branch/gcc/testsuite/gcc.dg/torture/pr59047.c
    branches/gcc-4_8-branch/gcc/testsuite/gcc.dg/tree-ssa/predcom-6.c
    branches/gcc-4_8-branch/gcc/testsuite/gcc.dg/tree-ssa/predcom-7.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-predcom.c
    branches/gcc-4_8-branch/gcc/tree-ssa-loop-im.c


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

end of thread, other threads:[~2013-11-18 15:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-08  9:21 [Bug tree-optimization/59047] New: wrong code for bitfields at -O3 on x86_64-linux-gnu su at cs dot ucdavis.edu
2013-11-08 10:14 ` [Bug tree-optimization/59047] [4.9 Regression] " mpolacek at gcc dot gnu.org
2013-11-08 10:27 ` rguenth at gcc dot gnu.org
2013-11-08 12:49 ` rguenth at gcc dot gnu.org
2013-11-08 12:49 ` rguenth at gcc dot gnu.org
2013-11-18 15:14 ` 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).