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 38ADE2F156 for ; Tue, 26 Sep 2000 04:55:44 -0400 (EDT) Received: (from mail@localhost) by mail.redhat.com (8.8.7/8.8.7) id EAA22942 for axp-list@listman.redhat.com; Tue, 26 Sep 2000 04:55:44 -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 EAA22930 for ; Tue, 26 Sep 2000 04:55:30 -0400 Received: by stegosaurus.bristol.quadrics.com with Internet Mail Service (5.5.2650.21) id ; Tue, 26 Sep 2000 09:55:14 +0100 Message-ID: <010C86D15E4D1247B9A5DD312B7F5AA70BEC27@stegosaurus.bristol.quadrics.com> From: David Addison To: "'axp-list@redhat.com'" Subject: Weird Compaq CCC / GCC interaction ? Date: Tue, 26 Sep 2000 09:55:12 +0100 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C02797.7BF7DF34" 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 This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C02797.7BF7DF34 Content-Type: text/plain; charset="iso-8859-1" Help! Am I going mad or is there something obviously wrong with my C programming skills? Here are two very simple files to compile. What I have found is that if I compile the fn.c code using gcc and ccc for the main code, it gets the wrong answer. Whereas it works if I use either ccc or gcc for both. It also works if I compile the fn.c code with ccc and main with gcc. Anyone know what's wrong ... is this a bug with ccc or gcc ? cat fn.c unsigned int fn() { return (0xc00fc00f); } cat madness.c extern unsigned int fn(); #define MAGIC 0xc00fc00f int main() { unsigned int baseAddr; baseAddr = fn(); if (baseAddr == MAGIC) printf("GOOD baseAddr %x == %x\n", baseAddr, MAGIC); else printf("BADNESS baseAddr %x != %x\n", baseAddr, MAGIC); } Then compile as follows; cc -O3 -c fn.c -o fn_gcc.o ccc -O3 -c fn.c -o fn_ccc.o ccc -O3 madness.c -o madness_gcc fn_gcc.o ccc -O3 madness.c -o madness_ccc fn_ccc.o Then run; ./madness_ccc GOOD baseAddr c00fc00f == c00fc00f ./madness_gcc BADNESS baseAddr c00fc00f != c00fc00f It starts working if I change the MAGIC constant to 0x400fc00f so that suggests sign problems ? Disassembling the fn code we see the only differences ... objdump -d fn_gcc.o fn_gcc.o: file format elf64-alpha Disassembly of section .text: 0000000000000000 : 0: 0f c0 1f 20 lda v0,-16369(zero) 4: 10 c0 00 24 ldah v0,-16368(v0) 8: 20 f6 01 48 zapnot v0,0xf,v0 c: 01 80 fa 6b ret zero,(ra),0x1 ... objdump -d fn_ccc.o fn_ccc.o: file format elf64-alpha Disassembly of section .text: 0000000000000000 : 0: 10 c0 1f 24 ldah v0,-16368(zero) 4: 1f 04 ff 47 nop 8: 0f c0 00 20 lda v0,-16369(v0) c: 01 80 fa 6b ret zero,(ra),0x1 GCC is inserting a ZAPNOT instruction to zero the top 4-bytes - is this correct ? Or is the main code compilation that is broken, I notice that ccc uses 'xor' to do the compare whereas gcc uses 'cmpeq' ? For the record, I am using Alpha RH6.1 with ccc (ccc-6.2.9.504-2) and gcc (egcs-2.91.66) Cheers, Addy. ------_=_NextPart_001_01C02797.7BF7DF34 Content-Type: text/html; charset="iso-8859-1"
Help! Am I going mad or is there something obviously wrong with my C programming skills?
 
Here are two very simple files to compile. What I have found is that if I compile the fn.c code using gcc and ccc for the main code, it gets the wrong answer. Whereas it works if I use either ccc or gcc for both. It also works if I compile the fn.c code with ccc and main with gcc.
 
Anyone know what's wrong ... is this a bug with ccc or gcc ?
 
cat fn.c
 
unsigned int fn()
{
    return (0xc00fc00f);
}
 
cat madness.c
 
extern unsigned int fn();
 
#define MAGIC 0xc00fc00f
 
int main()
{
    unsigned int baseAddr;
 
    baseAddr = fn();
 
    if (baseAddr == MAGIC)
        printf("GOOD baseAddr %x == %x\n", baseAddr, MAGIC);
    else
        printf("BADNESS baseAddr %x != %x\n", baseAddr, MAGIC);
}
Then compile as follows;
 
