public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ipa/66424] New: wrong code at -O2 and -O3 on x86_64-linux-gnu in 32-bit mode
@ 2015-06-04 22:43 su at cs dot ucdavis.edu
  2015-06-05  6:16 ` [Bug ipa/66424] " jakub at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: su at cs dot ucdavis.edu @ 2015-06-04 22:43 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 66424
           Summary: wrong code at -O2 and -O3 on x86_64-linux-gnu in
                    32-bit mode
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu
  Target Milestone: ---

The current gcc trunk (and 5.1.x) miscompiles the following code on
x86_64-linux at -O2 and -O3 in 32-bit mode (but not in 64-bit mode).  

This is a regression from 4.9.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/6.0.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-trunk/configure --prefix=/usr/local/gcc-trunk
--enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
gcc version 6.0.0 20150604 (experimental) [trunk revision 224114] (GCC) 
$ 
$ gcc-trunk -m32 -Os small.c; ./a.out
small.c: In function ‘fn1’:
small.c:7:1: warning: type of ‘p’ defaults to ‘int’ [-Wimplicit-int]
 fn1 (p)
 ^
$ gcc-trunk -m64 -O2 small.c; ./a.out
small.c: In function ‘fn1’:
small.c:7:1: warning: type of ‘p’ defaults to ‘int’ [-Wimplicit-int]
 fn1 (p)
 ^
$ gcc-4.9.2 -m32 -O2 small.c; ./a.out
$ 
$ gcc-trunk -m32 -O2 small.c
small.c: In function ‘fn1’:
small.c:7:1: warning: type of ‘p’ defaults to ‘int’ [-Wimplicit-int]
 fn1 (p)
 ^
$ ./a.out
Aborted (core dumped)
$ 


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


int a, b, c, d, e[2], f, l, m, n, o;
long long g = 1, j;
static unsigned int h;
static int i, k;

void
fn1 (p)
{
  f = 1 ^ e[f ^ (p & 1)];
}

static void
fn2 (long long p)
{
  f = 1 ^ e[(f ^ 1) & 1];
  fn1 (p >> 1 & 1);
  fn1 (p >> 32 & 1);
}

void
fn3 (int p)
{
  g |= j = p;
}

int
main ()
{
  e[0] = 1;
  char p = l;
  h = --g;
  i = o = c;
  m = d ? 1 / d : 0;
  fn3 (l || 0);
  b = a;
  n = j++;
  k--;
  fn2 (g);
  fn2 (h);
  fn2 (i);

  if (k + f)
    __builtin_abort ();

  return 0;
}
>From gcc-bugs-return-488129-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Jun 04 23:26:46 2015
Return-Path: <gcc-bugs-return-488129-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 70807 invoked by alias); 4 Jun 2015 23:26:46 -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 70778 invoked by uid 48); 4 Jun 2015 23:26:42 -0000
From: "dje at google dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/65669] Don't emit debug info for fake_ostream version of cerr (and others)
Date: Thu, 04 Jun 2015 23:26:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: libstdc++
X-Bugzilla-Version: 4.9.1
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: dje at google dot com
X-Bugzilla-Status: NEW
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:
Message-ID: <bug-65669-4-31zvChOtkB@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-65669-4@http.gcc.gnu.org/bugzilla/>
References: <bug-65669-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-06/txt/msg00461.txt.bz2
Content-length: 370

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

--- Comment #3 from Doug Evans <dje at google dot com> ---
(In reply to Doug Evans from comment #2)
> I was wondering if one could just do a strip --strip-debug of globals_io.o
> in the Makefile.

This doesn't work, as is, because gdb ignores the DIE with the real type (from
ios_init.cc) because it's a declaration.


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

end of thread, other threads:[~2015-09-30 14:44 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-04 22:43 [Bug ipa/66424] New: wrong code at -O2 and -O3 on x86_64-linux-gnu in 32-bit mode su at cs dot ucdavis.edu
2015-06-05  6:16 ` [Bug ipa/66424] " jakub at gcc dot gnu.org
2015-06-05 17:44 ` su at cs dot ucdavis.edu
2015-06-05 18:03 ` joseph at codesourcery dot com
2015-06-05 19:23 ` [Bug ipa/66424] [5/6 Regression] " jakub at gcc dot gnu.org
2015-06-22 12:03 ` rguenth at gcc dot gnu.org
2015-07-16  9:17 ` rguenth at gcc dot gnu.org
2015-07-21 19:55 ` vmakarov at gcc dot gnu.org
2015-09-29 16:38 ` vmakarov at gcc dot gnu.org
2015-09-29 18:26 ` doko at gcc dot gnu.org
2015-09-30 14:44 ` aurelien at aurel32 dot net

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