From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20797 invoked by alias); 17 Dec 2001 22:12:12 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 20773 invoked from network); 17 Dec 2001 22:12:11 -0000 Received: from unknown (HELO mel-rti18.wanadoo.fr) (193.252.19.34) by sources.redhat.com with SMTP; 17 Dec 2001 22:12:11 -0000 Received: from mel-rta9.wanadoo.fr (193.252.19.69) by mel-rti18.wanadoo.fr; 17 Dec 2001 23:12:10 +0100 Received: from ulmo.localdomain (193.253.192.44) by mel-rta9.wanadoo.fr; 17 Dec 2001 23:11:45 +0100 Received: (from guerby@localhost) by ulmo.localdomain (8.11.6/8.11.6) id fBHM17w03260; Mon, 17 Dec 2001 23:01:07 +0100 Date: Mon, 17 Dec 2001 14:22:00 -0000 Message-Id: <200112172201.fBHM17w03260@ulmo.localdomain> X-Authentication-Warning: ulmo.localdomain: guerby set sender to guerby@acm.org using -f From: To: torvalds@transmeta.com CC: dewar@gnat.com, gcc@gcc.gnu.org In-reply-to: (message from Linus Torvalds on Mon, 17 Dec 2001 13:40:04 -0800 (PST)) Subject: Re: Big-endian Gcc on Intel IA32 Reply-to: guerby@acm.org References: X-SW-Source: 2001-12/txt/msg00948.txt.bz2 Linus, your "tainting" looks like static typing to me :). $ gnatgcc -c -gnatl tmp/p.adb GNAT 3.13p (20000509) Copyright 1992-2000 Free Software Foundation, Inc. Compiling: tmp/p.adb (source file time stamp: 2001-12-17 21:42:24) 1. procedure P is 2. 3. type User_Ptr is access all Character; 4. type Kernel_Ptr is access all Character; 5. 6. X : User_Ptr; 7. Y : Kernel_Ptr; 8. 9. begin 10. X := Y; | >>> expected type "User_Ptr" defined at line 3 >>> found type "Kernel_Ptr" defined at line 4 11. end P; 11 lines: 2 errors As for low level representation and convertion issues, Ada already handles array Packing (packed, not packed), array Convention (Fortran and others) for arrays, and elaborated representation clauses for records. procedure P2 is type R1 is record A, B : Character; end record; type R1_AB is new R1; for R1_AB use record A at 0 range 0 ..7; B at 0 range 8 .. 15; end record; for R1_AB'Size use 16; type R1_BA is new R1; for R1_BA use record A at 0 range 8 .. 15; B at 0 range 0 ..7; end record; for R1_BA'Size use 16; X_AB : R1_AB; X_BA : R1_BA; begin X_AB := ('A', 'B'); X_BA := R1_BA (X_AB); -- compiler does the work -- X_BA := X_AB; -- Illegal end P2; Never looked at the quality of the generated code though :). The document mentionned by Robert looks at the issues of adding bit ordering in the existing Ada bag of tricks in the area. PS: You can always escape fascist compiler typing with Unchecked_Convertion in Ada. -- Laurent Guerby