re PR fortran/69962 (ICE on missing parameter attribute, in gfc_set_constant_character_len)
2016-07-30 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/69962 * decl.c (gfc_set_constant_character_len): if expr is not constant issue an error instead of an ICE. 2016-07-30 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/69962 * gfortran.dg/pr69962.f90: New test. From-SVN: r238906
This commit is contained in:
parent
712dff3172
commit
b441ae1d89
@ -1,3 +1,9 @@
|
||||
2016-07-30 Steven G. Kargl <kargl@gcc.gnu.org>
|
||||
|
||||
PR fortran/69962
|
||||
* decl.c (gfc_set_constant_character_len): if expr is not
|
||||
constant issue an error instead of an ICE.
|
||||
|
||||
2016-07-30 Steven G. Kargl <kargl@gcc.gnu.org>
|
||||
|
||||
PR fortran/70006
|
||||
|
@ -1495,10 +1495,14 @@ gfc_set_constant_character_len (int len, gfc_expr *expr, int check_len)
|
||||
gfc_char_t *s;
|
||||
int slen;
|
||||
|
||||
gcc_assert (expr->expr_type == EXPR_CONSTANT);
|
||||
|
||||
if (expr->ts.type != BT_CHARACTER)
|
||||
return;
|
||||
|
||||
if (expr->expr_type != EXPR_CONSTANT)
|
||||
{
|
||||
gfc_error_now ("CHARACTER length must be a constant at %L", &expr->where);
|
||||
return;
|
||||
}
|
||||
|
||||
slen = expr->value.character.length;
|
||||
if (len != slen)
|
||||
|
@ -1,3 +1,8 @@
|
||||
2016-07-30 Steven G. Kargl <kargl@gcc.gnu.org>
|
||||
|
||||
PR fortran/69962
|
||||
* gfortran.dg/pr69962.f90: New test.
|
||||
|
||||
2016-07-30 Steven G. Kargl <kargl@gcc.gnu.org>
|
||||
|
||||
PR fortran/70006
|
||||
|
6
gcc/testsuite/gfortran.dg/pr69962.f90
Normal file
6
gcc/testsuite/gfortran.dg/pr69962.f90
Normal file
@ -0,0 +1,6 @@
|
||||
! { dg-do compile }
|
||||
program p
|
||||
integer :: n = 1
|
||||
character(3), parameter :: x(2) = ['abc', 'xyz']
|
||||
character(2), parameter :: y(2) = [x(2)(2:3), x(n)(1:2)] ! { dg-error "CHARACTER length must be a constant" }
|
||||
end
|
Loading…
Reference in New Issue
Block a user