+2018-10-06 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/86111
+ * gfortran.h (enum arith): Add ARITH_WRONGCONCAT.
+ * arith.h (gfc_arith_error): Issue error for ARITH_WRONGCONCAT.
+ (gfc_arith_concat): If the types of op1 and op2 are not
+ character of if their kinds do not match, issue ARITH_WRONGCONCAT.
+
2018-10-06 Paul Thomas <pault@gcc.gnu.org>
- Backport from trunk
+ PR fortran/83999
* resolve.c (resolve_fl_procedure): Include class functions in
the test that elemental function results be scalar.
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");
}
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);
/* Arithmetic results. */
enum arith
{ ARITH_OK = 1, ARITH_OVERFLOW, ARITH_UNDERFLOW, ARITH_NAN,
- ARITH_DIV0, ARITH_INCOMMENSURATE, ARITH_ASYMMETRIC, ARITH_PROHIBIT
+ ARITH_DIV0, ARITH_INCOMMENSURATE, ARITH_ASYMMETRIC, ARITH_PROHIBIT,
+ ARITH_WRONGCONCAT
};
/* Statements. */
+2018-10-06 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/86111
+ * gfortran.dg/array_constructor_type_23.f90: New test.
+
2018-10-06 Paul Thomas <pault@gcc.gnu.org>
PR fortran/83999
--- /dev/null
+! { dg-do compile }
+! PR 83999 - this used to ICE
+! Origial test case by Gerhard Steinmetz
+
+program p
+ character(2) :: c = 'a' // [character :: [1]] ! { dg-error "Illegal type in character concatenation" }
+end