This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug ada/22557] New: Legal program runs incorrectly, RM 4.5.1(6): array xor array
- From: "ludovic dot brenta at insalien dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 Jul 2005 10:12:42 -0000
- Subject: [Bug ada/22557] New: Legal program runs incorrectly, RM 4.5.1(6): array xor array
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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