PR fortran.67802

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
This commit is contained in:
Steven G. Kargl 2015-10-02 00:53:00 +00:00
parent 220ab6b433
commit d30ecc9c2b
4 changed files with 26 additions and 1 deletions

View File

@ -1,3 +1,9 @@
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

View File

@ -1439,7 +1439,12 @@ add_init_expr_to_sym (const char *name, gfc_expr **initp, locus *var_locus)
/* 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);

View File

@ -1,3 +1,8 @@
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

View File

@ -0,0 +1,9 @@
! { 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