diff options
author | Steven G. Kargl <kargl@gcc.gnu.org> | 2016-07-30 19:24:49 +0000 |
---|---|---|
committer | Steven G. Kargl <kargl@gcc.gnu.org> | 2016-07-30 19:24:49 +0000 |
commit | b441ae1d89410e8f95a4c3317db0f52831bfaf0e (patch) | |
tree | b4f538f9fcb1ce39640cb256c19b2e74d57ca8b1 /gcc | |
parent | 712dff3172d503c496366d148c8e3fe018b584a5 (diff) | |
download | gcc-b441ae1d89410e8f95a4c3317db0f52831bfaf0e.zip gcc-b441ae1d89410e8f95a4c3317db0f52831bfaf0e.tar.gz gcc-b441ae1d89410e8f95a4c3317db0f52831bfaf0e.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/fortran/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/fortran/decl.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/pr69962.f90 | 6 |
4 files changed, 23 insertions, 2 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 3c137ee..5e8e7d1 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,5 +1,11 @@ 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 * io.c (gfc_resolve_dt): Use correct locus. * resolve.c (resolve_branch): Ditto. diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 7ff2f0d..ae68c09f 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -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) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6ead119..73e2258 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 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 * gfortran.dg/pr70006.f90: New test. diff --git a/gcc/testsuite/gfortran.dg/pr69962.f90 b/gcc/testsuite/gfortran.dg/pr69962.f90 new file mode 100644 index 0000000..2684398 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr69962.f90 @@ -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 |