with Ada.Text_IO; use Ada.Text_IO; procedure Test_4_5_1_6 is type T is array (Positive range <>) of Boolean; pragma Pack (T);
A : constant T := (1 .. 5 => True); B : constant T := (6 .. 10 => False); C : constant T := A xor B; begin Put ("("); for K in C'Range loop Put (Integer'Image (K) & " => " & Boolean'Image (C (K))); if K < C'Last then Put (", "); end if; end loop; Put_Line (")"); end Test_4_5_1_6; Per RM 4.5.1(6), "the bounds of the resulting array are those of the left operand". Thus, the expected output is: ( 1 => TRUE, 2 => TRUE, 3 => TRUE, 4 => TRUE, 5 => TRUE) However with gcc-4.0, I get: ( 6 => TRUE, 7 => TRUE, 8 => TRUE, 9 => TRUE, 10 => TRUE) I observed this with gnat 3.15p from AdaCore and gcc 4.0.1 20050503 (prerelease) (Debian 4.0.0-2). -- Ludovic Brenta. -- Summary: Legal program runs incorrectly, RM 4.5.1(6): array xor array Product: gcc Version: 4.0.0 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 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22557