This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Ada] Internal error on private type with -gnatct
- From: Eric Botcazou <ebotcazou at adacore dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 4 Nov 2011 11:26:35 +0100
- Subject: [Ada] Internal error on private type with -gnatct
This is an internal error on the type of an argument that isn't elaborated
early enough in -gnatct mode, because it is the private derivation of a
private type. In this mode, the compiler doesn't generate code and gigi is
invoked only to lay out types and back-annotate type information.
Fixed by lifting the assertion in -gnatct mode, as this corner case doesn't
seem to warrant a significant change either in gigi or the front-end proper.
Tested on i586-suse-linux, applied on the mainline.
2011-11-04 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Function>: Do not assert
that the type of the parameters isn't dummy in type_annotate_only mode.
2011-11-04 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/specs/private1[-sub].ads: New test.
--
Eric Botcazou
Index: gcc-interface/decl.c
===================================================================
--- gcc-interface/decl.c (revision 180818)
+++ gcc-interface/decl.c (working copy)
@@ -4185,7 +4185,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entit
/* The failure of this assertion will very likely come from an
order of elaboration issue for the type of the parameter. */
gcc_assert (kind == E_Subprogram_Type
- || !TYPE_IS_DUMMY_P (gnu_param_type));
+ || !TYPE_IS_DUMMY_P (gnu_param_type)
+ || type_annotate_only);
if (gnu_param)
{
package Private1 is
type T is private;
private
type T is new Boolean;
end Private1;
-- { dg-do compile }
-- { dg-options "-gnatct" }
package Private1.Sub is
package Nested is
type T is limited private;
function "=" (X, Y : T) return Boolean;
private
type T is new Private1.T;
end Nested;
end Private1.Sub;