From: Eric Botcazou Date: Wed, 13 Dec 2017 09:18:24 +0000 (+0000) Subject: trans.c (process_freeze_entity): Be prepared for a package without body. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=692317f4310e9652099f5097313e5965703aca92;p=gcc.git trans.c (process_freeze_entity): Be prepared for a package without body. * gcc-interface/trans.c (process_freeze_entity): Be prepared for a package without body. From-SVN: r255601 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 70c596efbae..534b8cf92a1 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2017-12-13 Eric Botcazou + + * gcc-interface/trans.c (process_freeze_entity): Be prepared for a + package without body. + 2017-12-13 Eric Botcazou * gcc-interface/decl.c (gnat_to_gnu_entity): Robustify test for types diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index 4739923a09d..7a83acfd0b4 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -8718,12 +8718,12 @@ process_freeze_entity (Node_Id gnat_node) const Entity_Kind kind = Ekind (gnat_entity); tree gnu_old, gnu_new; - /* If this is a package, we need to generate code for the package. */ + /* If this is a package, generate code for the package body, if any. */ if (kind == E_Package) { - insert_code_for - (Parent (Corresponding_Body - (Parent (Declaration_Node (gnat_entity))))); + const Node_Id gnat_decl = Parent (Declaration_Node (gnat_entity)); + if (Present (Corresponding_Body (gnat_decl))) + insert_code_for (Parent (Corresponding_Body (gnat_decl))); return; }