<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/153426>153426</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[flang] `INQUIRE` statement returns incorrect `POSITION=`
</td>
</tr>
<tr>
<th>Labels</th>
<td>
flang:runtime
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
DanielCChen
</td>
</tr>
</table>
<pre>
Consider the following reducer:
```
character(10) decMode, pos
open (1, status='scratch', position='rewind')
inquire (1, decimal=decMode, position=pos)
if ((decMode /= 'POINT') .or. (pos /= 'REWIND')) ERROR STOP 1
write (1, *, decimal='COmma') 'abc', cmplx(2.2, 1.1), 10, 3.1
rewind (1)
open (1, position='rewind', status='old', decimal='coMMA')
inquire (1, decimal=decMode, position=pos)
print*, decMode
print*, pos
if ((decMode /= 'COMMA') .or. (pos /= 'REWIND')) ERROR STOP 2
close(1)
end
```
Flang failed as:
```
> a.out
COMMA
APPEND
Fortran ERROR STOP: code 2
```
The expected output is
```
> a.out
COMMA
REWIND
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJysVFGPozYQ_jXDi3XIDEsIDzzQZCPlYZM0t1WfjZkEV8amtrm9_vvKhLtsujq1lU5CioK_b75vvhksvFdXQ1RD8QsU20RMobeu3gqjSG82PZmktd1f9cYarzpyLPTELlZr-6bMlTnqJkkO8gZ4Ayu-PLxhjDHZCydkIAe4zjhgxTqSL7YjwA0brY-U-YlgO5JhERgPfRBh8pBvAUsvnQiyBywXmgrKmtuZozdluvmoupdS5s9JOfperSOpBqEh3z7qfysUrTzwL5EKuF7gDHAH-ZYBlqfj_vB602OpdWkEjta_Q5yff98ftoslrNjz-Xw8s8-vxxPL7hJvToW7QcDm0SdguTkOg1iUAEvRyiUBOYz6K-AaU4x_szSblTYsRrxhefpO5pbPolP9IOwfRvo4B6u_vX3wKe3LS_MzJzA6ZcI9kRn9-Pa2Ov8yqc3xu6__Pym8tyK19fQhQDLdPxYeeLPTwlzZRShNHRP-40cB-TMTqZ1CrHIzyBvWnE7Ph23kWxecMO-MQN4wGfvCj2qvPTH6OpIM1DE7hXEKTPn_pLh0_qFk0tV5V-WVSKjOyqLgVZkjT_qaVquqqHi7Xq8ryruqrYqqyCm_XAQ9teUlUTVyLPg6y7OCI-cpdrjiLW_bImvLslrDE6dBKJ1q_WVIrbsmyvuJ6qzIn3CVaNGS9vMlhHiJOULeuMkENRAgxpvJ1ZH6qZ2uHp64Vj74e7Gggp7vsBu32DJY8f3h19_252dY8XmRaSATmKMwOeOZMtI6RzJE5On4ef-6Px7iSq94Mjld9yGM8whxB7i7qtBPbSrtALiLqsvPp9HZP0gGwN3cjwfcLS19qfHvAAAA__8Q7H7n">