From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24623 invoked by alias); 27 May 2011 07:36:07 -0000 Received: (qmail 24499 invoked by uid 22791); 27 May 2011 07:36:05 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_BJ,TW_CX,TW_DC,TW_GX X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 27 May 2011 07:35:52 +0000 From: "iwamatsu at nigauri dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/49186] New: optimize problem with unsigned long long value. X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: iwamatsu at nigauri dot org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Fri, 27 May 2011 07:54:00 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2011-05/txt/msg02635.txt.bz2 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 #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