diff options
-rw-r--r-- | gcc/fortran/intrinsic.cc | 3 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/pr103779.f90 | 18 |
2 files changed, 20 insertions, 1 deletions
diff --git a/gcc/fortran/intrinsic.cc b/gcc/fortran/intrinsic.cc index 68f4814..17ee999 100644 --- a/gcc/fortran/intrinsic.cc +++ b/gcc/fortran/intrinsic.cc @@ -5419,7 +5419,8 @@ gfc_convert_chartype (gfc_expr *expr, gfc_typespec *ts) gcc_assert (expr->ts.type == BT_CHARACTER && ts->type == BT_CHARACTER); sym = find_char_conv (&expr->ts, ts); - gcc_assert (sym); + if (sym == NULL) + return false; /* Insert a pre-resolved function call to the right function. */ old_where = expr->where; diff --git a/gcc/testsuite/gfortran.dg/pr103779.f90 b/gcc/testsuite/gfortran.dg/pr103779.f90 new file mode 100644 index 0000000..3d76c90 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr103779.f90 @@ -0,0 +1,18 @@ +! { dg-do compile } +! PR fortran/69636 +! PR fortran/103779 +! Contributed by G.Steinmetz + +character(1,) function f() ! { dg-error "Expected initialization expression" } + f = 'a' +end + +character(1,kind=) function g() ! { dg-error "Expected initialization expression" } + g = 'a' +end + +character(1,n) function h() ! { dg-error "has not been declared" } + h = 'a' +end + +! { dg-prune-output "Bad kind expression" } |