aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/intrinsic.c
diff options
context:
space:
mode:
authorSteven G. Kargl <kargl@gcc.gnu.org>2018-12-16 16:29:43 +0000
committerSteven G. Kargl <kargl@gcc.gnu.org>2018-12-16 16:29:43 +0000
commite9b75848c387d7c40ae8099b29f76bf473feb728 (patch)
tree3324a2d41b9da5469722a0846b912698fac5f58e /gcc/fortran/intrinsic.c
parent26ca4e0587542437e2aae4682a63efe50523d738 (diff)
downloadgcc-e9b75848c387d7c40ae8099b29f76bf473feb728.zip
gcc-e9b75848c387d7c40ae8099b29f76bf473feb728.tar.gz
gcc-e9b75848c387d7c40ae8099b29f76bf473feb728.tar.bz2
re PR fortran/88116 (ICE in gfc_convert_constant(): Unexpected type)
2018-12-16 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/88116 PR fortran/88467 * array.c (gfc_match_array_constructor): Check return value of gfc_convert_type(). Skip constructor elements with BT_UNKNOWN, which need to go through resolution. * intrinsic.c (gfc_convert_type_warn): Return early if the types martch (i.e., no conversion is required). * simplify.c (gfc_convert_constant): Remove a gfc_internal_error, and return gfc_bad_expr. 2018-12-16 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/88116 * gfortran.dg/pr88116_1.f90: New test. * gfortran.dg/pr88116_2.f90: Ditto. PR fortran/88467 * gfortran.dg/pr88467.f90: New test. From-SVN: r267189
Diffstat (limited to 'gcc/fortran/intrinsic.c')
-rw-r--r--gcc/fortran/intrinsic.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c
index 8c18706..0e0e6fe 100644
--- a/gcc/fortran/intrinsic.c
+++ b/gcc/fortran/intrinsic.c
@@ -5030,6 +5030,13 @@ gfc_convert_type_warn (gfc_expr *expr, gfc_typespec *ts, int eflag, int wflag)
if (expr->ts.type == BT_UNKNOWN)
goto bad;
+ /* In building an array constructor, gfortran can end up here when no
+ conversion is required for an intrinsic type. We need to let derived
+ types drop through. */
+ if (from_ts.type != BT_DERIVED
+ && (from_ts.type == ts->type && from_ts.kind == ts->kind))
+ return true;
+
if (expr->ts.type == BT_DERIVED && ts->type == BT_DERIVED
&& gfc_compare_types (&expr->ts, ts))
return true;