public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "chenyang at cs dot utah dot edu" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/42006]  New: Termination problem with -O2 and -O3
Date: Wed, 11 Nov 2009 06:29:00 -0000	[thread overview]
Message-ID: <bug-42006-18350@http.gcc.gnu.org/bugzilla/> (raw)

Using r154087, the code below never terminates with -O2 and -O3. 

yang@yang-working:~$ svngcc -O2 -o small2 small.c
yang@yang-working:~$ ./small2
1
1
...
yang@yang-working:~$ ./small1
1
2
exit!
yang@yang-working:~$ cat small.c
#include <stdio.h>

static int
my_add(int si1, int si2)
{
    return (si1 > (50-si2)) ? si1 : (si1 + si2);
}

static unsigned int
my_shift(unsigned int left, int right)
{
  return  (right > 100) ? left : (left >> right);
}

static int func_4(unsigned int p_6)
{
    for (p_6 = 1; p_6 < 3; p_6 = my_add(p_6, 1))
    {
            printf ("%d\n", p_6);
            if (my_shift(p_6, p_6))
            {
                return 0;
            }
    }
    return 0;
}

int main(void)
{
    func_4(0);
    printf("exit!\n");
    return 0;
}

yang@yang-working:~$ svngcc -v
Using built-in specs.
COLLECT_GCC=svngcc
COLLECT_LTO_WRAPPER=/home/yang/compilers/libexec/gcc/i686-pc-linux-gnu/4.5.0/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: ../configure --enable-lto --prefix=/home/yang/compilers
--program-prefix=svn --enable-languages=c,c++
--with-libelf=/home/yang/compilers : (reconfigured) ../configure --enable-lto
--prefix=/home/yang/compilers --program-prefix=svn
--with-libelf=/home/yang/compilers --enable-languages=c,lto,c++ --no-create
--no-recursion : (reconfigured) ../configure --enable-lto
--prefix=/home/yang/compilers --program-prefix=svn
--with-libelf=/home/yang/compilers --enable-languages=c,c++,lto --no-create
--no-recursion : (reconfigured) ../configure --enable-lto
--prefix=/home/yang/compilers --program-prefix=svn
--with-libelf=/home/yang/compilers --enable-languages=c,c++,lto --no-create
--no-recursion : (reconfigured) ../configure --enable-lto
--prefix=/home/yang/compilers --program-prefix=svn
--with-libelf=/home/yang/compilers --enable-languages=c,c++,lto --no-create
--no-recursion
Thread model: posix
gcc version 4.5.0 20091110 (experimental) (GCC)


-- 
           Summary: Termination problem with -O2 and -O3
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: chenyang at cs dot utah dot edu
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


             reply	other threads:[~2009-11-11  6:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-11  6:29 chenyang at cs dot utah dot edu [this message]
2009-11-11 20:35 ` [Bug c/42006] [4.5 Regression] " rguenth at gcc dot gnu dot org
2009-11-27 11:18 ` [Bug middle-end/42006] " rguenth at gcc dot gnu dot org
2009-11-27 14:18 ` rguenth at gcc dot gnu dot org
2009-11-27 18:46 ` jamborm at gcc dot gnu dot org
2009-11-27 22:35 ` jamborm at gcc dot gnu dot org
2009-11-27 22:35 ` jamborm at gcc dot gnu dot org
2009-12-11 23:39 ` hjl at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-42006-18350@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).