From c1a42658e734cb6445c8e81c8f95c3d99b8c8709 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Wed, 6 Sep 2017 12:23:36 +0000 Subject: [PATCH] trans.c (gnat_to_gnu): Try again to translate the prefix after the field if it is incomplete. 2017-09-06 Eric Botcazou * gcc-interface/trans.c (gnat_to_gnu) : Try again to translate the prefix after the field if it is incomplete. From-SVN: r251788 --- gcc/ada/ChangeLog | 5 +++++ gcc/ada/gcc-interface/trans.c | 11 +++++++++++ 2 files changed, 16 insertions(+) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 264dd9b..385c663 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2017-09-06 Eric Botcazou + + * gcc-interface/trans.c (gnat_to_gnu) : Try + again to translate the prefix after the field if it is incomplete. + 2017-09-06 Bob Duff * exp_util.adb (Is_Displace_Call): Make sure it works for indirect diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index 9163eb1..5c85c4a 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -6465,6 +6465,17 @@ gnat_to_gnu (Node_Id gnat_node) { tree gnu_field = gnat_to_gnu_field_decl (gnat_field); + /* If the prefix has incomplete type, try again to translate it. + The idea is that the translation of the field just above may + have completed it through gnat_to_gnu_entity, in case it is + the dereference of an access to Taft Amendment type used in + the instantiation of a generic body from an external unit. */ + if (!COMPLETE_TYPE_P (TREE_TYPE (gnu_prefix))) + { + gnu_prefix = gnat_to_gnu (gnat_prefix); + gnu_prefix = maybe_implicit_deref (gnu_prefix); + } + gnu_result = build_component_ref (gnu_prefix, gnu_field, (Nkind (Parent (gnat_node)) -- 2.7.4