Regression tested on x86_64-*-freebsd. OK to commit?
2018-06-07 Steven G. Kargl
PR fortran/78571
* data.c (create_character_initializer): Return early if type is
incompatible with CHARACTER.
2018-06-07 Steven G. Kargl
PR fortran/78571
* gfortran.dg/pr78571.f90: New test.
--
Steve
Index: gcc/fortran/data.c
===
--- gcc/fortran/data.c (revision 261285)
+++ gcc/fortran/data.c (working copy)
@@ -107,7 +107,10 @@ create_character_initializer (gfc_expr *init, gfc_type
HOST_WIDE_INT len, start, end, tlen;
gfc_char_t *dest;
bool alloced_init = false;
-
+
+ if (init && init->ts.type != BT_CHARACTER)
+return NULL;
+
gfc_extract_hwi (ts->u.cl->length, );
if (init == NULL)
Index: gcc/testsuite/gfortran.dg/pr78571.f90
===
--- gcc/testsuite/gfortran.dg/pr78571.f90 (nonexistent)
+++ gcc/testsuite/gfortran.dg/pr78571.f90 (working copy)
@@ -0,0 +1,9 @@
+! { dg-do compile }
+! PR fortran/78571
+program p
+ type t
+ character :: c
+ end type
+ character :: x = t('a') ! { dg-error "convert TYPE" }
+ data x /'b'/
+end