From 61e0b23353f25d12fd1925ccd2aaaf19f56ddbcb Mon Sep 17 00:00:00 2001
From: Eric Botcazou <ebotcazou@adacore.com>
Date: Mon, 16 Mar 2015 09:59:01 +0000
Subject: utils2.c (gnat_invariant_expr): Return null if the type of the
 expression ends up being composite.

	* gcc-interface/utils2.c (gnat_invariant_expr): Return null if the type
	of the expression ends up being composite.

From-SVN: r221449
---
 gcc/ada/gcc-interface/utils2.c | 6 ++++++
 1 file changed, 6 insertions(+)

(limited to 'gcc/ada/gcc-interface/utils2.c')

diff --git a/gcc/ada/gcc-interface/utils2.c b/gcc/ada/gcc-interface/utils2.c
index e04add9..e25b815 100644
--- a/gcc/ada/gcc-interface/utils2.c
+++ b/gcc/ada/gcc-interface/utils2.c
@@ -2805,6 +2805,12 @@ gnat_invariant_expr (tree expr)
       expr = remove_conversions (expr, false);
     }
 
+  /* We are only interested in scalar types at the moment and, even if we may
+     have gone through padding types in the above loop, we must be back to a
+     scalar value at this point.  */
+  if (AGGREGATE_TYPE_P (TREE_TYPE (expr)))
+    return NULL_TREE;
+
   if (TREE_CONSTANT (expr))
     return fold_convert (type, expr);
 
-- 
cgit v1.1