Array constructor fails in `nvfortran 22.3-0`

nvfortran 22.3.0 on Ubuntu 20.04 fails to compile the following piece of code, which is standard-conforming.

! test_flang.f90
program test_flang
implicit none

integer, parameter :: m = 2
integer, parameter :: n = 100
integer, parameter :: k = 50
real :: x(m, n)

write (*, *) [x(:, k + 1:n), x(:, 1:k)]

end program test_flang

The error message looks like the following.

nvfortran --version && nvfortran test_flang.f90 && ./a.out

nvfortran 22.3-0 64-bit target on x86-64 Linux -tp haswell 
NVIDIA Compilers and Tools
Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES.  All rights reserved.
NVFORTRAN-S-0152-All dimension specifiers must be ':' (test_flang.f90: 9)
NVFORTRAN-S-0152-All dimension specifiers must be ':' (test_flang.f90: 9)
  0 inform,   0 warnings,   2 severes, 0 fatal for test_flang

This bug affects all the flang-based compilers, including the classic flang (7.0.1), Huawei Bisheng flang (Bisheng Compiler 1.3.3.b023), AOCC flang (AMD clang version 13.0.0), and nvfortran (22.3-0).

The bug has been reported to the classic flang developers, who seem to have fixed it.

Thank you for having a look at it.

Thanks zaikunzhang, I’ve filed this as TPR #31580.

-Mat

1 Like

Many thanks!

Hi Zaikunzhang,

FYI, TPR #31580 has been fixed in our 22.9 release.

% nvfortran test_flang.f90 -V22.7
NVFORTRAN-S-0152-All dimension specifiers must be ':' (test_flang.f90: 10)
NVFORTRAN-S-0152-All dimension specifiers must be ':' (test_flang.f90: 10)
  0 inform,   0 warnings,   2 severes, 0 fatal for test_flang
% nvfortran test_flang.f90 -V22.9
%

-Mat

Great! Thank you!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.