> This restricts BIT_FIELD_REF bound verification to non-aggegate
> typed bases - otherwise we have to look for trailing arrays and
> such (see the testcase), and Ada may even have more interesting
> cases.

Very likely not, they are equivalent in the end.  I have installed the 
attached testcase, whose failure has also been fixed by your patch.


2013-11-29  Eric Botcazou  <ebotca...@adacore.com>

        * gnat.dg/opt29.ad[sb]: New test.


-- 
Eric Botcazou
-- { dg-do compile }
-- { dg-options "-O" }

package body Opt29 is

  procedure Proc (T : Rec) is
  begin
    if Derived2 (T.F2.all).Id = T.F1.Id then
      raise Program_Error;
    end if;
  end;

end Opt29;
package Opt29 is

  type Word is mod 2**16;

  type PID is record
    W1, W2: Word;
  end record;

  type Root1 is tagged record
    Id: PID;
  end record;
  type Root1_Ptr is access all Root1'Class;

  type Root2 is tagged null record;
  type Root2_Ptr is access all Root2'class;

  type Derived2 is new Root2 with record
    Id: PID;
  end record;

  type Rec is record
    F1: Root1_Ptr;
    F2: Root2_Ptr;
  end record;

  procedure Proc (T : Rec);

end Opt29;

Reply via email to