Issue 115675
Summary [Flang] Compilation error when is_contiguous intrinsic procedure is used to define a variable
Labels flang:frontend
Assignees
Reporter ohno-fj
    ```
Version of flang-new : 20.0.0(74b56c7eb807e2ba54bd7a2bcfda5d0bceff1c0c)/AArch64
```

When `is_contiguous` intrinsic procedure is used in initialization, a compilation error occurs.  
The above program is `snggt825_2.f90`

For the following line
```
 logical,parameter::a03=is_contiguous(array(:,:,:)(1:4))
```
The following changes result in successful compilation:
```
 logical::a03
  a03=is_contiguous(array(:,:,:)(1:4))
```
The above program is `snggt825_3.f90`


The following are the test program, Flang-new, Gfortran and ifx compilation/execution result.

snggt825_2.f90:
```fortran
subroutine s0
 character(5) :: array(3,2,4)
 logical,parameter::a03=is_contiguous(array(:,:,:)(1:4))
  if (a03) print *,2003
end subroutine s0

program main
  call s0
  print *,'pass'
end program main
```

```
$ flang-new snggt825_2.f90
error: Semantic errors in snggt825_2.f90
./snggt825_2.f90:3:26: error: Must be a constant value
 logical,parameter::a03=is_contiguous(array(:,:,:)(1:4))
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
$
```

```
$ gfortran snggt825_2.f90; ./a.out
 pass
$
```

```
$ ifx snggt825_2.f90; ./a.out
 pass
$
```

snggt825_3.f90:
```fortran
subroutine s0
 character(5) :: array(3,2,4)
! logical,parameter::a03=is_contiguous(array(:,:,:)(1:4))
  logical::a03
 a03=is_contiguous(array(:,:,:)(1:4))
  if (a03) print *,2003
end subroutine s0

program main
  call s0
  print *,'pass'
end program main
```

```
$ flang-new snggt825_3.f90
 pass
$
```

```
$ gfortran snggt825_3.f90; ./a.out
 pass
$
```

```
$ ifx snggt825_3.f90; ./a.out
 pass
$
```

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to