public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/54027] New: possible mis-optimization of signed left shift in c89 mode
@ 2012-07-19  4:24 regehr at cs dot utah.edu
  2012-07-19 10:07 ` [Bug c/54027] " rguenth at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: regehr at cs dot utah.edu @ 2012-07-19  4:24 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 54027
           Summary: possible mis-optimization of signed left shift in c89
                    mode
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: regehr@cs.utah.edu


The program below is clearly undefined in C99, but I'm not sure that it should
be undefined in C89 mode.

GCC pre-4.8.0 turns the code into an infinite loop even in C89 mode at -O2 and
higher.

regehr@home:~/svn/code$ cat shift.c
int main (void)
{
  int x = 1;
  while (x)
    x <<= 1;
  return x;
}
regehr@home:~/svn/code$ gcc -O2 -std=c89 shift.c ; ./a.out 
^C
regehr@home:~/svn/code$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/regehr/z/compiler-install/gcc-r189449-install/libexec/gcc/x86_64-unknown-linux-gnu/4.8.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /home/regehr/z/compiler-source/gcc/configure
--with-libelf=/usr/local --enable-lto
--prefix=/home/regehr/z/compiler-install/gcc-r189449-install
--enable-languages=c,c++
Thread model: posix
gcc version 4.8.0 20120713 (experimental) (GCC)


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

end of thread, other threads:[~2012-08-10  8:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-19  4:24 [Bug c/54027] New: possible mis-optimization of signed left shift in c89 mode regehr at cs dot utah.edu
2012-07-19 10:07 ` [Bug c/54027] " rguenth at gcc dot gnu.org
2012-07-19 15:08 ` joseph at codesourcery dot com
2012-07-20  9:38 ` [Bug tree-optimization/54027] [4.8 Regression] " rguenth at gcc dot gnu.org
2012-08-09 13:31 ` markus at trippelsdorf dot de
2012-08-10  8:34 ` rguenth at gcc dot gnu.org
2012-08-10  8:39 ` 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).