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]

[Ada] more straight-line code for more arrays


Slight improvement over

   http://gcc.gnu.org/ml/gcc-patches/2009-06/msg02009.html

The point of which was to prevent the generation of a useless test for
allocators of Ada arrays that cannot possibly be empty ("superflat" in
gigi parlance), as in

   type Arr is array (Positive range <>) of Integer;
   type Arr_Acc is access Arr;

   subtype My_Range is Integer range 1 .. 25;

   function Get_Arr (Nbr : My_Range) return Arr_Acc is
   begin
      return new Arr (1 .. Nbr);
   end;

This patch extends the recognition to cases where the array index
has a true range type like

       type My_Range is range 1 .. 25;
       type Arr is array (My_Range range <>) of Integer;

Tested on x86_64-suse-linux.

2009-09-02  Olivier Hainque  <hainque@adacore.com>

	ada/
	* gcc-interface/decl.c (cannot_be_superflat_p): Handle
	Signed_Integer_Type_Definition Scalar_Ranges.

	testsuite/
	* gnat.dg/array7.ad[bs]: Add check for Signed_Integer_Type_Definition.




Attachment: superflat-range.dif
Description: Text document


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