aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fortran/trans.c')
-rw-r--r--gcc/fortran/trans.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c
index 2927728..00215f6 100644
--- a/gcc/fortran/trans.c
+++ b/gcc/fortran/trans.c
@@ -146,6 +146,16 @@ gfc_add_modify_expr (stmtblock_t * pblock, tree lhs, tree rhs)
{
tree tmp;
+#ifdef ENABLE_CHECKING
+ /* Make sure that the types of the rhs and the lhs are the same
+ for scalar assignments. We should probably have something
+ similar for aggregates, but right now removing that check just
+ breaks everything. */
+ if (TREE_TYPE (rhs) != TREE_TYPE (lhs)
+ && !AGGREGATE_TYPE_P (TREE_TYPE (lhs)))
+ abort ();
+#endif
+
tmp = fold (build_v (MODIFY_EXPR, lhs, rhs));
gfc_add_expr_to_block (pblock, tmp);
}