aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2015-03-16 09:59:01 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2015-03-16 09:59:01 +0000
commit61e0b23353f25d12fd1925ccd2aaaf19f56ddbcb (patch)
tree7c70e180d4bfd57e81574e83006ce113fff743ba /gcc/ada
parent261cb0d3eb5e8160b88d729a2be684110ff48831 (diff)
downloadgcc-61e0b23353f25d12fd1925ccd2aaaf19f56ddbcb.zip
gcc-61e0b23353f25d12fd1925ccd2aaaf19f56ddbcb.tar.gz
gcc-61e0b23353f25d12fd1925ccd2aaaf19f56ddbcb.tar.bz2
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
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/ChangeLog5
-rw-r--r--gcc/ada/gcc-interface/utils2.c6
2 files changed, 11 insertions, 0 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index bfda926..e81f015 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,5 +1,10 @@
2015-03-16 Eric Botcazou <ebotcazou@adacore.com>
+ * gcc-interface/utils2.c (gnat_invariant_expr): Return null if the type
+ of the expression ends up being composite.
+
+2015-03-16 Eric Botcazou <ebotcazou@adacore.com>
+
* gcc-interface/decl.c (is_from_limited_with_of_main): New predicate.
(gnat_to_gnu_entity) <E_Subprogram_Type>: Invoke it on return and
parameter types to detect circularities in ASIS mode.
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);