Issue |
142325
|
Summary |
[Flang] Compilation error of unlimited-format-item specified in FORMAT statement with double parentheses
|
Labels |
flang:frontend
|
Assignees |
|
Reporter |
ohno-fj
|
```
Version of flang : 21.0.0(9513284f25545029de68f7e09bc5c1606636c489)/AArch64
```
In the attached program (`unlimited_format_item011.f90`), `unlimited-format-item : *(G0," ",G0,",")` specified in `FORMAT statement` with double parentheses results in a compilation error.
Compilation ends normally in the following cases:
- do not use `unlimited-format-item`
see `unlimited_format_item021.f90` below.
- format statement with one parenthesis
see `unlimited_format_item031.f90` below.
>From the above, when `FORMAT statement with double parentheses` or `unlimited-format-item` is used alone, compilation ends normally.
It seems to be a problem when the two are used together.
The following are the test program, Flang, Gfortran and ifx compilation/execution result.
unlimited_format_item011.f90:
```fortran
subroutine sub
integer::aa,bb
character(20)::ch,bh
logical::ll
ll=.true.
aa=10
bb=20
ch = "black"
bh = "blue"
open(100,file="fort.03",action=""
write(100,10)ll,aa,ch,bb,bh,aa,ch,bb,bh
10 format((l1," ",*(G0," ",G0,",")))
close(100)
end subroutine sub
program main
call sub
print*,"pass"
end program main
```
```
$ flang unlimited_format_item011.f90
error: Could not parse unlimited_format_item011.f90
./unlimited_format_item011.f90:12:11: error: expected ')'
10 format((l1," ",*(G0," ",G0,",")))
^
./unlimited_format_item011.f90:12:4: in the context: FORMAT statement
10 format((l1," ",*(G0," ",G0,",")))
^
./unlimited_format_item011.f90:12:1: in the context: execution part construct
10 format((l1," ",*(G0," ",G0,",")))
^
./unlimited_format_item011.f90:12:11: error: expected one of '+-'
10 format((l1," ",*(G0," ",G0,",")))
^
./unlimited_format_item011.f90:12:4: in the context: pointer assignment statement
10 format((l1," ",*(G0," ",G0,",")))
^
./unlimited_format_item011.f90:12:1: in the context: execution part construct
10 format((l1," ",*(G0," ",G0,",")))
^
$
```
```
$ gfortran unlimited_format_item011.f90; ./a.out
pass
$
```
```
$ ifx unlimited_format_item011.f90; ./a.out
pass
$
```
unlimited_format_item021.f90:
```fortran
subroutine sub
integer::aa,bb
character(20)::ch,bh
logical::ll
ll=.true.
aa=10
bb=20
ch = "black"
bh = "blue"
open(100,file="fort.03",action=""
write(100,10)ll,aa,ch,bb,bh,aa,ch,bb,bh
10 format((l1," ",G0," ",G0,",",G0," ",G0,",",G0," ",G0,",",G0," ",G0,","))
close(100)
end subroutine sub
program main
call sub
print*,"pass"
end program main
```
```
$ flang unlimited_format_item021.f90; ./a.out
pass
$
```
unlimited_format_item031.f90:
```fortran
subroutine sub
integer::aa,bb
character(20)::ch,bh
logical::ll
ll=.true.
aa=10
bb=20
ch = "black"
bh = "blue"
open(100,file="fort.03",action=""
write(100,10)ll,aa,ch,bb,bh,aa,ch,bb,bh
10 format(l1," ",*(G0," ",G0,","))
close(100)
end subroutine sub
program main
call sub
print*,"pass"
end program main
```
```
$ flang unlimited_format_item031.f90; ./a.out
pass
$
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs