From: Eric Botcazou Date: Mon, 13 Jun 2016 08:00:17 +0000 (+0000) Subject: decl.c (gnat_to_gnu_entity): Deal with PLUS_EXPR in the expression of a renaming. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=42e77cbc7d5c00e637bca5614a8d688ad08a39c7;p=gcc.git decl.c (gnat_to_gnu_entity): Deal with PLUS_EXPR in the expression of a renaming. * gcc-interface/decl.c (gnat_to_gnu_entity) : Deal with PLUS_EXPR in the expression of a renaming. From-SVN: r237360 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 41a6c619fe2..4ab664865a6 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2016-06-13 Eric Botcazou + + * gcc-interface/decl.c (gnat_to_gnu_entity) : Deal with + PLUS_EXPR in the expression of a renaming. + 2016-06-13 Eric Botcazou * gcc-interface/utils2.c (known_alignment) : Deal specially diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index 8d4ff3fd76c..985527ea5ec 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -1003,6 +1003,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) && !call_is_atomic_load (inner)) || TREE_CODE (inner) == ADDR_EXPR || TREE_CODE (inner) == NULL_EXPR + || TREE_CODE (inner) == PLUS_EXPR || TREE_CODE (inner) == CONSTRUCTOR || CONSTANT_CLASS_P (inner) /* We need to detect the case where a temporary is created to diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 506c7f77b53..803f9b023ff 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2016-06-13 Eric Botcazou + + * gnat.dg/renaming10.ad[sb]: New test. + 2016-06-13 Paul Thomas PR fortran/70673 diff --git a/gcc/testsuite/gnat.dg/renaming10.adb b/gcc/testsuite/gnat.dg/renaming10.adb new file mode 100644 index 00000000000..07d4312b060 --- /dev/null +++ b/gcc/testsuite/gnat.dg/renaming10.adb @@ -0,0 +1,12 @@ +-- { dg-do compile } + +package body Renaming10 is + + function F (Input : Rec) return Natural is + Position : Natural renames Input.Position; + Index : Natural renames Natural'Succ(Position); + begin + return Index; + end; + +end Renaming10; diff --git a/gcc/testsuite/gnat.dg/renaming10.ads b/gcc/testsuite/gnat.dg/renaming10.ads new file mode 100644 index 00000000000..aeb9fc1a201 --- /dev/null +++ b/gcc/testsuite/gnat.dg/renaming10.ads @@ -0,0 +1,9 @@ +package Renaming10 is + + type Rec is record + Position : Natural; + end record; + + function F (Input : Rec) return Natural; + +end Renaming10;