This is the mail archive of the gcc-patches@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: [Ada] GIGI adjustments/fixes


Arnaud Charlet <charlet@adacore.com> writes:

> Testcase:
> --  Compile and run this, expected to output nothing:
> --  $ gnatmake -f p.adb && ./p
> --  $
> --  Without the bug fix, it raises Program_Error because the assignment to
> --  Block.Vkey clobbers part of Block.Data:
> --  $ gnatmake -f p.adb && ./p
> --  [...]
> --  raised PROGRAM_ERROR : p.adb:62 explicit raise
> 
> with Ada.Text_Io; use Ada.Text_Io;
> procedure P is

 These test cases are really nice to have.  However, would it b e possible to
get more descriptive names than P for all of the procedure/package names?
 
>    type Uint16_T is range 0 .. 2 ** 16 - 1; for Uint16_T'Size use 16;
>    type Uint32_T is range 0 .. 2 ** 32 - 1; for Uint32_T'Size use 32;
> 
>    type Key_T is record A, B, C : Uint32_T; end record;
>    Key_Bits : constant := 3 * 32; for Key_T'Size use Key_Bits;
>    Null_Key : constant Key_T := (A => 0, B => 0, C => 0);
> 
>    type Vkey_T is record Key : Key_T; Value : Uint16_T; end record;
> 
>    for Vkey_T use record
>       Key   at 0            range 0 .. Key_Bits - 1;
>       Value at Key_Bits / 8 range 0 .. 16 - 1;
>    end record;
> 
>    Vkey_Bits : constant := Key_Bits + 16; for Vkey_T'Size use Vkey_Bits;
>    Null_Vkey  : constant Vkey_T := (Key => Null_Key, Value => 0);
> 
>    type Data_Block_T (Valid : Boolean) is record
>       Vkey : Vkey_T; Data : Uint32_T;
>    end record;
> 
>    for Data_Block_T use  record
>       Valid at 0 range 0 .. 7;
>       Vkey  at 4                 range 0 .. Vkey_Bits - 1;
>       Data  at 4 + Vkey_Bits / 8 range 0 .. 32 - 1;
>    end record;
> 
>    Block : Data_Block_T (Valid => True);
> 
> begin
>    Block.Data := 333; Block.Vkey := Null_Vkey;
>    if Block.Data /= 333 then raise Program_Error; end if;
> end P;
> 
> 
> 2004-12-07  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
> 	    Olivier Hainque  <hainque@adacore.com>
> 	    Eric Botcazou  <ebotcazou@adacore.com>
> 
> 	* decl.c (maybe_pad_type): Use TYPE_SIZE_UNIT of the input type for
> 	TYPE_SIZE_UNIT of result type if SIZE is not specified.
> 	(make_aligning_type): Pass -1 as ADDRESSABLE to prevent the creation
> 	of a bitfield, which we know is useless and causes trouble because of
> 	alignment implications.
> 
> 	* utils.c (create_var_decl): Set DECL_COMMON again on targets without
> 	BSS sections.
> 	(process_attributes): Clear DECL_COMMON again when a section attribute
> 	is present.
> 	(finish_record_type): Independently track if RECORD_TYPE has SIZE and/or
> 	SIZE_UNIT already set and use to compute final SIZE and SIZE_UNIT.
> 	(create_field_decl): Special case ADDRESSABLE negative to mean
> 	"no bitfield creation", to be used by make_aligning_type. Don't
> 	restrict bitfield creation to !ADDRESSABLE any more, as some BLKmode
> 	fields claimed addressable still have to be bitfields. Use
> 	value_factor_p instead of a raw binop construction to check for the
> 	position's alignment.
> 
> 

-- 
Thanks,
Jim

http://www.student.cs.uwaterloo.ca/~ja2morri/
http://phython.blogspot.com
http://open.nit.ca/wiki/?page=jim


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