Issue 153830
Summary [flang] The result value of the `SIZE=` specifier in READ
Labels question, flang:frontend
Assignees
Reporter DanielCChen
    Consider the following code.
```
    character(13) c
    real r1(3), r2(3)
 integer i1, i2
 
    c = '1.2, 1.2, 1.2'
 
    write (2, '(2a)') c, ' '
 
    write (3, '(2a)') c, ','
 
    rewind 2
    rewind 3
 
    read (2, '(3F5.1)', advance='no', size=i1) r1
print*, i1
 
    read (3, '(3F5.1)', advance='no', size=i2) r2
print*, i2
 
    end
```

XLF returns 
```
12
11
```
Because we count the blanks but not the comma. So the first read is 3 records of  `1.2 ` that has 4 characters. The 2nd read is 3 records with the first two being `1.2 ` and the 3rd one `1.2` (without blank because of the comma appended.
gfortran is consistent with XLF.

ifort outputs
```
14
14
```
ifort seems count everything including blanks and the commas.

Flang outputs
```
9
14
```
It seems inconsistent to me.

I am clarifying with J3, but it seems comma should not be part of the input field.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to