public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/49186] New: optimize problem with unsigned long long value.
@ 2011-05-27  7:54 iwamatsu at nigauri dot org
  2011-05-27  8:59 ` [Bug target/49186] " rguenth at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: iwamatsu at nigauri dot org @ 2011-05-27  7:54 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: optimize problem with unsigned long long value.
           Product: gcc
           Version: 4.6.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: iwamatsu@nigauri.org
                CC: kkojima@gcc.gnu.org
              Host: sh4-linux-gnu
            Target: sh4-linux-gnu
             Build: sh4-linux-gnu


Hi,

I found optimize problem with unsigned long long value.
I confirmed on gcc-4.4 and 4.6 on debian.


$ gcc-4.4 -v
Using built-in specs.
Target: sh4-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.4.6-3'
--with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.4 --enable-shared --enable-multiarch
--with-multiarch-defaults=sh4-linux-gnu --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4
--libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug
--enable-objc-gc --with-multilib-list=m4,m4-nofpu --with-cpu=sh4
--enable-checking=release --build=sh4-linux-gnu --host=sh4-linux-gnu
--target=sh4-linux-gnu
Thread model: posix
gcc version 4.4.6 (Debian 4.4.6-3) 
$ gcc-4.6 -v
Using built-in specs.
COLLECT_GCC=gcc-4.6
COLLECT_LTO_WRAPPER=/usr/lib/gcc/sh4-linux-gnu/4.6.1/lto-wrapper
Target: sh4-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.6.0-6'
--with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.6 --enable-shared --enable-multiarch
--with-multiarch-defaults=sh4-linux-gnu --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6
--libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-plugin --enable-objc-gc
--with-multilib-list=m4,m4-nofpu --with-cpu=sh4 --enable-checking=release
--build=sh4-linux-gnu --host=sh4-linux-gnu --target=sh4-linux-gnu
Thread model: posix
gcc version 4.6.1 20110428 (prerelease) (Debian 4.6.0-6) 

$ cat a.c
#include <stdio.h>
#define Size_t size_t
#define MEM_SIZE Size_t
typedef MEM_SIZE STRLEN;

int main(void)
{
  int x = 13;
  unsigned long long uv = 0x1000000001ULL;
  if (x > (STRLEN)( (uv) < 0x80 ? 1 : (uv) < 0x800 ? 2 : (uv) < 0x10000 ? 3 :
(uv) < 0x200000 ? 4 : (uv) < 0x4000000 ? 5 : (uv) < 0x80000000 ? 6 : (uv) <
0x1000000000ULL ? 7 : 13 ))
    return 1;

  return 0;
}
$ gcc-4.4 -o a a.c 
$ ./a ; echo $?
1
$ gcc-4.4 -o a a.c -O1
$ ./a ; echo $?
0
$ gcc-4.6 -o a a.c     
$ ./a ; echo $?
1
$ gcc-4.6 -o a a.c -O2
$ ./a ; echo $?
0


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

end of thread, other threads:[~2011-06-05 21:57 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-27  7:54 [Bug c/49186] New: optimize problem with unsigned long long value iwamatsu at nigauri dot org
2011-05-27  8:59 ` [Bug target/49186] " rguenth at gcc dot gnu.org
2011-05-27 21:50 ` kkojima at gcc dot gnu.org
2011-05-27 21:59 ` kkojima at gcc dot gnu.org
2011-05-30  5:37 ` iwamatsu at nigauri dot org
2011-05-30  6:14 ` kkojima at gcc dot gnu.org
2011-06-05 21:48 ` kkojima at gcc dot gnu.org
2011-06-05 21:51 ` kkojima at gcc dot gnu.org
2011-06-05 21:54 ` kkojima at gcc dot gnu.org
2011-06-05 21:56 ` kkojima at gcc dot gnu.org
2011-06-05 21:57 ` kkojima 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).