Skip to content

Array constructors fail #1227

@zaikunzhang

Description

@zaikunzhang

Flang fails to compile the following piece of code, which seems 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

This 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.2-0). The error message looks like the following.

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

nvfortran 22.2-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

I am not sure whether this is related to issue #1200.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions