> flang --version
AMD clang version 16.0.3 (CLANG: AOCC_4.1.0-Build#270 2023_07_10)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/aocc-compiler-4.1.0/bin
> flang test_rank.F90 && ./a.out
ERROR: rank = 1 , expected 2
> cat test_rank.F90
module test_rank_mod
implicit none
contains
subroutine get_rank(this, expected)
integer, dimension(..) :: this
integer :: expected
if(rank(this) .ne. expected) then
print '(A,I2,A,I2)', 'ERROR: rank = ',rank(this), ' , expected ',expected
endif
end
end module
program test_rank
use test_rank_mod
implicit none
integer, dimension(1) :: a1
integer, dimension(1,2) :: a2
call get_rank(a1, 1)
call get_rank(a2, 2)
end
the compiler did not report any compile time error and produced an erroneous result