This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

egcs-1.1b uint64_t alpha miscompile



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]