Bug 27776

Summary: ICE on limited with and instantiation
Product: gcc Reporter: Andreas Pfeil <belandor>
Component: adaAssignee: Eric Botcazou <ebotcazou>
Status: RESOLVED FIXED    
Severity: normal CC: belandor, gcc-bugs
Priority: P3 Keywords: ice-on-valid-code
Version: 4.2.0   
Target Milestone: 4.3.0   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed: 2006-05-28 09:18:07

Description Andreas Pfeil 2006-05-27 07:43:53 UTC
The following code creates a bug box when compiled with

gnatmake -gnat05 bug-test.adb


the gcc-4.1.0 version needed a patch in erroutc.adb and s-wchcon.ad[sb] to compile.

ap@strauss2 ~/academics/Modelling/bug-test $ gnatmake -gnat05 bug_test
gcc -c -gnat05 bug_test.adb
gcc -c -gnat05 edges.ads
gcc -c -gnat05 nodes.ads
+===========================GNAT BUG DETECTED==============================+
| 4.1.0 (i686-pc-linux-gnu) in save_gnu_tree, at ada/utils.c:163           |
| Error detected at a-contai.ads:20:40                                     |
| 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.

A bug box also appears using the current SVN trunk (revision 114127):

ap@strauss2 ~/academics/Modelling/bug-test $ /home/ap/crossGNAT/gcc-SVN/install/bin/gnatmake bug_test
gcc -c bug_test.adb
gcc -c edges.ads
gcc -c nodes.ads
+===========================GNAT BUG DETECTED==============================+
| 4.2.0 20060526 (experimental) (i686-pc-linux-gnu) GCC error:             |
| in save_gnu_tree, at ada/utils.c:162                                     |
| Error detected at a-contai.ads:20:40                                     |
| 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.

nodes.ads
edges.ads

compilation abandoned
gnatmake: "nodes.ads" compilation error


-- Files follow here (filenames should be easily deductable)

with Nodes; with Edges;

procedure Bug_test is
begin
   null;
end Bug_Test;

with Ada.Containers.Doubly_Linked_Lists;

with Edges; use Edges;

package Nodes is
   type Node_T;
   type Node_A is access all Node_T;

   type Node_T is record
      Outgoing_Edges : Edges.Edge_Lists.List;
   end record;

end Nodes;

with Ada.Containers.Doubly_Linked_Lists;

limited with Nodes;

package Edges is
   type Edge_T;
   type Edge_T is record
      From, To : access Nodes.Node_T;
   end record;

   type Edge_A is access all Edge_T;

   package Edge_Lists is new Ada.Containers.Doubly_Linked_Lists
     (Edges.Edge_A, Edges."=");


end Edges;
Comment 1 Laurent GUERBY 2006-05-27 08:54:39 UTC
Confirmed on both branches.

$ gcc -c -gnat05 nodes.ads
+===========================GNAT BUG DETECTED==============================+
| 4.2.0 20060511 (experimental) (x86_64-unknown-linux-gnu) GCC error:      |
| in save_gnu_tree, at ada/utils.c:162                                     |
| Error detected at a-contai.ads:20:40                                     |

$ gcc -c -gnat05 nodes.ads
+===========================GNAT BUG DETECTED==============================+
| 4.1.0 (x86_64-unknown-linux-gnu) in save_gnu_tree, at ada/utils.c:163    |
| Error detected at a-contai.ads:20:40                                     |
Comment 2 Eric Botcazou 2006-05-28 09:18:07 UTC
Confirmed, Gigi is not prepared for this kind of circularity.
Comment 3 Arnaud Charlet 2006-10-31 19:41:05 UTC
Fixed on mainline.

Arno