cc -O3 -c fn.c -o fn_gcc.o
 
ccc -O3 -c fn.c -o fn_ccc.o
 
ccc -O3 madness.c -o madness_gcc fn_gcc.o
 
ccc -O3 madness.c -o madness_ccc fn_ccc.o
 
Then run;
 
./madness_ccc
GOOD baseAddr c00fc00f == c00fc00f
./madness_gcc
BADNESS baseAddr c00fc00f != c00fc00f
 
It starts working if I change the MAGIC constant to 0x400fc00f so that suggests sign problems ?
 
Disassembling the fn code we see the only differences ...
 
objdump -d fn_gcc.o
 
fn_gcc.o:     file format elf64-alpha
 
Disassembly of section .text:
 
0000000000000000 <fn>:
   0:   0f c0 1f 20     lda     v0,-16369(zero)
   4:   10 c0 00 24     ldah    v0,-16368(v0)
   8:   20 f6 01 48     zapnot  v0,0xf,v0
   c:   01 80 fa 6b     ret     zero,(ra),0x1
        ...
objdump -d fn_ccc.o
 
fn_ccc.o:     file format elf64-alpha
 
Disassembly of section .text:
 
0000000000000000 <fn>:
   0:   10 c0 1f 24     ldah    v0,-16368(zero)
   4:   1f 04 ff 47     nop
   8:   0f c0 00 20     lda     v0,-16369(v0)
   c:   01 80 fa 6b     ret     zero,(ra),0x1
 
GCC is inserting a ZAPNOT instruction to zero the top 4-bytes - is this correct ?
Or is the main code compilation that is broken, I notice that ccc uses 'xor' to do the compare whereas gcc uses 'cmpeq' ?
 
For the record, I am using Alpha RH6.1 with ccc (ccc-6.2.9.504-2) and gcc (egcs-2.91.66)
 
 
Cheers,
Addy.
 
 

 
------_=_NextPart_001_01C02797.7BF7DF34-- 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 2C1DC2EFE2 for ; Tue, 26 Sep 2000 05:39:51 -0400 (EDT) Received: (from mail@localhost) by mail.redhat.com (8.8.7/8.8.7) id FAA24519 for axp-list@listman.redhat.com; Tue, 26 Sep 2000 05:39:51 -0400 Received: from utep.el.utwente.nl (root@utep.el.utwente.nl [130.89.30.10]) by mail.redhat.com (8.8.7/8.8.7) with ESMTP id FAA24515 for ; Tue, 26 Sep 2000 05:39:50 -0400 Received: from tn.utwente.nl (uttnb55.tn.utwente.nl [130.89.74.55]) by utep.el.utwente.nl (8.9.3/8.9.3) with ESMTP id LAA26662 for ; Tue, 26 Sep 2000 11:42:25 +0200 Message-ID: <39D06F36.795D21FB@tn.utwente.nl> Date: Tue, 26 Sep 2000 11:41:10 +0200 From: "Andrei A. Dergatchev" X-Mailer: Mozilla 4.5 [en] (Win95; I) X-Accept-Language: en,ru MIME-Version: 1.0 To: axp-list@redhat.com Subject: Re: Weird Compaq CCC / GCC interaction ? References: <010C86D15E4D1247B9A5DD312B7F5AA70BEC27@stegosaurus.bristol.quadrics.com> Content-Type: multipart/alternative; boundary="------------F6353A8BDDB8B9451996078F" 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 --------------F6353A8BDDB8B9451996078F Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi, Well, while US members of our list are not available yet, here are my humble comments. IMHO this question has little to do with C programming skills :-) Man, you're opening up a huge can of worms - linking obj files made with entirely different compilers and moreover passing unsigned ints from one to another (in C, functions return int by default). Personally, I wouldn't even expect to get it 100% working at first time. > fn_gcc.o: file format elf64-alpha Disassembly of section > .text: 0000000000000000 : > 0: 0f c0 1f 20 lda v0,-16369(zero) > 4: 10 c0 00 24 ldah v0,-16368(v0) > 8: 20 f6 01 48 zapnot v0,0xf,v0 > c: 01 80 fa 6b ret zero,(ra),0x1 > ... > objdump -d fn_ccc.o fn_ccc.o: file format elf64-alpha Disassembly > of section .text: 0000000000000000 : > 0: 10 c0 1f 24 ldah v0,-16368(zero) > 4: 1f 04 ff 47 nop > 8: 0f c0 00 20 lda v0,-16369(v0) > c: 01 80 fa 6b ret zero,(ra),0x1 > > AD> To me it seems that returned results are different in these 2 > cases. > GCC is inserting a ZAPNOT instruction to zero the top 4-bytes - is > this correct ?Or is the main code compilation that is broken, I notice > that ccc uses 'xor' to do the compare whereas gcc uses 'cmpeq' ? > Alpha Assembly Language Programmer's Guide says that cmpeq compares two *64-bit* values. I would look into that. > Cheers, > Addy. Rgds, Andrei --------------F6353A8BDDB8B9451996078F Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit Hi,

Well, while US members of our list are not available yet, here are my humble
comments.

IMHO this question has little to do with C programming skills :-)
Man, you're opening up a huge can of worms - linking obj files made
with entirely different compilers and moreover passing unsigned ints
from one to another (in C, functions return int by default).
Personally, I wouldn't even expect to get it 100% working at first time.

 fn_gcc.o:     file format elf64-alpha Disassembly of section .text: 0000000000000000 <fn>:
   0:   0f c0 1f 20     lda     v0,-16369(zero)
   4:   10 c0 00 24     ldah    v0,-16368(v0)
   8:   20 f6 01 48     zapnot  v0,0xf,v0
   c:   01 80 fa 6b     ret     zero,(ra),0x1
        ...
 objdump -d fn_ccc.o fn_ccc.o:     file format elf64-alpha Disassembly of section .text: 0000000000000000 <fn>:
   0:   10 c0 1f 24     ldah    v0,-16368(zero)
   4:   1f 04 ff 47     nop
   8:   0f c0 00 20     lda     v0,-16369(v0)
   c:   01 80 fa 6b     ret     zero,(ra),0x1

AD> To me it seems that returned results are different in these 2 cases.
  GCC is inserting a ZAPNOT instruction to zero the top 4-bytes - is this correct ?Or is the main code compilation that is broken, I notice that ccc uses 'xor' to do the compare whereas gcc uses 'cmpeq' ?
 

Alpha Assembly Language Programmer's Guide says that cmpeq compares
two *64-bit* values. I would look into that.

> Cheers,
> Addy.

Rgds,

