aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2018-07-17 08:11:22 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2018-07-17 08:11:22 +0000
commit03b4b15ec70e28f945fab896d4574e3953fa2272 (patch)
tree58a4c3dfe6342356cddf398eab011ff122f906e2
parent69720717c143a9dc77d4c52dd5e2f19858425fa8 (diff)
downloadgcc-03b4b15ec70e28f945fab896d4574e3953fa2272.zip
gcc-03b4b15ec70e28f945fab896d4574e3953fa2272.tar.gz
gcc-03b4b15ec70e28f945fab896d4574e3953fa2272.tar.bz2
[Ada] ICE on renaming of result of binary operation
2018-07-17 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Variable>: Deal with more rvalues in the expression of a renaming. From-SVN: r262793
-rw-r--r--gcc/ada/ChangeLog5
-rw-r--r--gcc/ada/gcc-interface/decl.c11
2 files changed, 10 insertions, 6 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 99ae0ea..ae2ab5d 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,5 +1,10 @@
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-07-17 Eric Botcazou <ebotcazou@adacore.com>
+
* gcc-interface/ada-tree.h (TYPE_RETURN_BY_DIRECT_REF_P): Define for
METHOD_TYPE too.
(TYPE_RETURN_UNCONSTRAINED_P): Likewise.
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index 123fefb..50d20e6 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -969,8 +969,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);
@@ -981,11 +980,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. */
@@ -1007,7 +1006,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)))
;