public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/29015] New: Ada 2005 observer pattern with mutually dependent packages and containers produces compiler error
@ 2006-09-11 10:20 laguest at abyss2 dot demon dot co dot uk
2006-09-14 6:16 ` [Bug ada/29015] " ebotcazou at gcc dot gnu dot org
` (10 more replies)
0 siblings, 11 replies; 12+ messages in thread
From: laguest at abyss2 dot demon dot co dot uk @ 2006-09-11 10:20 UTC (permalink / raw)
To: gcc-bugs
$ uname -a
Linux rogue 2.6.16-gentoo-r13 #1 PREEMPT Tue Aug 1 13:59:12 GMT 2006 i686 AMD
Athlon(TM) XP 2000+ GNU/Linux
$ gcc -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.1.1/configure --prefix=/home/laguest/opt/gcc-4.1.1
--enable-libada --enable-languages=c,c++,java,objc,ada
Thread model: posix
gcc version 4.1.1
$ gnatmake -gnat05 -gnatwj test_observers.adb
gcc -c -gnat05 -gnatwj test_observers.adb
+===========================GNAT BUG DETECTED==============================+
| 4.1.1 (i686-pc-linux-gnu) Assert_Failure atree.adb:812 |
| Error detected at subjects.ads:17:3 |
| Please submit a bug report; see http://gcc.gnu.org/bugs.html. |
| Use a subject line meaningful to you and us to track the bug. |
| Include the entire contents of this bug box in the report. |
| Include the exact gcc or gnatmake command that you entered. |
| Also include sources listed below in gnatchop format |
| (concatenated together with no headers between files). |
+==========================================================================+
Please include these source files with error report
Note that list may not be accurate in some cases,
so please double check that the problem can still
be reproduced with the set of files listed.
test_observers.adb
my_observer.ads
observers.ads
subjects.ads
compilation abandoned
gnatmake: "test_observers.adb" compilation error
with My_Observer;
with Subjects;
procedure Test_Observers is
Obs : Observers.Observer_Access := new My_Observer.My_Observer_Type;
Subject : Subjects.Subject;
begin
-- Subjects.Attach(Subject, Obs);
Subject.Attach(Obs);
Subject.Notify;
end Test_Observers;
package body My_Observer is
procedure Update(Self : in My_Observer_Type) is
begin
Ada.TexT_IO.Put_Line("[My_Observer.Update]");
end Update;
end My_Observer;
with Observers;
package My_Observer is
type My_Observer_Type is new Observers.Observer with private;
procedure Update(Self : in My_Observer_Type);
private
type My_Observer_Type is new Observers.Observer with null record;
end My_Observer;
limited with Observers;
with Ada.Containers.Doubly_Linked_Lists;
with Ada.Finalization;
package Subjects is
type Subject is new Ada.Finalization.Limited_Controlled with private;
procedure Attach(Self : in out Subject'Class; Observer : access
Observers.Observer);
procedure Detach(Self : in out Subject'Class; Observer : access
Observers.Observer);
procedure Notify(Self : in Subject);
private
function Equals(Left, Right : access Observers.Observer) return Boolean;
package Observer_Lists is new
Ada.Containers.Doubly_Linked_Lists(Observers.Observer_Access, Equals);
type Subject is new Ada.Finalization.Limited_Controlled with
record
Observer_List : Observer_Lists.List;
end record;
end Subjects;
with Observers;
package body Subjects is
use type Observer_Lists.Cursor;
-- Add an observer to this subject's internal list.
procedure Attach(Self : in out Subject'Class; Observer : access
Observers.Observer) is
begin
Self.Observer_List.Append(New_Item => Observer);
end Attach;
-- Remove an observer from this subject's internal list.
procedure Detach(Self : in out Subject'Class; Observer : access
Observers.Observer) is
Position : Observer_Lists.Cursor := Self.Observer_List.Find(Observer);
begin
if Position /= Observer_Lists.No_Element then
Self.Observer_List.Delete(Position);
end if;
end Detach;
-- Notify all observers who are monitoring this subject that something has
happened.
procedure Notify(Self : in Subject) is
Current : Observer_Lists.Cursor := Self.Observer_List.First;
begin
while Current /= Observer_Lists.No_Element loop
Observer_Lists.Element(Current).Update;
Current := Observer_Lists.Next(Current);
end loop;
end Notify;
function Equals(Left, Right : access Observers.Observer) return Boolean is
begin
if Left = Right then
return True;
end if;
return False;
end Equals;
end Subjects;
package Observers is
type Observer is abstract tagged private;
type Observer_Access is access all Observers.Observer'Class;
procedure Update(Self : in Observer) is abstract;
private
type Observer is abstract tagged null record;
end Observers;
--
Summary: Ada 2005 observer pattern with mutually dependent
packages and containers produces compiler error
Product: gcc
Version: 4.1.1
Status: UNCONFIRMED
Severity: blocker
Priority: P3
Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: laguest at abyss2 dot demon dot co dot uk
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29015
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug ada/29015] Ada 2005 observer pattern with mutually dependent packages and containers produces compiler error
2006-09-11 10:20 [Bug ada/29015] New: Ada 2005 observer pattern with mutually dependent packages and containers produces compiler error laguest at abyss2 dot demon dot co dot uk
@ 2006-09-14 6:16 ` ebotcazou at gcc dot gnu dot org
2006-09-17 19:42 ` laguest at archangeli dot demon dot co dot uk
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2006-09-14 6:16 UTC (permalink / raw)
To: gcc-bugs
--
ebotcazou at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|blocker |normal
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29015
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug ada/29015] Ada 2005 observer pattern with mutually dependent packages and containers produces compiler error
2006-09-11 10:20 [Bug ada/29015] New: Ada 2005 observer pattern with mutually dependent packages and containers produces compiler error laguest at abyss2 dot demon dot co dot uk
2006-09-14 6:16 ` [Bug ada/29015] " ebotcazou at gcc dot gnu dot org
@ 2006-09-17 19:42 ` laguest at archangeli dot demon dot co dot uk
2006-09-18 16:12 ` laguest at archangeli dot demon dot co dot uk
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: laguest at archangeli dot demon dot co dot uk @ 2006-09-17 19:42 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from laguest at archangeli dot demon dot co dot uk 2006-09-17 19:42 -------
Using the current SVN source (17/09/06) I get a slightly different error (with
the same source):
gcc -c -gnat05 test_observers.adb
+===========================GNAT BUG DETECTED==============================+
| 4.2.0 20060917 (experimental) (i686-pc-linux-gnu) Assert_Failure
atree.adb:812|
| Error detected at subjects.ads:17:3 |
| Please submit a bug report; see http://gcc.gnu.org/bugs.html. |
| Use a subject line meaningful to you and us to track the bug. |
| Include the entire contents of this bug box in the report. |
| Include the exact gcc or gnatmake command that you entered. |
| Also include sources listed below in gnatchop format |
| (concatenated together with no headers between files). |
+==========================================================================+
Please include these source files with error report
Note that list may not be accurate in some cases,
so please double check that the problem can still
be reproduced with the set of files listed.
test_observers.adb
my_observer.ads
observers.ads
subjects.ads
compilation abandoned
gnatmake: "test_observers.adb" compilation error
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29015
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug ada/29015] Ada 2005 observer pattern with mutually dependent packages and containers produces compiler error
2006-09-11 10:20 [Bug ada/29015] New: Ada 2005 observer pattern with mutually dependent packages and containers produces compiler error laguest at abyss2 dot demon dot co dot uk
2006-09-14 6:16 ` [Bug ada/29015] " ebotcazou at gcc dot gnu dot org
2006-09-17 19:42 ` laguest at archangeli dot demon dot co dot uk
@ 2006-09-18 16:12 ` laguest at archangeli dot demon dot co dot uk
2006-09-18 17:55 ` laurent at guerby dot net
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: laguest at archangeli dot demon dot co dot uk @ 2006-09-18 16:12 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from laguest at archangeli dot demon dot co dot uk 2006-09-18 16:11 -------
Seems this was an error based on the use of a limited view of a type. I don't
know whether this is actually allowed in the Ada 2005 standard, i.e passing a
reference to a limited view to a container? Should this bug be left open?
Luke.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29015
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug ada/29015] Ada 2005 observer pattern with mutually dependent packages and containers produces compiler error
2006-09-11 10:20 [Bug ada/29015] New: Ada 2005 observer pattern with mutually dependent packages and containers produces compiler error laguest at abyss2 dot demon dot co dot uk
` (2 preceding siblings ...)
2006-09-18 16:12 ` laguest at archangeli dot demon dot co dot uk
@ 2006-09-18 17:55 ` laurent at guerby dot net
2007-12-07 14:02 ` sam at gcc dot gnu dot org
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: laurent at guerby dot net @ 2006-09-18 17:55 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from laurent at guerby dot net 2006-09-18 17:55 -------
Confirmed.
$ gcc -c -gnat05 test_observers.adb
+===========================GNAT BUG DETECTED==============================+
| 4.2.0 20060915 (experimental) (x86_64-unknown-linux-gnu) Assert_Failure
atree.adb:812|
| Error detected at subjects.ads:19:3 |
I'm not sure this is valid too, so I'm tagging this as ICE on invalid code (in
all cases this is a bug since the compiler should never ICE).
--
laurent at guerby dot net changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Keywords| |ice-on-invalid-code
Last reconfirmed|0000-00-00 00:00:00 |2006-09-18 17:55:33
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29015
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug ada/29015] Ada 2005 observer pattern with mutually dependent packages and containers produces compiler error
2006-09-11 10:20 [Bug ada/29015] New: Ada 2005 observer pattern with mutually dependent packages and containers produces compiler error laguest at abyss2 dot demon dot co dot uk
` (3 preceding siblings ...)
2006-09-18 17:55 ` laurent at guerby dot net
@ 2007-12-07 14:02 ` sam at gcc dot gnu dot org
2008-04-09 19:46 ` laguest at archangeli dot demon dot co dot uk
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: sam at gcc dot gnu dot org @ 2007-12-07 14:02 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from sam at gcc dot gnu dot org 2007-12-07 14:01 -------
Confirmed on SVN trunk
+===========================GNAT BUG DETECTED==============================+
| 4.3.0 20071207 (experimental) (i686-pc-linux-gnu) Assert_Failure
atree.adb:962|
| Error detected at subjects.ads:19:3 |
--
sam at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |sam at gcc dot gnu dot org
Last reconfirmed|2006-09-18 17:55:33 |2007-12-07 14:01:58
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29015
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug ada/29015] Ada 2005 observer pattern with mutually dependent packages and containers produces compiler error
2006-09-11 10:20 [Bug ada/29015] New: Ada 2005 observer pattern with mutually dependent packages and containers produces compiler error laguest at abyss2 dot demon dot co dot uk
` (4 preceding siblings ...)
2007-12-07 14:02 ` sam at gcc dot gnu dot org
@ 2008-04-09 19:46 ` laguest at archangeli dot demon dot co dot uk
2008-04-09 20:11 ` ludovic at ludovic-brenta dot org
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: laguest at archangeli dot demon dot co dot uk @ 2008-04-09 19:46 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from laguest at archangeli dot demon dot co dot uk 2008-04-09 19:45 -------
This is still a problem on 4.4.0 trunk.
Luke.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29015
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug ada/29015] Ada 2005 observer pattern with mutually dependent packages and containers produces compiler error
2006-09-11 10:20 [Bug ada/29015] New: Ada 2005 observer pattern with mutually dependent packages and containers produces compiler error laguest at abyss2 dot demon dot co dot uk
` (5 preceding siblings ...)
2008-04-09 19:46 ` laguest at archangeli dot demon dot co dot uk
@ 2008-04-09 20:11 ` ludovic at ludovic-brenta dot org
2008-04-09 20:26 ` ludovic at ludovic-brenta dot org
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: ludovic at ludovic-brenta dot org @ 2008-04-09 20:11 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from ludovic at ludovic-brenta dot org 2008-04-09 20:10 -------
Reduced test case:
package Observers is
type Observer is tagged null record;
type Observer_Access is access all Observers.Observer'Class;
end Observers;
limited with Observers;
with Ada.Containers.Doubly_Linked_Lists;
package Subjects is
function Equals(Left, Right : access Observers.Observer) return Boolean;
package Observer_Lists is new
Ada.Containers.Doubly_Linked_Lists(Observers.Observer_Access, Equals);
end Subjects;
with Observers; -- this line triggers the bug
package body Subjects is
function Equals(Left, Right : access Observers.Observer) return Boolean is
begin
return False;
end Equals;
end Subjects;
With the line that triggers the bug:
gcc-4.1 -c -gnat05 subjects.adb
+===========================GNAT BUG DETECTED==============================+
| 4.1.3 20070518 (prerelease) (Debian 4.1.2-8) (x86_64-pc-linux-gnu) |
| Assert_Failure atree.adb:812 |
| Error detected at subjects.ads:8:3 |
gcc-4.3 -c -gnat05 subjects.adb
+===========================GNAT BUG DETECTED==============================+
| 4.3.1 20080401 (prerelease) (x86_64-pc-linux-gnu) Assert_Failure
atree.adb:886|
| Error detected at subjects.ads:8:3 |
Without the line that triggers the bug:
gcc-4.1 -c -gnat05 subjects.adb
subjects.ads:9:49: premature use of incomplete type
subjects.ads:9:49: instantiation abandoned
gcc-4.3 -c -gnat05 subjects.adb
subjects.ads:9:49: premature use of incomplete type
subjects.ads:9:49: instantiation abandoned
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29015
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug ada/29015] Ada 2005 observer pattern with mutually dependent packages and containers produces compiler error
2006-09-11 10:20 [Bug ada/29015] New: Ada 2005 observer pattern with mutually dependent packages and containers produces compiler error laguest at abyss2 dot demon dot co dot uk
` (6 preceding siblings ...)
2008-04-09 20:11 ` ludovic at ludovic-brenta dot org
@ 2008-04-09 20:26 ` ludovic at ludovic-brenta dot org
2008-04-09 20:41 ` sam at gcc dot gnu dot org
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: ludovic at ludovic-brenta dot org @ 2008-04-09 20:26 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from ludovic at ludovic-brenta dot org 2008-04-09 20:25 -------
Further reduced test case: replace observers.ads with:
package Observers is
type Observer is new Integer;
type Observer_Access is access Observer;
end Observers;
and the bug is still there.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29015
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug ada/29015] Ada 2005 observer pattern with mutually dependent packages and containers produces compiler error
2006-09-11 10:20 [Bug ada/29015] New: Ada 2005 observer pattern with mutually dependent packages and containers produces compiler error laguest at abyss2 dot demon dot co dot uk
` (7 preceding siblings ...)
2008-04-09 20:26 ` ludovic at ludovic-brenta dot org
@ 2008-04-09 20:41 ` sam at gcc dot gnu dot org
2008-04-16 12:39 ` sam at gcc dot gnu dot org
2008-04-16 12:45 ` sam at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: sam at gcc dot gnu dot org @ 2008-04-09 20:41 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from sam at gcc dot gnu dot org 2008-04-09 20:40 -------
Yes, the bug manifests when the view on the type is limited at this point *but*
we know the underlying type (because of a non-limited with for example). This
triggers it if you compile p2.adb:
package P1 is
type T is null record;
end P1;
limited with P1;
package P2 is
pragma Elaborate_Body;
generic
type T is private;
package G is end G;
package I1 is new G (P1.T);
end P2;
with P1;
package body P2 is end P2;
I'm testing a fix.
--
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|NEW |ASSIGNED
Last reconfirmed|2007-12-07 14:01:58 |2008-04-09 20:40:46
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29015
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug ada/29015] Ada 2005 observer pattern with mutually dependent packages and containers produces compiler error
2006-09-11 10:20 [Bug ada/29015] New: Ada 2005 observer pattern with mutually dependent packages and containers produces compiler error laguest at abyss2 dot demon dot co dot uk
` (8 preceding siblings ...)
2008-04-09 20:41 ` sam at gcc dot gnu dot org
@ 2008-04-16 12:39 ` sam at gcc dot gnu dot org
2008-04-16 12:45 ` sam at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: sam at gcc dot gnu dot org @ 2008-04-16 12:39 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from sam at gcc dot gnu dot org 2008-04-16 12:38 -------
Subject: Bug 29015
Author: sam
Date: Wed Apr 16 12:37:38 2008
New Revision: 134345
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=134345
Log:
gcc/ada/
PR ada/29015
* sem_ch12.adb (Instantiate_Type): Check whether the full view of
the type is known instead of the underlying type.
gcc/testsuite/
PR ada/29015
* gnat.dg/incomplete1.ads, gnat.dg/incomplete2.ads,
gnat.dg/incomplete2.adb: New.
Added:
trunk/gcc/testsuite/gnat.dg/incomplete1.ads
trunk/gcc/testsuite/gnat.dg/incomplete2.adb
trunk/gcc/testsuite/gnat.dg/incomplete2.ads
Modified:
trunk/gcc/ada/ChangeLog
trunk/gcc/ada/sem_ch12.adb
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29015
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug ada/29015] Ada 2005 observer pattern with mutually dependent packages and containers produces compiler error
2006-09-11 10:20 [Bug ada/29015] New: Ada 2005 observer pattern with mutually dependent packages and containers produces compiler error laguest at abyss2 dot demon dot co dot uk
` (9 preceding siblings ...)
2008-04-16 12:39 ` sam at gcc dot gnu dot org
@ 2008-04-16 12:45 ` sam at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: sam at gcc dot gnu dot org @ 2008-04-16 12:45 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from sam at gcc dot gnu dot org 2008-04-16 12:44 -------
This is fixed in the current GCC SVN.
--
sam at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.4.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29015
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2008-04-16 12:45 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-11 10:20 [Bug ada/29015] New: Ada 2005 observer pattern with mutually dependent packages and containers produces compiler error laguest at abyss2 dot demon dot co dot uk
2006-09-14 6:16 ` [Bug ada/29015] " ebotcazou at gcc dot gnu dot org
2006-09-17 19:42 ` laguest at archangeli dot demon dot co dot uk
2006-09-18 16:12 ` laguest at archangeli dot demon dot co dot uk
2006-09-18 17:55 ` laurent at guerby dot net
2007-12-07 14:02 ` sam at gcc dot gnu dot org
2008-04-09 19:46 ` laguest at archangeli dot demon dot co dot uk
2008-04-09 20:11 ` ludovic at ludovic-brenta dot org
2008-04-09 20:26 ` ludovic at ludovic-brenta dot org
2008-04-09 20:41 ` sam at gcc dot gnu dot org
2008-04-16 12:39 ` sam at gcc dot gnu dot org
2008-04-16 12:45 ` 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).