Andrei
  --------------F6353A8BDDB8B9451996078F-- 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 42F552F1AD for ; Tue, 26 Sep 2000 06:13:24 -0400 (EDT) Received: (from mail@localhost) by mail.redhat.com (8.8.7/8.8.7) id GAA25837 for axp-list@listman.redhat.com; Tue, 26 Sep 2000 06:13:24 -0400 Received: from snowball.ucd.ie (snowball.ucd.ie [193.1.132.97]) by mail.redhat.com (8.8.7/8.8.7) with ESMTP id GAA25832 for ; Tue, 26 Sep 2000 06:13:22 -0400 Received: from genie.ucd.ie ([193.1.132.80]:18949 "EHLO genie.ucd.ie") by snowball.ucd.ie with ESMTP id ; Tue, 26 Sep 2000 11:12:52 +0100 Received: by genie.ucd.ie with local (Exim 3.03 #1 (Debian)) id 13drjI-0004ci-00 for ; Tue, 26 Sep 2000 11:12:52 +0100 Date: Tue, 26 Sep 2000 11:12:52 +0100 To: axp-list@redhat.com Subject: Re: Weird Compaq CCC / GCC interaction ? Message-ID: <20000926111252.A17671@snowball.ucd.ie> References: <010C86D15E4D1247B9A5DD312B7F5AA70BEC27@stegosaurus.bristol.quadrics.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <010C86D15E4D1247B9A5DD312B7F5AA70BEC27@stegosaurus.bristol.quadrics.com>; from addy@quadrics.com on Tue, Sep 26, 2000 at 09:55:12AM +0100 From: Nikita Schmidt 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 On Tuesday, 26 Sep, David Addison wrote: > > Anyone know what's wrong ... is this a bug with ccc or gcc ? > This looks like a bug in gcc - see below why. > cat fn.c > > unsigned int fn() > { > return (0xc00fc00f); > } > [...] > > objdump -d fn_gcc.o > > fn_gcc.o: file format elf64-alpha > > Disassembly of section .text: > > 0000000000000000 : > 0: 0f c0 1f 20 lda v0,-16369(zero) > 4: 10 c0 00 24 ldah v0,-16368(v0) > 8: 20 f6 01 48 zapnot v0,0xf,v0 > c: 01 80 fa 6b ret zero,(ra),0x1 > ... > > objdump -d fn_ccc.o > > fn_ccc.o: file format elf64-alpha > > Disassembly of section .text: > > 0000000000000000 : > 0: 10 c0 1f 24 ldah v0,-16368(zero) > 4: 1f 04 ff 47 nop > 8: 0f c0 00 20 lda v0,-16369(v0) > c: 01 80 fa 6b ret zero,(ra),0x1 > > > GCC is inserting a ZAPNOT instruction to zero the top 4-bytes - is this > correct ? 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. Gcc is compatible with itself, but not with any other compiler which follows the documented conventions. If gcc claims to be standards compliant, this is a bug; please submit a report. Nikita 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 3578B2F34E for ; Tue, 26 Sep 2000 08:23:13 -0400 (EDT) Received: (from mail@localhost) by mail.redhat.com (8.8.7/8.8.7) id IAA30464 for axp-list@listman.redhat.com; Tue, 26 Sep 2000 08:23:13 -0400 Received: from jurassic.park.msu.ru (jurassic.park.msu.ru [195.208.223.243]) by mail.redhat.com (8.8.7/8.8.7) with ESMTP id IAA30459 for ; Tue, 26 Sep 2000 08:23:10 -0400 Received: (from ink@localhost) by jurassic.park.msu.ru (8.9.3/8.9.3) id QAA00937 for axp-list@redhat.com; Tue, 26 Sep 2000 16:23:01 +0400 Date: Tue, 26 Sep 2000 16:23:01 +0400 From: Ivan Kokshaysky To: axp-list@redhat.com Subject: Re: Weird Compaq CCC / GCC interaction ? Message-ID: <20000926162301.A846@jurassic.park.msu.ru> References: <010C86D15E4D1247B9A5DD312B7F5AA70BEC27@stegosaurus.bristol.quadrics.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2i In-Reply-To: <010C86D15E4D1247B9A5DD312B7F5AA70BEC27@stegosaurus.bristol.quadrics.com>; from addy@quadrics.com on Tue, Sep 26, 2000 at 09:55:12AM +0100 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 On Tue, Sep 26, 2000 at 09:55:12AM +0100, David Addison wrote: > 0000000000000000 : > 0: 0f c0 1f 20 lda v0,-16369(zero) > 4: 10 c0 00 24 ldah v0,-16368(v0) > 8: 20 f6 01 48 zapnot v0,0xf,v0 > c: 01 80 fa 6b ret zero,(ra),0x1 > ... > What gcc version? fn: .frame $30,0,$26,0 .prologue 0 ldah $0,-16368 lda $0,-16369($0) ret $31,($26),1 .end fn .ident "GCC: (GNU) 2.96 20000911 (experimental)" Ivan. 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 1F4322FECE for ; Tue, 26 Sep 2000 09:57:49 -0400 (EDT) Received: (from mail@localhost) by mail.redhat.com (8.8.7/8.8.7) id JAA03430 for axp-list@listman.redhat.com; Tue, 26 Sep 2000 09:57:48 -0400 Received: from jurassic.park.msu.ru (jurassic.park.msu.ru [195.208.223.243]) by mail.redhat.com (8.8.7/8.8.7) with ESMTP id JAA03401 for ; Tue, 26 Sep 2000 09:57:38 -0400 Received: (from ink@localhost) by jurassic.park.msu.ru (8.9.3/8.9.3) id RAA14661 for axp-list@redhat.com; Tue, 26 Sep 2000 17:57:27 +0400 Date: Tue, 26 Sep 2000 17:57:27 +0400 From: Ivan Kokshaysky To: axp-list@redhat.com Subject: Re: Weird Compaq CCC / GCC interaction ? Message-ID: <20000926175727.A11409@jurassic.park.msu.ru> References: <010C86D15E4D1247B9A5DD312B7F5AA70BEC27@stegosaurus.bristol.quadrics.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2i In-Reply-To: <010C86D15E4D1247B9A5DD312B7F5AA70BEC27@stegosaurus.bristol.quadrics.com>; from addy@quadrics.com on Tue, Sep 26, 2000 at 09:55:12AM +0100 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 On Tue, Sep 26, 2000 at 09:55:12AM +0100, David Addison wrote: ... > For the record, I am using Alpha RH6.1 with ccc (ccc-6.2.9.504-2) and gcc > (egcs-2.91.66) > Oops, overlooked that, sorry. I've just checked, gcc-2.95.2 has this bug too. So live with it or upgrade to gcc-2.96... Ivan. 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 4AA692FF10 for ; Tue, 26 Sep 2000 09:59:59 -0400 (EDT) Received: (from mail@localhost) by mail.redhat.com (8.8.7/8.8.7) id JAA03665 for axp-list@listman.redhat.com; Tue, 26 Sep 2000 09:59:59 -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 JAA03661 for ; Tue, 26 Sep 2000 09:59:58 -0400 Received: by stegosaurus.bristol.quadrics.com with Internet Mail Service (5.5.2650.21) id ; Tue, 26 Sep 2000 14:59:56 +0100 Message-ID: <010C86D15E4D1247B9A5DD312B7F5AA70BEC29@stegosaurus.bristol.quadrics.com> From: David Addison To: "'axp-list@redhat.com'" Subject: RE: Weird Compaq CCC / GCC interaction ? Date: Tue, 26 Sep 2000 14:59:54 +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 The one that is standard with RH6.1 on Alpha - i.e. egcs-1.1.2-24 gcc -v Reading specs from /usr/lib/gcc-lib/alpha-redhat-linux/egcs-2.91.66/specs gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release) On RH6.2 they're upto egcs-1.1.2-30 but I doubt that's got the fix in it. Where can I get RPMs of more recent compilers ? I just tried RH7.0 (gcc 2.96 based I think) but there is no Alpha release yet. Cheers, Addy > -----Original Message----- > From: Ivan Kokshaysky [mailto:ink@jurassic.park.msu.ru] > Sent: 26 September 2000 13:23 > To: axp-list@redhat.com > Subject: Re: Weird Compaq CCC / GCC interaction ? > > > On Tue, Sep 26, 2000 at 09:55:12AM +0100, David Addison wrote: > > 0000000000000000 : > > 0: 0f c0 1f 20 lda v0,-16369(zero) > > 4: 10 c0 00 24 ldah v0,-16368(v0) > > 8: 20 f6 01 48 zapnot v0,0xf,v0 > > c: 01 80 fa 6b ret zero,(ra),0x1 > > ... > > > > What gcc version? > > fn: > .frame $30,0,$26,0 > .prologue 0 > ldah $0,-16368 > lda $0,-16369($0) > ret $31,($26),1 > .end fn > .ident "GCC: (GNU) 2.96 20000911 (experimental)" > > > Ivan. > > > > _______________________________________________ > Axp-list mailing list > Axp-list@redhat.com > https://listman.redhat.com/mailman/listinfo/axp-list > 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 F21CA2F662 for ; Tue, 26 Sep 2000 11:37:00 -0400 (EDT) Received: (from mail@localhost) by mail.redhat.com (8.8.7/8.8.7) id LAA13618 for axp-list@listman.redhat.com; Tue, 26 Sep 2000 11:37:00 -0400 Received: from jurassic.park.msu.ru (jurassic.park.msu.ru [195.208.223.243]) by mail.redhat.com (8.8.7/8.8.7) with ESMTP id LAA13610 for ; Tue, 26 Sep 2000 11:36:59 -0400 Received: (from ink@localhost) by jurassic.park.msu.ru (8.9.3/8.9.3) id TAA14982 for axp-list@redhat.com; Tue, 26 Sep 2000 19:36:41 +0400 Date: Tue, 26 Sep 2000 19:36:41 +0400 From: Ivan Kokshaysky To: axp-list@redhat.com Subject: Re: Weird Compaq CCC / GCC interaction ? Message-ID: <20000926193641.A14883@jurassic.park.msu.ru> References: <010C86D15E4D1247B9A5DD312B7F5AA70BEC29@stegosaurus.bristol.quadrics.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2i In-Reply-To: <010C86D15E4D1247B9A5DD312B7F5AA70BEC29@stegosaurus.bristol.quadrics.com>; from addy@quadrics.com on Tue, Sep 26, 2000 at 02:59:54PM +0100 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 On Tue, Sep 26, 2000 at 02:59:54PM +0100, David Addison wrote: > Where can I get RPMs of more recent compilers ? > Look at ftp.redhat.com/rawhide (or mirrors), there were some gcc-2.96 rpms last time I checked. Ivan. 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 5BE1D2FA9F for ; Tue, 26 Sep 2000 12:02:36 -0400 (EDT) Received: (from mail@localhost) by mail.redhat.com (8.8.7/8.8.7) id MAA16510 for axp-list@listman.redhat.com; Tue, 26 Sep 2000 12:02:36 -0400 Received: from ellpspace.math.ualberta.ca (michal@ellpspace.math.ualberta.ca [129.128.88.19]) by mail.redhat.com (8.8.7/8.8.7) with ESMTP id MAA16505 for ; Tue, 26 Sep 2000 12:02:35 -0400 Received: (from michal@localhost) by ellpspace.math.ualberta.ca (8.9.3/8.9.3) id KAA11797 for axp-list@redhat.com; Tue, 26 Sep 2000 10:02:28 -0600 From: Michal Jaegermann Message-Id: <200009261602.KAA11797@ellpspace.math.ualberta.ca> Subject: Re: Weird Compaq CCC / GCC interaction ? To: axp-list@redhat.com Date: Tue, 26 Sep 2000 10:02:27 -0600 (MDT) In-Reply-To: <20000926111252.A17671@snowball.ucd.ie> from "Nikita Schmidt" at Sep 26, 2000 11:12:52 AM X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 > > 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 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 ---------------------------------------------------------------------- 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 > 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 0D2BB2F3F1 for ; Tue, 26 Sep 2000 14:01:58 -0400 (EDT) Received: (from mail@localhost) by mail.redhat.com (8.8.7/8.8.7) id OAA29693 for axp-list@listman.redhat.com; Tue, 26 Sep 2000 14:01:57 -0400 Received: from ellpspace.math.ualberta.ca (michal@ellpspace.math.ualberta.ca [129.128.88.19]) by mail.redhat.com (8.8.7/8.8.7) with ESMTP id OAA29689 for ; Tue, 26 Sep 2000 14:01:56 -0400 Received: (from michal@localhost) by ellpspace.math.ualberta.ca (8.9.3/8.9.3) id MAA12087 for axp-list@redhat.com; Tue, 26 Sep 2000 12:01:46 -0600 From: Michal Jaegermann Message-Id: <200009261801.MAA12087@ellpspace.math.ualberta.ca> Subject: Re: Weird Compaq CCC / GCC interaction ? To: axp-list@redhat.com Date: Tue, 26 Sep 2000 12:01:45 -0600 (MDT) In-Reply-To: from "Larry Sendlosky" at Sep 26, 2000 01:25:47 PM X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 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. Michal 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 ---------------------------------------------------------------------- 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 47A9D2FF41 for ; Tue, 26 Sep 2000 23:17:29 -0400 (EDT) Received: (from mail@localhost) by mail.redhat.com (8.8.7/8.8.7) id XAA09450 for axp-list@listman.redhat.com; Tue, 26 Sep 2000 23:17:29 -0400 Received: from piglet.twiddle.net (piglet.twiddle.net [207.104.6.26]) by mail.redhat.com (8.8.7/8.8.7) with ESMTP id XAA09446 for ; Tue, 26 Sep 2000 23:17:28 -0400 Received: (from rth@localhost) by piglet.twiddle.net (8.9.3/8.9.3) id UAA10670 for axp-list@redhat.com; Tue, 26 Sep 2000 20:17:34 -0700 Date: Tue, 26 Sep 2000 20:17:34 -0700 From: Richard Henderson To: axp-list@redhat.com Subject: Re: Weird Compaq CCC / GCC interaction ? Message-ID: <20000926201734.A10667@twiddle.net> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0pre3us In-Reply-To: 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 On Tue, Sep 26, 2000 at 01:25:47PM -0400, Larry Sendlosky wrote: > 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). Incorrect. The calling conventions specify that bit 31 of a 32-bit value should be replicated up. We choose this form because this is what the 32-bit arithmetic and memory load instructions do, so oft times we need perform no extra work. Basicly, one should choose *some* canonical form for 32-bit data in your 64-bit registers. Sign extending happens to be easiest on Alpha. Failure to do so results in catastrophic failure in the face of missing or incorrect prototypes -- all too common in source code even today. Anyway, the gcc problem was brought to my attention by Steve Hobbes from the Compaq compiler group back in January. It's been fixed since, though I guess that's well after 2.95 was released. r~