Comment #6 on issue 289 by liuj...@google.com: 64 bit release build unit tests fail in MSVC 2010
http://code.google.com/p/protobuf/issues/detail?id=289

OK, so probably a bug of vc2010 x64 platform... The function in question is:

// in strutil.cc
char *InternalFastHexToBuffer(uint64 value, char* buffer, int num_byte) {
  static const char *hexdigits = "0123456789abcdef";
  buffer[num_byte] = '\0';
  for (int i = num_byte - 1; i >= 0; i--) {
    buffer[i] = hexdigits[uint32(value) & 0xf];
    value >>= 4;
  }
  return buffer;
}

More specifically, this line: hexdigits[uint32(value) & 0xf];

In release mode, due to unknown optimization, the ultimate value in the loop will be replaced by the penultimate value... That said:
0x0100000 will be 0x11000000.

A simple fix is to remove the uint32() copy constructor:

hexdigits[value & 0xf];

I don't know why the copy constructor was there though...




--
You received this message because you are subscribed to the Google Groups "Protocol 
Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.

Reply via email to