diff options
author | Thomas Koenig <tkoenig@gcc.gnu.org> | 2019-10-13 13:42:30 +0000 |
---|---|---|
committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2019-10-13 13:42:30 +0000 |
commit | 19400cb96ce8fde3268d0b476d4d3c1efe3d3728 (patch) | |
tree | 02b5e02b1b6ad8df0c5496d920e7e438ef6d7f4c | |
parent | 855c21cb9af3e00ac10533f0525b038cf77eaa49 (diff) | |
download | gcc-19400cb96ce8fde3268d0b476d4d3c1efe3d3728.zip gcc-19400cb96ce8fde3268d0b476d4d3c1efe3d3728.tar.gz gcc-19400cb96ce8fde3268d0b476d4d3c1efe3d3728.tar.bz2 |
re PR fortran/92017 (ICE in gfc_expr_attr, at fortran/primary.c:2674)
2019-10-13 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/92017
* expr.c (simplify_parameter_variable): Set the character length
of the result expression from the original expression if
necessary.
2019-10-13 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/92017
* gfortran.dg/minmaxloc_14.f90: New test.
From-SVN: r276938
-rw-r--r-- | gcc/fortran/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/fortran/expr.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/minmaxloc_14.f90 | 12 |
4 files changed, 27 insertions, 0 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 82164d7..52f30dd 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2019-10-13 Thomas Koenig <tkoenig@gcc.gnu.org> + + PR fortran/92017 + * expr.c (simplify_parameter_variable): Set the character length + of the result expression from the original expression if + necessary. + 2019-10-11 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/91649 diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index 9f638fe..c508890 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -2066,6 +2066,9 @@ simplify_parameter_variable (gfc_expr *p, int type) e->rank = p->rank; + if (e->ts.type == BT_CHARACTER && e->ts.u.cl == NULL) + e->ts.u.cl = gfc_new_charlen (gfc_current_ns, p->ts.u.cl); + /* Do not copy subobject refs for constant. */ if (e->expr_type != EXPR_CONSTANT && p->ref != NULL) e->ref = gfc_copy_ref (p->ref); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3117a07..b914cb8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-10-13 Thomas Koenig <tkoenig@gcc.gnu.org> + + PR fortran/92017 + * gfortran.dg/minmaxloc_14.f90: New test. + 2019-10-13 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> * lib/target-supports.exp (add_options_for_c99_runtime): Remove. diff --git a/gcc/testsuite/gfortran.dg/minmaxloc_14.f90 b/gcc/testsuite/gfortran.dg/minmaxloc_14.f90 new file mode 100644 index 0000000..d24d03f --- /dev/null +++ b/gcc/testsuite/gfortran.dg/minmaxloc_14.f90 @@ -0,0 +1,12 @@ +! { dg-do compile } +! PR 92017 - this used to cause an ICE due do a missing charlen. +! Original test case by Gerhard Steinmetz. + +program p + character(3), parameter :: a(4) = 'abc' + integer, parameter :: b(1) = minloc(a) + integer, parameter :: c = minloc(a, dim=1) + integer, parameter :: bb(1) = maxloc(a) + integer, parameter :: c2 = maxloc(a,dim=1) +end program p + |