Consider this code (simplified from a large code):
module m1
implicit none
type a
integer :: b
real, dimension(0:234) :: c
end type
type(a), allocatable, dimension(:) :: h
end module
module m2
use m1
implicit none
contains
subroutine m(d,e,f,g)
implicit none
real, intent(in) :: d(:)
real, intent(inout), dimension(:,:) :: e
real, intent(inout), dimension(:) :: f
real, intent(inout), dimension(:) :: g
where ( f(:) <= 1.)
g(:) = h(1)%c(0) + matmul(e(:,:),h(1)%c(1:h(1)%b))
endwhere
end subroutine
end module
Compiling with -O0 works perfectly fine, with -O3 I get
error: loc("/app/example.f90":27:7): null operand found
error: Lowering to LLVM IR failed
error: loc("/app/example.f90":1:1): LLVM Translation failed for operation: fir.global
error: failed to create the LLVM module
Consider this code (simplified from a large code):
```
module m1
implicit none
type a
integer :: b
real, dimension(0:234) :: c
end type
type(a), allocatable, dimension(:) :: h
end module
module m2
use m1
implicit none
contains
subroutine m(d,e,f,g)
implicit none
real, intent(in) :: d(:)
real, intent(inout), dimension(:,:) :: e
real, intent(inout), dimension(:) :: f
real, intent(inout), dimension(:) :: g
where ( f(:) <= 1.)
g(:) = h(1)%c(0) + matmul(e(:,:),h(1)%c(1:h(1)%b))
endwhere
end subroutine
end module
```
Compiling with -O0 works perfectly fine, with -O3 I get
error: loc("/app/example.f90":27:7): null operand found
error: Lowering to LLVM IR failed
error: loc("/app/example.f90":1:1): LLVM Translation failed for operation: fir.global
error: failed to create the LLVM module
See https://fortran.godbolt.org/z/8Wfxn1dsa
Workaround is to split the assignment into two lines, i.e.
g(:) = h(1)%c(0)
g(:) = g(:) + matmul(e(:,:),h(1)%c(1:h(1)%b))
Consider this code (simplified from a large code):
```
module m1
implicit none
type a
integer :: b
real, dimension(0:234) :: c
end type
type(a), allocatable, dimension(:) :: h
end module
module m2
use m1
implicit none
contains
subroutine m(d,e,f,g)
implicit none
real, intent(in) :: d(:)
real, intent(inout), dimension(:,:) :: e
real, intent(inout), dimension(:) :: f
real, intent(inout), dimension(:) :: g
where ( f(:) <= 1.)
g(:) = h(1)%c(0) + matmul(e(:,:),h(1)%c(1:h(1)%b))
endwhere
end subroutine
end module
```
Compiling with -O0 works perfectly fine, with -O3 I get
error: loc("/app/example.f90":27:7): null operand found
error: Lowering to LLVM IR failed
error: loc("/app/example.f90":1:1): LLVM Translation failed for operation: fir.global
error: failed to create the LLVM module
See https://fortran.godbolt.org/z/8Wfxn1dsa
Workaround is to split the assignment into two lines, i.e.
g(:) = h(1)%c(0)
g(:) = g(:) + matmul(e(:,:),h(1)%c(1:h(1)%b))
Consider this code (simplified from a large code):
Compiling with -O0 works perfectly fine, with -O3 I get error: loc("/app/example.f90":27:7): null operand found error: Lowering to LLVM IR failed error: loc("/app/example.f90":1:1): LLVM Translation failed for operation: fir.global error: failed to create the LLVM module
See https://fortran.godbolt.org/z/8Wfxn1dsa
Workaround is to split the assignment into two lines, i.e.
g(:) = h(1)%c(0) g(:) = g(:) + matmul(e(:,:),h(1)%c(1:h(1)%b))