Debian Bug #276227: -- interestingly, the error message is different depending on -- the number of enumeration elements in T1 and T2. package Test_124 is type T1 is (b01,b02,b03,b04,b05,b06,b07,b08,b09,b10, b11,b12,b13,b14,b15,b16,b17,b18,b19,b20, b21,b22,b23,b24,b25,b26,b27,b28,b29,b30, b31,b32); type T1_arr_unconstrained is array (T1 range <>) of boolean; type T1_arr_constrained is new T1_arr_unconstrained (T1); pragma pack (T1_arr_unconstrained); for T1_arr_constrained'size use 32; -- line 12 type T2 is (b01,b02,b03,b04,b05,b06,b07,b08,b09,b10, b11,b12,b13,b14,b15,b16,b17,b18,b19,b20, b21,b22,b23,b24,b25,b26,b27,b28,b29,b30, b31); -- one fewer than T1 type T2_arr_unconstrained is array (T2 range <>) of boolean; type T2_arr_constrained is new T2_arr_unconstrained (T2); pragma pack (T2_arr_unconstrained); for T2_arr_constrained'size use 32; -- line 22 end Test_124; The actual output from GCC 3.4.2 is: test_124.ads:12:04: size given for "T1_arr_constrained" too small test_124.ads:12:04: explicit pragma Pack is required gnatmake: "test_124.ads" compilation error If line 12 is commented out: test_124.ads:22:36: size for "T2_arr_constrained" too small, minimum allowed is 248 gnatmake: "test_124.ads" compilation error
Confirmed.
From: Jörgen Tegnér <jorgen.tegner@telia.com> The compiler message is different with 4.3.2-2. Now it reads test_124.ads:12:36: size for "T1_arr_constrained" too small, minimum allowed is 256 test_124.ads:22:36: size for "T2_arr_constrained" too small, minimum allowed is 248 I get the same results with 4.6.1, so I propose to test only one type. package Test_124 is type T is range 1 .. 32; type T_arr_unconstrained is array (T range <>) of boolean; type T_arr_constrained is new T_arr_unconstrained (T); pragma pack (T_arr_unconstrained); for T_arr_constrained'size use 32; end Test_124;
Found in 4.9-20140218
I think that the program is illegal since the pragma Pack comes too late.