-2015-10-29 Steven G. Kargl <kargl@gcc.gnu.org>
+2015-10-30 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/68154
+ * decl.c (add_init_expr_to_sym): if the char length in the typespec
+ is NULL, check for and use a constructor.
+2015-10-30 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/68054
* decl.c (match_attr_spec): PROTECTED can only be a module.
}
else if (init->expr_type == EXPR_ARRAY)
{
- clen = mpz_get_si (init->ts.u.cl->length->value.integer);
+ if (init->ts.u.cl)
+ clen = mpz_get_si (init->ts.u.cl->length->value.integer);
+ else if (init->value.constructor)
+ {
+ gfc_constructor *c;
+ c = gfc_constructor_first (init->value.constructor);
+ clen = c->expr->value.character.length;
+ }
+ else
+ gcc_unreachable ();
sym->ts.u.cl->length
= gfc_get_int_expr (gfc_default_integer_kind,
NULL, clen);
+2015-10-30 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/68154
+ *gfortran.dg/pr68154.f90
+
2015-10-29 Nathan Sidwell <nathan@codesourcery.com>
* c-c++-common/goacc/acc_on_device-2-off.c: Delete.
--- /dev/null
+! { dg-do compile }
+! PR fortran/68154
+! Original code contributed by Gerhard Steinmetz
+! gerhard dot steinmetz dot fortran at t-online dot de
+program p
+ character(1), parameter :: x1(2) = 'a'
+ character(*), parameter :: x2(2) = x1
+ character(*), parameter :: x3(*) = x1
+end