<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/144453>144453</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[flang] pseudopositive warning to function result that is set, pseudonegative warning to subroutine INTENT(OUT) parameter that is not set
</td>
</tr>
<tr>
<th>Labels</th>
<td>
flang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
e-kwsm
</td>
</tr>
</table>
<pre>
```console
$ flang --version
flang version 20.1.6
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
```
Prepare the following file:
```fortran
program main
implicit none
logical :: x0, x1
print *, f0(), f1()
call s0(x0)
call s1(x1)
print *, x0, x1
contains
function f0()
! "Function result is never defined", as expected
logical :: f0
end function
function f1()
! "Function result is never defined", but f1 is definitely set
logical :: f1
INQUIRE(file="/usr/bin/flang", EXIST=f1)
end function f1
subroutine s0(x)
! NO warning, but x is NOT set
logical, INTENT(OUT) :: x
end subroutine
subroutine s1(x)
! no warning as expected, but inconsistent with f1
logical, INTENT(OUT) :: x
INQUIRE(file="/usr/bin/flang", EXIST=x)
end subroutine
end program
```
`INQUIRE` assigns the `EXIST=` specifier to T or F, so the result of `f1` is set. Also, `s0` does not set a value to `x` that is specified as `intent(out)`, but no warning is issued.
```console
$ flang a.F90
./a.F90:12:12: warning: Function result is never defined
function f0()
^^
./a.F90:17:12: warning: Function result is never defined
function f1()
^^
```
Expected:
```console
$ flang a.F90
./a.F90:12:12: warning: Function result is never defined
function f0()
^^
./a.F90:23:17: warning: Subroutine parameter x specified as INTENT(OUT) is never defined
subroutine s0(x)
^
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzEVstu6zYQ_Rp6Q9igqIethRZqHQHZJG2vL9BdQUkjmS1NCiTl-P59MXrZUdIH2gINjESZ4ZwzPPOwhHOy1QAZib8j8XEjen82NoPtb2_usilN_S0jCRs_ldHOKCAsJ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