This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/31007] New: wrong 64bit constant calculation
- From: "hidden_peak at mail dot ru" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 1 Mar 2007 12:21:06 -0000
- Subject: [Bug c/31007] New: wrong 64bit constant calculation
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
#include <stdio.h>
#include <stdint.h>
int main()
{
uint64_t ui4 = ~((1ULL << 63ULL) >> 3ULL);
union {
uint64_t i64;
struct {
uint32_t lo;
uint32_t hi;
} i32;
} ui5;
ui5.i64 = ui4;
printf( "%llx %x\n", ui4, ui5.i32.hi );
return 0;
}
Return efffffffffffffff efffffff
(instead of 7fffffffffffffff 7fffffff). Appropriate expression for 32bit
constant give expected result.
--
Summary: wrong 64bit constant calculation
Product: gcc
Version: 4.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: hidden_peak at mail dot ru
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=31007