This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/31679] Incorrect result of multiplication long long by 0xFFFFFFFFLL constant.
- From: "vlasenko at bifit dot com dot ua" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 Apr 2007 13:21:15 -0000
- Subject: [Bug target/31679] Incorrect result of multiplication long long by 0xFFFFFFFFLL constant.
- References: <bug-31679-14450@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from vlasenko at bifit dot com dot ua 2007-04-24 14:21 -------
The bug also reproduces with GCC 4.1.2 compiled under FreeBSD:
gcc -save-temps -v test.c -o test
Using built-in specs.
Target: i386-unknown-freebsd6.0
Configured with: ../gcc-4.1.2/configure --enable-languages=c
--prefix=/usr/local --enable-libmudflap
Thread model: posix
gcc version 4.1.2
/usr/local/libexec/gcc/i386-unknown-freebsd6.0/4.1.2/cc1 -E -quiet -v test.c
-fpch-preprocess -o test.i
ignoring nonexistent directory
"/usr/local/lib/gcc/i386-unknown-freebsd6.0/4.1.2/../../../../i386-unknown-freebsd6.0/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/usr/local/lib/gcc/i386-unknown-freebsd6.0/4.1.2/include
/usr/include
End of search list.
/usr/local/libexec/gcc/i386-unknown-freebsd6.0/4.1.2/cc1 -fpreprocessed test.i
-quiet -dumpbase test.c -auxbase test -version -o test.s
GNU C version 4.1.2 (i386-unknown-freebsd6.0)
compiled by GNU C version 3.4.4 [FreeBSD] 20050518.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 78c0349a459b0e74d78db4c5d7784698
as -o test.o test.s
/usr/local/libexec/gcc/i386-unknown-freebsd6.0/4.1.2/collect2 -V
-dynamic-linker /libexec/ld-elf.so.1 -o test /usr/lib/crt1.o /usr/lib/crti.o
/usr/local/lib/gcc/i386-unknown-freebsd6.0/4.1.2/crtbegin.o
-L/usr/local/lib/gcc/i386-unknown-freebsd6.0/4.1.2
-L/usr/local/lib/gcc/i386-unknown-freebsd6.0/4.1.2/../../.. test.o -lgcc
-lgcc_eh -lc -lgcc -lgcc_eh
/usr/local/lib/gcc/i386-unknown-freebsd6.0/4.1.2/crtend.o /usr/lib/crtn.o
GNU ld version 2.15 [FreeBSD] 2004-05-23
Supported emulations:
elf_i386_fbsd
test.c:
int __attribute__((__cdecl__)) printf (const char *, ...);
int main()
{
long long qhat = 1;
long long res = qhat * 0xffffffffLL;
printf("res = %llx\n", res);
}
output:
res = ffffffffffffffff
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31679