public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/22557] New: Legal program runs incorrectly, RM 4.5.1(6): array xor array
@ 2005-07-19 10:30 ludovic dot brenta at insalien dot org
  2005-07-19 12:22 ` [Bug ada/22557] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: ludovic dot brenta at insalien dot org @ 2005-07-19 10:30 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug ada/22557] Legal program runs incorrectly, RM 4.5.1(6): array xor array
  2005-07-19 10:30 [Bug ada/22557] New: Legal program runs incorrectly, RM 4.5.1(6): array xor array ludovic dot brenta at insalien dot org
@ 2005-07-19 12:22 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-19 12:22 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org
           Keywords|                            |wrong-code


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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-07-19 12:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-19 10:30 [Bug ada/22557] New: Legal program runs incorrectly, RM 4.5.1(6): array xor array ludovic dot brenta at insalien dot org
2005-07-19 12:22 ` [Bug ada/22557] " pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).