This is the mail archive of the gcc-bugs@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]

[Bug ada/17954] New: Legal program rejected, packed array of booleans


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

-- 
           Summary: Legal program rejected, packed array of booleans
           Product: gcc
           Version: 3.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ludovic dot brenta at insalien dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i486-linux
  GCC host triplet: i486-linux
GCC target triplet: i486-linux


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


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