This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Big-endian Gcc on Intel IA32


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>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]