public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/58143] New: wrong code at -O3 on x86_64-linux-gnu
@ 2013-08-13  0:05 su at cs dot ucdavis.edu
  2013-08-13  0:08 ` [Bug middle-end/58143] " pinskia at gcc dot gnu.org
                   ` (34 more replies)
  0 siblings, 35 replies; 36+ messages in thread
From: su at cs dot ucdavis.edu @ 2013-08-13  0:05 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 58143
           Summary: wrong code at -O3 on x86_64-linux-gnu
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu

The current gcc trunk and gcc 4.8 produce wrong code for the following testcase
on x86_64-linux when compiled at -O3 (in both 32-bit and 64-bit modes). This is
a regression from 4.7.x.


$ gcc-trunk -v
gcc version 4.9.0 20130812 (experimental) [trunk revision 201658] (GCC) 
$ gcc-trunk -O2 small.c
$ a.out
0
$ gcc-4.7 -O3 small.c
$ a.out
0
$ gcc-trunk -O3 small.c
$ a.out
-1
$ gcc-4.8 -O3 small.c
$ a.out
-1
$ 


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


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

int a, b, c, d, e, f, g, h = 1, i;

int foo (int p)
{
  return p < 0 && a < -2147483647 - 1 - p ? 0 : 1;
}

int *bar ()
{
  int j; 
  i = h ? 0 : 1 % h;
  for (j = 0; j < 1; j++)
    for (d = 0; d; d++)
      for (e = 1; e;)
    return 0;
  return 0;
}

int baz ()
{
  for (; b >= 0; b--)
    for (c = 1; c >= 0; c--)
      {
    int *k = &c;
    for (;;)
      {
        for (f = 0; f < 1; f++)
          {
        g = foo (*k);
        bar ();
          }
        if (*k)
          break;
        return 0;
      }
      }
  return 0;
}

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


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

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

Thread overview: 36+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-13  0:05 [Bug middle-end/58143] New: wrong code at -O3 on x86_64-linux-gnu su at cs dot ucdavis.edu
2013-08-13  0:08 ` [Bug middle-end/58143] " pinskia at gcc dot gnu.org
2013-08-13  0:24 ` su at cs dot ucdavis.edu
2013-08-14 21:11 ` mikpe at it dot uu.se
2013-08-20  0:21 ` bernd.edlinger at hotmail dot de
2013-08-20  0:59 ` bernd.edlinger at hotmail dot de
2013-08-20 22:25 ` bernd.edlinger at hotmail dot de
2013-08-21  8:53 ` bernd.edlinger at hotmail dot de
2013-08-21 17:41 ` [Bug tree-optimization/58143] [4.8/4.9 regression] wrong code at -O3 ebotcazou at gcc dot gnu.org
2013-08-21 18:02 ` jakub at gcc dot gnu.org
2013-08-21 21:50 ` bernd.edlinger at hotmail dot de
2013-08-23  9:15 ` bernd.edlinger at hotmail dot de
2013-08-23  9:16 ` jakub at gcc dot gnu.org
2013-08-23 12:08 ` bernd.edlinger at hotmail dot de
2013-08-23 12:59 ` jakub at gcc dot gnu.org
2013-08-25 22:08 ` bernd.edlinger at hotmail dot de
2013-08-28 21:30 ` bernd.edlinger at hotmail dot de
2013-10-15  8:15 ` rguenth at gcc dot gnu.org
2013-10-15  8:17 ` rguenth at gcc dot gnu.org
2013-10-15  8:39 ` bernd.edlinger at hotmail dot de
2013-10-15  9:05 ` rguenth at gcc dot gnu.org
2013-10-15  9:41 ` rguenth at gcc dot gnu.org
2013-10-15 11:03 ` rguenth at gcc dot gnu.org
2013-10-15 11:45 ` bernd.edlinger at hotmail dot de
2013-10-15 11:54 ` rguenth at gcc dot gnu.org
2013-10-15 11:54 ` rguenther at suse dot de
2013-10-15 13:21 ` bernd.edlinger at hotmail dot de
2013-10-15 13:27 ` rguenther at suse dot de
2013-10-15 13:36 ` mikpelinux at gmail dot com
2013-10-15 13:38 ` bernd.edlinger at hotmail dot de
2013-10-15 13:40 ` rguenther at suse dot de
2013-10-16  9:51 ` jakub at gcc dot gnu.org
2013-10-17  9:59 ` rguenth at gcc dot gnu.org
2013-10-17 10:08 ` [Bug tree-optimization/58143] [4.8 " rguenth at gcc dot gnu.org
2013-11-18 15:14 ` rguenth at gcc dot gnu.org
2013-11-18 15:15 ` 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).