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 355422FA3A for ; Tue, 26 Sep 2000 13:26:19 -0400 (EDT) Received: (from mail@localhost) by mail.redhat.com (8.8.7/8.8.7) id NAA25920 for axp-list@listman.redhat.com; Tue, 26 Sep 2000 13:26:19 -0400 Received: from zmamail05.zma.compaq.com (zmamail05.zma.compaq.com [161.114.64.105]) by mail.redhat.com (8.8.7/8.8.7) with ESMTP id NAA25916 for ; Tue, 26 Sep 2000 13:26:18 -0400 Received: by zmamail05.zma.compaq.com (Postfix, from userid 12345) id C1E2B17B7; Tue, 26 Sep 2000 13:25:47 -0400 (EDT) Received: from scrugs.lkg.dec.com (scrugs.lkg.dec.com [16.24.240.5]) by zmamail05.zma.compaq.com (Postfix) with SMTP id 9CBAF27DA for ; Tue, 26 Sep 2000 13:25:47 -0400 (EDT) Received: by scrugs.lkg.dec.com (5.65v4.0/1.1.19.2/15May00-1117AM) id AA27123; Tue, 26 Sep 2000 13:25:47 -0400 Date: Tue, 26 Sep 2000 13:25:47 EDT From: Larry Sendlosky To: axp-list@redhat.com Subject: Re: Weird Compaq CCC / GCC interaction ? In-Reply-To: Your message of Tue, 26 Sep 2000 10:02:27 -0600 (MDT) Message-Id: 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 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 ----------------------------------------------------------------------