aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/arith.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fortran/arith.c')
-rw-r--r--gcc/fortran/arith.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/gcc/fortran/arith.c b/gcc/fortran/arith.c
index 6f97d0f..98af27e 100644
--- a/gcc/fortran/arith.c
+++ b/gcc/fortran/arith.c
@@ -113,6 +113,11 @@ gfc_arith_error (arith code)
p =
_("Integer outside symmetric range implied by Standard Fortran at %L");
break;
+ case ARITH_WRONGCONCAT:
+ p =
+ _("Illegal type in character concatenation at %L");
+ break;
+
default:
gfc_internal_error ("gfc_arith_error(): Bad error code");
}
@@ -982,7 +987,12 @@ gfc_arith_concat (gfc_expr *op1, gfc_expr *op2, gfc_expr **resultp)
gfc_expr *result;
size_t len;
- gcc_assert (op1->ts.kind == op2->ts.kind);
+ /* By cleverly playing around with constructors, is is possible
+ to get mismaching types here. */
+ if (op1->ts.type != BT_CHARACTER || op2->ts.type != BT_CHARACTER
+ || op1->ts.kind != op2->ts.kind)
+ return ARITH_WRONGCONCAT;
+
result = gfc_get_constant_expr (BT_CHARACTER, op1->ts.kind,
&op1->where);