public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/34287]  New: Simple Ada bug [Barnes' Silly]
@ 2007-11-29 11:10 meudecc at itcarlow dot ie
  2007-12-01  1:00 ` [Bug ada/34287] " sam at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: meudecc at itcarlow dot ie @ 2007-11-29 11:10 UTC (permalink / raw)
  To: gcc-bugs

[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


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

* [Bug ada/34287] Simple Ada bug [Barnes' Silly]
  2007-11-29 11:10 [Bug ada/34287] New: Simple Ada bug [Barnes' Silly] meudecc at itcarlow dot ie
@ 2007-12-01  1:00 ` sam at gcc dot gnu dot org
  2007-12-01  1:01 ` sam at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: sam at gcc dot gnu dot org @ 2007-12-01  1:00 UTC (permalink / raw)
  To: gcc-bugs



-- 

sam at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |sam at gcc dot gnu dot org
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-12-01 01:00:33
               date|                            |


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


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

* [Bug ada/34287] Simple Ada bug [Barnes' Silly]
  2007-11-29 11:10 [Bug ada/34287] New: Simple Ada bug [Barnes' Silly] meudecc at itcarlow dot ie
  2007-12-01  1:00 ` [Bug ada/34287] " sam at gcc dot gnu dot org
@ 2007-12-01  1:01 ` sam at gcc dot gnu dot org
  2007-12-03 16:02 ` sam at gcc dot gnu dot org
  2007-12-03 16:04 ` sam at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: sam at gcc dot gnu dot org @ 2007-12-01  1:01 UTC (permalink / raw)
  To: gcc-bugs



-- 

sam at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2


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


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

* [Bug ada/34287] Simple Ada bug [Barnes' Silly]
  2007-11-29 11:10 [Bug ada/34287] New: Simple Ada bug [Barnes' Silly] meudecc at itcarlow dot ie
  2007-12-01  1:00 ` [Bug ada/34287] " sam at gcc dot gnu dot org
  2007-12-01  1:01 ` sam at gcc dot gnu dot org
@ 2007-12-03 16:02 ` sam at gcc dot gnu dot org
  2007-12-03 16:04 ` sam at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: sam at gcc dot gnu dot org @ 2007-12-03 16:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from sam at gcc dot gnu dot org  2007-12-03 16:02 -------
Subject: Bug 34287

Author: sam
Date: Mon Dec  3 16:01:57 2007
New Revision: 130582

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=130582
Log:
2007-12-03  Robert Dewar <dewar@adacore.com>
            Samuel Tardieu  <sam@rfc1149.net>

        gcc/ada/
        PR ada/34287
        * sem_util.adb (Safe_To_Capture_Value): Do not capture values
        of variables declared in a library-level package.

        gcc/testsuite/gnat.dg/
        PR ada/34287
        * check_elaboration_code.adb: New test.

        * bug_elaboration_code.ads, bug_elaboration_code.adb: New support
        files.

Added:
    trunk/gcc/testsuite/gnat.dg/bug_elaboration_code.adb
    trunk/gcc/testsuite/gnat.dg/bug_elaboration_code.ads
    trunk/gcc/testsuite/gnat.dg/check_elaboration_code.adb
Modified:
    trunk/gcc/ada/ChangeLog
    trunk/gcc/ada/sem_util.adb
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug ada/34287] Simple Ada bug [Barnes' Silly]
  2007-11-29 11:10 [Bug ada/34287] New: Simple Ada bug [Barnes' Silly] meudecc at itcarlow dot ie
                   ` (2 preceding siblings ...)
  2007-12-03 16:02 ` sam at gcc dot gnu dot org
@ 2007-12-03 16:04 ` sam at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: sam at gcc dot gnu dot org @ 2007-12-03 16:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from sam at gcc dot gnu dot org  2007-12-03 16:03 -------
This bug has been fixed in SVN trunk.


-- 

sam at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.3.0


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


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

end of thread, other threads:[~2007-12-03 16:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-29 11:10 [Bug ada/34287] New: Simple Ada bug [Barnes' Silly] meudecc at itcarlow dot ie
2007-12-01  1:00 ` [Bug ada/34287] " sam at gcc dot gnu dot org
2007-12-01  1:01 ` sam at gcc dot gnu dot org
2007-12-03 16:02 ` sam at gcc dot gnu dot org
2007-12-03 16:04 ` sam 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).