This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Big-endian Gcc on Intel IA32
- From: <guerby at acm dot org>
- To: torvalds at transmeta dot com
- Cc: dewar at gnat dot com, gcc at gcc dot gnu dot org
- Date: Mon, 17 Dec 2001 23:01:07 +0100
- Subject: Re: Big-endian Gcc on Intel IA32
- References: <Pine.LNX.4.33.0112171322170.1587-100000@penguin.transmeta.com>
- Reply-to: guerby at acm dot org
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 <guerby@acm.org>