[Bug ada/34287] New: Simple Ada bug [Barnes' Silly]

meudecc at itcarlow dot ie gcc-bugzilla@gcc.gnu.org
Thu Nov 29 11:10:00 GMT 2007


[Already posted on gcc-bugs mailing list sorry]
Here is my program inspired by Barnes' Ada 95 2nd book page 158:

--bug1.ads
package bug1 is
  I : Integer := 0;
  A: array(1.. 10) of Integer := (others => 0);
procedure Silly(X: in out Integer);
end bug1;

--bug1.adb
with Ada.Integer_Text_Io; use Ada.Integer_Text_Io;
package body bug1 is
procedure Silly(X: in out Integer) is
begin
  I := I+1;
  X := X+1;
end;

begin
  A(5) := 1;
  I := 5;
  Silly(A(I));
  Put(I, 0); --I should be 6 here   
  I := I+1;
  Put(I, 0); --I should be 7 here
end bug1;

According to Barnes, and my understanding, 'I' should be 7 at the end of the
elaboration.

Calling "gnatmake -z bug1" I get

on Windows XP, with gcc version 4.1.3 20070403 for GNAT GPL 2007 (20070402)
I get I is 5 after the Silly call (wrong) and I is 6 at the end of the
elaboration

on Windows XP, with gcc version 3.4.1 (mingw special)
I get I is 6 after the Silly call (correct) and I is 6 (!!) at the end of the
elaboration

Both versions seem erroneous.
Can others confirm this bug?
Best Regards to the gcc community
chris


-- 
           Summary: Simple Ada bug [Barnes' Silly]
           Product: gcc
           Version: 4.1.3
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: meudecc at itcarlow dot ie


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



More information about the Gcc-bugs mailing list