This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
egcs-1.1b uint64_t alpha miscompile
- To: egcs-bugs at cygnus dot com
- Subject: egcs-1.1b uint64_t alpha miscompile
- From: a sun <asun at saul5 dot u dot washington dot edu>
- Date: Fri, 25 Sep 1998 09:20:10 -0700 (PDT)
consider the following code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
getval(char *buf)
{
u_int64_t val;
val = 0xf87ac000000000;
printf("val = %lX\n", val);
memcpy(buf, &val, sizeof(val));
memcpy(&val, buf, sizeof(val));
printf("val = %lX\n", val);
}
int main()
{
char buf[100];
getval(buf);
}
on my udb, it prints out two values for val if i compile with
-O. needless to say, using 32-bit values, doing the memcpy's within
main(), and compiling without -O all work fine. given that alpha's are
natively 64-bit, i was a little shocked to see this pop up.
anyways, is this a known egcs problem that's hopefully already fixed?
some specifics:
RH 5.1/axp w/ glibc-2.0.7-13
gcc version egcs-2.91.57 19980901 (egcs-1.1 release) w/ haifa
scheduling enabled
-a