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 22CB22F426 for ; Tue, 26 Sep 2000 14:53:20 -0400 (EDT) Received: (from mail@localhost) by mail.redhat.com (8.8.7/8.8.7) id OAA02451 for axp-list@listman.redhat.com; Tue, 26 Sep 2000 14:53:20 -0400 Received: from ztxmail04.ztx.compaq.com (ztxmail04.ztx.compaq.com [161.114.1.208]) by mail.redhat.com (8.8.7/8.8.7) with ESMTP id OAA02445 for ; Tue, 26 Sep 2000 14:53:19 -0400 Received: by ztxmail04.ztx.compaq.com (Postfix, from userid 12345) id B07BF1937; Tue, 26 Sep 2000 13:52:48 -0500 (CDT) Received: from scrugs.lkg.dec.com (scrugs.lkg.dec.com [16.24.240.5]) by ztxmail04.ztx.compaq.com (Postfix) with SMTP id 336F11B2E for ; Tue, 26 Sep 2000 13:52:48 -0500 (CDT) Received: by scrugs.lkg.dec.com (5.65v4.0/1.1.19.2/15May00-1117AM) id AA01528; Tue, 26 Sep 2000 14:52:47 -0400 Date: Tue, 26 Sep 2000 14:52: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 12:01:45 -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 don't have the original quote from the spec, but I believe it said: Signed and unsigned 32bit integers should be signed extended into a 64bit register. That is the example I gave in my previous message (below). A function that returns an unsigned int, as far as the caller is concerned, returns 32bits of data to be treated as an unsigned int. One could argue that it doesn't matter what the "upper" 32bits in the 64bit R0 contain as long as the compiler only uses the "lower" 32bits as an unsigned int in subsequent usage by the caller's code. The signed extension is a must so that arithmetic ops on 32bit values work as one would expect when done in 64bit registers. That's all the standard/spec requires. > Larry Sendlosky wrote: > > > > > > 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). > > That was really the question. The standard which we are talking about > seems to imply that a return value from an unsigned int function should > be 0xffffffffc00fc00f and not 0x00000000c00fc00f although you will > notice that only after a cast to long. gcc, save the latest stuff, > does what you describe above and this is non-conforming, if I understand > correctly what was said here. I was curious about further implications. > I don't belive the spec attempts to specify the "format" of a 32bit value placed in R0 when returning from a function. As long as the compiler "does the right thing" with the "lower" 32bits in the caller's code. However, the Alpha "calling standard" may specify the format. I've been talking about the Alpha SRM which describes the representation of 32bit values in 64bit registers. Can one of you send me the original problem privately? So I can see what started all this. thanks larry ______________________________________________________________________ Larry Sendlosky ATS larry@scrugs.lkg.dec.com (978) 506-6640 Compaq ----------------------------------------------------------------------