mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-06 04:00:25 +08:00
Fortran: do not frontend-optimize MINLOC/MAXLOC for character arrays
gcc/fortran/ChangeLog: PR fortran/104811 * frontend-passes.cc (optimize_minmaxloc): Do not attempt frontend-optimization of MINLOC/MAXLOC for character arrays, as there is no suitable code yet for inline expansion. gcc/testsuite/ChangeLog: PR fortran/104811 * gfortran.dg/minmaxloc_16.f90: New test.
This commit is contained in:
parent
e480c3c06d
commit
e3e369dad6
@ -2276,6 +2276,7 @@ optimize_minmaxloc (gfc_expr **e)
|
||||
if (fn->rank != 1
|
||||
|| fn->value.function.actual == NULL
|
||||
|| fn->value.function.actual->expr == NULL
|
||||
|| fn->value.function.actual->expr->ts.type == BT_CHARACTER
|
||||
|| fn->value.function.actual->expr->rank != 1)
|
||||
return;
|
||||
|
||||
|
14
gcc/testsuite/gfortran.dg/minmaxloc_16.f90
Normal file
14
gcc/testsuite/gfortran.dg/minmaxloc_16.f90
Normal file
@ -0,0 +1,14 @@
|
||||
! { dg-do run }
|
||||
! { dg-options "-fdump-tree-original" }
|
||||
! PR fortran/104811
|
||||
! Frontend-optimization mis-optimized minloc/maxloc of character arrays
|
||||
|
||||
program p
|
||||
character(1) :: str(3)
|
||||
str = ["a", "c", "a"]
|
||||
if (any (maxloc (str) /= 2)) stop 1
|
||||
if (minloc (str,dim=1) /= 1) stop 2
|
||||
end
|
||||
|
||||
! { dg-final { scan-tree-dump-times "_gfortran_maxloc0_4_s1" 1 "original" } }
|
||||
! { dg-final { scan-tree-dump-times "_gfortran_minloc2_4_s1" 1 "original" } }
|
Loading…
x
Reference in New Issue
Block a user