From 0d5a0a33cdd9ff9ef6839636cc17e73c3ad522ec Mon Sep 17 00:00:00 2001 From: Pierre-Marie de Rodat Date: Mon, 15 May 2017 08:58:56 +0000 Subject: [PATCH] utils.c (can_materialize_object_renaming_p): Synchronize with GNAT's Exp_Dbug.Debug_Renaming_Declaration... * gcc-interface/utils.c (can_materialize_object_renaming_p): Synchronize with GNAT's Exp_Dbug.Debug_Renaming_Declaration: process Original_Node instead of expanded names. From-SVN: r248054 --- gcc/ada/ChangeLog | 6 ++++++ gcc/ada/gcc-interface/utils.c | 7 ++++++- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gnat.dg/specs/pack13.ads | 25 +++++++++++++++++++++++++ 4 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gnat.dg/specs/pack13.ads diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 78a3bb1c71b..f4c126a7b72 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2017-05-15 Pierre-Marie de Rodat + + * gcc-interface/utils.c (can_materialize_object_renaming_p): + Synchronize with GNAT's Exp_Dbug.Debug_Renaming_Declaration: + process Original_Node instead of expanded names. + 2017-05-15 Eric Botcazou * gcc-interface/trans.c (return_value_ok_for_nrv_p): Only apply the diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c index 345b8a4f163..b8c5d3d31f6 100644 --- a/gcc/ada/gcc-interface/utils.c +++ b/gcc/ada/gcc-interface/utils.c @@ -5431,11 +5431,16 @@ can_materialize_object_renaming_p (Node_Id expr) { while (true) { + expr = Original_Node (expr); + switch Nkind (expr) { case N_Identifier: case N_Expanded_Name: - return true; + if (!Present (Renamed_Object (Entity (expr)))) + return true; + expr = Renamed_Object (Entity (expr)); + break; case N_Selected_Component: { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ac54d650e35..f198fc6b42b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2017-05-15 Pierre-Marie de Rodat + + * gnat.dg/specs/pack13.ads: New test. + 2017-05-14 Martin Sebor PR middle-end/77671 diff --git a/gcc/testsuite/gnat.dg/specs/pack13.ads b/gcc/testsuite/gnat.dg/specs/pack13.ads new file mode 100644 index 00000000000..4594ab7ca03 --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/pack13.ads @@ -0,0 +1,25 @@ +-- { dg-do compile } + +package Pack13 is + + generic + type Value_Type is private; + Value : in out Value_Type; + package G is end G; + + type Rec is record + B : Boolean; + end record; + for Rec use record + B at 0 range 8 .. 8; + end record; + for Rec'size use 9; + + type Arr is array (Boolean) of Rec; + pragma Pack (Arr); + + A : Arr; + + package My_G is new G (Boolean, A(True).B); + +end Pack13; -- 2.30.2