]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
decl.c (gnat_to_gnu_entity): Deal with more rvalues in the expression of a renaming.
authorEric Botcazou <ebotcazou@adacore.com>
Tue, 17 Jul 2018 09:23:31 +0000 (09:23 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Tue, 17 Jul 2018 09:23:31 +0000 (09:23 +0000)
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Variable>: Deal with
more rvalues in the expression of a renaming.

From-SVN: r262809

gcc/ada/ChangeLog
gcc/ada/gcc-interface/decl.c

index cda6b623efbc72f1459dad57d026213c80ca710d..feee3e83293c73766b2f0e3e779ede1886e8224a 100644 (file)
@@ -1,3 +1,8 @@
+2018-07-17  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Variable>: Deal with
+       more rvalues in the expression of a renaming.
+
 2018-06-12  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gcc-interface/ada-tree.h (TYPE_RETURN_BY_DIRECT_REF_P): Change from
index d2316afc8f1c9e716aa6e3707df3efc84d84411d..1ea6a473434eea9eaf248632a548dc2278bacf9f 100644 (file)
@@ -972,8 +972,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
               function call is a constant object.  Therefore, it can be the
               inner object of a constant renaming and the renaming must be
               fully instantiated, i.e. it cannot be a reference to (part of)
-              an existing object.  And treat other rvalues (addresses, null
-              expressions, constructors and literals) the same way.  */
+              an existing object.  And treat other rvalues the same way.  */
            tree inner = gnu_expr;
            while (handled_component_p (inner) || CONVERT_EXPR_P (inner))
              inner = TREE_OPERAND (inner, 0);
@@ -984,11 +983,11 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
              inner = TREE_OPERAND (inner, 1);
            if ((TREE_CODE (inner) == CALL_EXPR
                 && !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)
+               || COMPARISON_CLASS_P (inner)
+               || BINARY_CLASS_P (inner)
+               || EXPRESSION_CLASS_P (inner)
                /* We need to detect the case where a temporary is created to
                   hold the return value, since we cannot safely rename it at
                   top level as it lives only in the elaboration routine.  */
@@ -1010,7 +1009,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
                   underlying object lives only in the elaboration routine.  */
                || (TREE_CODE (inner) == INDIRECT_REF
                    && (inner
-                         = remove_conversions (TREE_OPERAND (inner, 0), true))
+                       = remove_conversions (TREE_OPERAND (inner, 0), true))
                    && TREE_CODE (inner) == VAR_DECL
                    && DECL_RETURN_VALUE_P (inner)))
              ;