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] Fix handling of very large packaged arrays


Tested on i686-linux, committed on HEAD

The length of very large packed arrays was previously computed
using 32-bit arithmetic and malfunctions occurred due to undetected
overflow. This patch switches to 64-bit arithmetic for these
computations and handles the large array cases correctly. It also
increases the maximum size of packed arrays to Integer'Last bytes.

The following test program now compiles without any errors:

package intrange is
  Min_Integer32 : constant := -2**31;
  Max_Integer32 : constant := 2**31 - 1;
  type Integer32_T is range Min_Integer32 .. Max_Integer32;
  subtype Natural32_T is Integer32_T range 0 .. Integer32_T'Last;
  subtype Bit_T is  Boolean;
  type Raw_Memory_T is array (Natural32_T) of Bit_T;
  pragma pack (Raw_Memory_T);
end;

See also ACATS test C52104X

2005-09-01  Robert Dewar  <dewar@adacore.com>

	* exp_pakd.adb (Create_Packed_Array_Type): Properly handle very large
	packed arrays.

Attachment: difs.19
Description: Text document


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