From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.redhat.com (mail.redhat.com [199.183.24.239]) by listman.redhat.com (Postfix) with ESMTP id BF5F52F34E for ; Tue, 26 Sep 2000 13:48:01 -0400 (EDT) Received: (from mail@localhost) by mail.redhat.com (8.8.7/8.8.7) id NAA28288 for axp-list@listman.redhat.com; Tue, 26 Sep 2000 13:48:01 -0400 Received: from stegosaurus.bristol.quadrics.com (stegosaurus.quadrics.com [194.202.174.3]) by mail.redhat.com (8.8.7/8.8.7) with ESMTP id NAA28282 for ; Tue, 26 Sep 2000 13:48:00 -0400 Received: by stegosaurus.bristol.quadrics.com with Internet Mail Service (5.5.2650.21) id ; Tue, 26 Sep 2000 18:47:59 +0100 Message-ID: <010C86D15E4D1247B9A5DD312B7F5AA70BEC2F@stegosaurus.bristol.quadrics.com> From: David Addison To: "'axp-list@redhat.com'" Subject: RE: Weird Compaq CCC / GCC interaction ? Date: Tue, 26 Sep 2000 18:47:55 +0100 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-Type: text/plain; charset="iso-8859-1" X-Loop: axp-list@redhat.com Sender: axp-list-admin@redhat.com Errors-To: axp-list-admin@redhat.com X-BeenThere: axp-list@redhat.com X-Mailman-Version: 2.0beta4 Precedence: bulk Reply-To: axp-list@redhat.com List-Id: Linux and Red Hat on Alpha processors It seems that the MAGIC value 0xc00fc00f is being sign extended as a negative number. Changing the printf for the working case and printing out longs instead of ints shows; GOOD baseAddr ffffffffc00fc00f == ffffffffc00fc00f Even casting MAGIC to an unsigned int doesn't make it a postive 64-bit number. Declaring it as 'const unsigned int' does though. So gcc is clearing the top 4-bytes of the return value in fn.c and so the main code compares 0x00000000c00fc00f with 0xffffffffc00fc00f in the if statement. Is there a way to define the MAGIC value unsigned ? 0xc00fc00fU doesn't seem to have any effect. Addy. > -----Original Message----- > From: Larry Sendlosky [mailto:larry@scrugs.lkg.dec.com] > Sent: 26 September 2000 18:26 > To: axp-list@redhat.com > Subject: Re: Weird Compaq CCC / GCC interaction ? > > > > > I haven't seen any of this thread, but the quoted spec is correct and > makes sense. Given the example below > > MAGIC is an unsigned int (32bits) with value 0xc00fc00f. The compiler > should generate 0x00000000c00fc00f for the register value. This is > "sign extending" an unsigned int (there is no sign bit or it's > "inferred" to be zero). > > If MAGIC was defined as int 0xc00fc00f, then the register value > should be 0xffffffffc00fc00f. int 0xc00fc00f is a negative number. > > > larry > > > > > > > > According to the Calling Standard for Alpha Systems, > Section 4.1.5 "Unused > > > Bits in Passed Data," both signed and unsigned ints > should be passed > > > sign-extended in registers. > > > > Good to know but why this convention? If I follow implications > > correctly (which is a big IF) then if I take results of > such function > > returning unsigned int, like in the example, and will cast > its result to > > long then I may get a negative number. OTOH if I do: > > > > #define MAGIC 0xc00fc00fU > > ... > > printf ("%ld\n", (long)MAGIC); > > ... > > > > then result is positive and I would be quite surprised otherwise. > > Or this Standard makes this also into a bug and expects that the > > cast above is equivalent to (long)((int)MAGIC)? If yes then again > > why? > > > > Michal > > > > > > > > _______________________________________________ > > Axp-list mailing list > > Axp-list@redhat.com > > https://listman.redhat.com/mailman/listinfo/axp-list > > > > > > ______________________________________________________________________ > Larry Sendlosky ATS > larry@scrugs.lkg.dec.com (978) 506-6640 Compaq > ---------------------------------------------------------------------- > > > > _______________________________________________ > Axp-list mailing list > Axp-list@redhat.com > https://listman.redhat.com/mailman/listinfo/axp-list >