Debian Codegraph @

gcc/testsuite/gfortran.dg/unpack_field_1.f90

raw
1 ! { dg-do compile }
2 ! PR fortran/107922 - ICE in gfc_simplify_unpack
3 ! Test error recovery when shapes of FIELD and MASK do not match
4 ! Contributed by G.Steinmetz
5
6 program p
7 integer, parameter :: a(2) = 1
8 integer, parameter :: d(3) = 1
9 logical, parameter :: mask(3) = [.false.,.true.,.false.]
10 integer, parameter :: b(2) = unpack(a,mask,a) ! { dg-error "must have identical shape" }
11 integer :: c(3) = unpack(a,[.false.,.true.,.false.],a) ! { dg-error "must have identical shape" }
12 print *, unpack(a,mask,a) ! { dg-error "must have identical shape" }
13 print *, unpack(a,mask,d) ! OK
14 print *, unpack(a,mask,3) ! OK
15 end
16
17 ! { dg-error "Cannot simplify expression" " " { target *-*-* } 12 }