Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Re: Marshalling tests fail on AMD x86_64 (Opteron). (PR#1979)
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: John Carr <jfc@M...>
Subject: Re: [Caml-list] Re: Marshalling tests fail on AMD x86_64 (Opteron). (PR#1979)

> The first test failure is either a bug in gcc or an unspecified
> behavior of C that I wasn't aware of.  Basically, some stuff is
> computed with type 'unsigned int', stored in an 'unsigned long'
> variable, and compared against an 'unsigned int' constant.

It isn't generated with type unsigned int.  The read32u macro
in the attached file yields an int, not an unsigned int, because
(unsigned char) promotes to (signed int).  If I change "long" to
"long long" in the attached file and compile with gcc on x86 the
program prints "Bug".

This is your macro definition:

#define read32u() \
  (src += 4, \
   (src[-4] << 24) + (src[-3] << 16) + (src[-2] << 8) + src[-1])

Try adding a cast:

#define read32u() \
  (src += 4, \
   (unsigned int)((src[-4] << 24) + (src[-3] << 16) + (src[-2] << 8) + src[-1]))

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners