2015-10-01 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran.67802
* decl.c (add_init_expr_to_sym): Numeric constant for character
length must be an INTEGER.
2015-10-01 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran.67802
* gfortran.dg/pr67802.f90: New test.
From-SVN: r228365
+2015-10-01 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran.67802
+ * decl.c (add_init_expr_to_sym): Numeric constant for character
+ length must be an INTEGER.
+
2015-10-01 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/66979
/* Update initializer character length according symbol. */
else if (sym->ts.u.cl->length->expr_type == EXPR_CONSTANT)
{
- int len = mpz_get_si (sym->ts.u.cl->length->value.integer);
+ int len;
+
+ if (!gfc_specification_expr (sym->ts.u.cl->length))
+ return false;
+
+ len = mpz_get_si (sym->ts.u.cl->length->value.integer);
if (init->expr_type == EXPR_CONSTANT)
gfc_set_constant_character_len (len, init, -1);
+2015-10-01 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran.67802
+ * gfortran.dg/pr67802.f90: New test.
+
2015-10-01 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/66979
--- /dev/null
+! { dg-do compile }
+! PR fortran/67802
+! Original code contribute by gerhard.steinmetz.fortran at t-online.de
+program p
+ character(1.) :: c1 = ' ' ! { dg-error "must be of INTEGER" }
+ character(1d1) :: c2 = ' ' ! { dg-error "must be of INTEGER" }
+ character((0.,1.)) :: c3 = ' ' ! { dg-error "must be of INTEGER" }
+ character(.true.) :: c4 = ' ' ! { dg-error "must be of INTEGER" }
+end program p