This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug ada/42236] New: ICE for dispatching call involving explicit dereference


The following program triggers a bug box.

gcc-4.4 -c t.adb
+===========================GNAT BUG DETECTED==============================+
| 4.4.2 (x86_64-pc-linux-gnu) Assert_Failure sinfo.adb:1149                |
| Error detected at t.adb:49:13                                            |
| 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-4.4 or gnatmake command that you entered.          |
| Also include sources listed below in gnatchop format                     |
| (concatenated together with no headers between files).                   |
+==========================================================================+

The bug is also present in GCC 4.3.  It would be nice if there was
some sort of workaround; I need this to adjust code to the changed
semantics of limited return types in Ada 2005.

In GCC 4.3, the crash happens at this point in
sem_disp.check_dispatching_call:

539                       else
540                          Func :=
541                            Entity (Name
542                              (Original_Node
543                                (Expression (Original_Node (Actual)))));
544                       end if;

GDB reports:

(gdb) print pn(actual)
N_Explicit_Dereference (Node_Id=1864) (source,analyzed)
 Sloc = 8744  t.adb:49:52
 Etype = N_Defining_Identifier "transaction" (Entity_Id=1670)
 Prefix = N_Identifier "R168b" (Node_Id=1863)
$7 = void
(gdb) print pn(original_node(actual))
N_Explicit_Dereference (Node_Id=1864) (source,analyzed)
 Sloc = 8744  t.adb:49:52
 Etype = N_Defining_Identifier "transaction" (Entity_Id=1670)
 Prefix = N_Identifier "R168b" (Node_Id=1863)
$8 = void

with Ada.Finalization;

procedure T is

   package Transactions is
      type Transaction is limited private;
      function No_Transaction return access Transaction;

   private
      pragma Inline (No_Transaction);

      type Transaction is new Ada.Finalization.Limited_Controlled with record
         Handle : Natural := 0;
      end record;
   end;

   package body Transactions is
      No_Txn : aliased Transaction;

      function No_Transaction return access Transaction is
      begin
         return No_Txn'Access;
      end No_Transaction;
   end Transactions;

   package Databases is
      type Database is limited private;
      procedure Open
        (D : in out Database;
         T : Transactions.Transaction);
   private
      type Database is new Ada.Finalization.Limited_Controlled with record
         Handle : Natural := 0;
      end record;
   end Databases;

   package body Databases is
      procedure Open
        (D : in out Database;
         T : Transactions.Transaction) is
      begin
         null;
      end;
   end;

   DB : Databases.Database;

begin
   Databases.Open (DB, Transactions.No_Transaction.all);
end T;


-- 
           Summary: ICE for dispatching call involving explicit dereference
           Product: gcc
           Version: 4.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: fweimer at bfk dot de
 GCC build triplet: x86_64-linux-gnu
  GCC host triplet: x86_64-linux-gnu
GCC target triplet: x86_64-linux-gnu


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]