https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66128
--- Comment #5 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Thu, Mar 01, 2018 at 10:31:42PM +0000, kargl at gcc dot gnu.org wrote:
> (In reply to Harald Anlauf from comment #3)
> > Maybe some kind of "shortcut" (similar to Steve's fix for pr83998) can
> > solve this. Not sure where this would fit in.
>
> I have a patch for at least the ANY and ALL problem. :-)
>
Well, the simply obvious patch
gfc_expr *
gfc_simplify_any (gfc_expr *mask, gfc_expr *dim)
{
+ /* Check for zero sized array. sgk */
+ if (mask->rank > 0 && mask->shape == NULL)
+ return gfc_get_logical_expr (mask->ts.kind, &mask->where, false);
+
return simplify_transformation (mask, dim, NULL, false, gfc_or);
}
cause a bunch of regressions. One is given by
! { dg-do run }
! PR 71795 - wrong result when putting an array constructor
! instide an iterator.
program test
implicit none
integer :: i,n
logical, dimension(1) :: ra
logical :: rs
integer, allocatable :: a(:)
allocate ( a(1) )
n = 1
a = 2
rs = any ( (/ (any(a(i).eq.(/1,2,3/)) ,i=1,n) /) )
if (.not. rs) call abort
end program test
which is odd. The code never goes through the
if () statement as mask->shape is always non-null.
So, the code should compile as-if I never made
a change to gfc_simplify_any.
:(