[Bug ada/26306] Use of volatile array with bounds determined at run time.

ben dot midgley at ultra-datel dot com gcc-bugzilla@gcc.gnu.org
Wed Feb 15 17:56:00 GMT 2006



------- Comment #2 from ben dot midgley at ultra-datel dot com  2006-02-15 17:56 -------
(In reply to comment #1)
> Could you please send full sources to reproduce this problem ? thanks.
> Arno

Arno, what follows is a simple bit of code which causes the assertion failure
described in tree.c, In constructing this it became apparent that the bug
report should read use of volatile array, within a record, with bounds
determined at run time. I hope this clarifies the issue. 

---scratch.ada--------

        with system; 
        with Interfaces.c;

procedure scratch is 

        -- to get a value for the upper bound of the array 
    type my_Integer is range -2147483648 .. 2147483647;

    for my_Integer'Size use 32;

        function GetArrayUpperBound return my_integer is 
        begin
        return 2;
        end GetArrayUpperBound; 

        some_value : my_integer := GetArrayUpperBound;

    type Gp_Element_Type is
    record
        Element : Interfaces.C.Unsigned;
    end record;


        type some_type is
       array
          (1 .. some_value )
          of
          Gp_Element_Type;

        type Aligned_Some_Type is
            record
                Value : aliased some_type;
            end record;          

    for Aligned_Some_Type'Alignment use 8;          

        an_aligned_type : aligned_Some_Type;   
        my_address : system.address; 

        -- remember volatile too 

    pragma Volatile (an_aligned_type);


        begin

                my_address := an_aligned_type.value( 1 )'address; 


        end scratch;      




-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26306



More information about the Gcc-bugs mailing list