From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id RAA13517; Sat, 20 Dec 2003 17:45:25 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id RAA20084 for ; Sat, 20 Dec 2003 17:45:24 +0100 (MET) Received: from biscayne-one-station.mit.edu (BISCAYNE-ONE-STATION.MIT.EDU [18.7.7.80]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id hBKGjMH03309; Sat, 20 Dec 2003 17:45:22 +0100 (MET) Received: from manawatu-mail-centre.mit.edu (MANAWATU-MAIL-CENTRE.MIT.EDU [18.7.7.71]) by biscayne-one-station.mit.edu (8.12.4/8.9.2) with ESMTP id hBKGjMvr012324; Sat, 20 Dec 2003 11:45:22 -0500 (EST) Received: from psi-phi.mit.edu (PSI-PHI.MIT.EDU [18.187.1.35]) (authenticated bits=56) (User authenticated as jfc@ATHENA.MIT.EDU) by manawatu-mail-centre.mit.edu (8.12.4/8.12.4) with ESMTP id hBKGjL8e008981; Sat, 20 Dec 2003 11:45:21 -0500 (EST) Received: (from jfc@localhost) by psi-phi.mit.edu (8.12.9) id hBKGjLEo029371; Sat, 20 Dec 2003 11:45:21 -0500 Message-Id: <200312201645.hBKGjLEo029371@psi-phi.mit.edu> To: Xavier Leroy cc: caml-list@inria.fr Subject: Re: [Caml-list] Re: Marshalling tests fail on AMD x86_64 (Opteron). (PR#1979) In-Reply-To: Your message of "Sat, 20 Dec 2003 12:30:04 +0100." <20031220123004.A9913@pauillac.inria.fr> Date: Sat, 20 Dec 2003 11:45:21 -0500 From: John Carr X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 marshalling:01 1979:99 jfc:01 bug:01 gcc:01 unspecified:01 int':01 int':01 char:01 promotes:99 gcc:01 bug:01 computed:01 int:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > 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