PR fortran/98017 - Suspected regression using PACK
When substituting a parameter variable of type character, the character length was reset to 1. Fix this by copying the length. gcc/fortran/ChangeLog: * expr.c (simplify_parameter_variable): Fix up character length after copying an array-valued expression. gcc/testsuite/ChangeLog: * gfortran.dg/pr98017.f90: New test.
This commit is contained in:
parent
ccea13715b
commit
bb67ad5cff
@ -2096,6 +2096,9 @@ simplify_parameter_variable (gfc_expr *p, int type)
|
||||
return false;
|
||||
|
||||
e->rank = p->rank;
|
||||
|
||||
if (e->ts.type == BT_CHARACTER && p->ts.u.cl)
|
||||
e->ts = p->ts;
|
||||
}
|
||||
|
||||
if (e->ts.type == BT_CHARACTER && e->ts.u.cl == NULL)
|
||||
|
14
gcc/testsuite/gfortran.dg/pr98017.f90
Normal file
14
gcc/testsuite/gfortran.dg/pr98017.f90
Normal file
@ -0,0 +1,14 @@
|
||||
! { dg-do run }
|
||||
! PR98017 - [8/9/10/11 Regression] Suspected regression using PACK
|
||||
|
||||
program p
|
||||
implicit none
|
||||
character(*), parameter :: s(1) = ['abc()']
|
||||
character(*), parameter :: t(*) = s(:)(:1)
|
||||
if (len (pack (s, s(:)(:1) == 'a')) /= len (s)) stop 1
|
||||
if (any (pack (s, s(:)(:1) == 'a') /= s)) stop 2
|
||||
if (len (pack (s, t == 'a')) /= len (s)) stop 3
|
||||
if (any (pack (s, t == 'a') /= s)) stop 4
|
||||
if (len (pack (s(:)(1:5), t == 'a')) /= len (s)) stop 5
|
||||
if (any (pack (s(:)(1:5), t == 'a') /= s)) stop 6
|
||||
end
|
Loading…
Reference in New Issue
Block a user