https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106071
Bug ID: 106071
Summary: single where run error
Product: gcc
Version: 12.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: [email protected]
Target Milestone: ---
two layer where work ok, why single where work error?
example one:
program test
real :: x(3) = 1, y(3) = 2
logical :: m(3) = .true., m2(3) = .false.
where (m)
x = f1()
!where (m2)
! y = f2()
!end where
end where
if (any(x/=3)) then
print *, 'FAIL', x
!if (any(x/=3 .or. y/=3)) then
! print *,'FAIL',x,y
else
print *,'ok'
end if
contains
function f1()
m = .false.
!m2 = .true.
f1 = 3
end function
!function f2()
! m2 = .false.
! f2 = 3
!end function
end
gfortran-12:
ASM generation compiler returned: 0
Execution build compiler returned: 0
Program returned: 0
FAIL 3.00000000 1.00000000 1.00000000
example two:
program test
real :: x(3) = 1, y(3) = 2
logical :: m(3) = .true., m2(3) = .false.
where (m)
x = f1()
where (m2)
y = f2()
end where
end where
if (any(x/=3 .or. y/=3)) then
print *,'FAIL',x,y
else
print *,'ok'
end if
contains
function f1()
m = .false.
m2 = .true.
f1 = 3
end function
function f2()
m2 = .false.
f2 = 3
end function
end
ASM generation compiler returned: 0
Execution build compiler returned: 0
Program returned: 0
ok
Looking forward to hearing from you!