<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/59103>59103</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [flang] Link error of ACOS intrinsic function
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          ohno-fj
      </td>
    </tr>
</table>

<pre>
    ```
Version of flang-new : 16.0.0(e0fb01e97b6b7d2fe66b17b36eeb98aa78c6e3bb)
```

`ACOS` intrinsic function results in a link-time error (undefined reference).  
If the function argument is a constant, the compilation succeeds.  
The following intrinsic functions can be compiled and executed:  
  `SIN`, `COS`, `TAN`, `ATAN`   
GNU's Fortran compiler is OK.  

The following are the test program, flang-new compilation results, and gfortran compilation results.  

x002.f90:
```fortran
program main
  real(4) ae
  real(8) ad
  ae = 0e0
  ad = 0d0
  write(6,*) "ACOS(ae)  = ", ACOS(ae)
  write(6,*) "ACOS(ad)  = ", ACOS(ad)
end program main
```

```
$ flang-new -flang-experimental-exec x002.f90
/tmp/x002-d5f797.o: In function `_QQmain':
/home/users/ea01/ea0178/CT/fort/tp/reproducer/f90user/./x002.f90:6: undefined reference to `__fs_acos_1'
/home/users/ea01/ea0178/CT/fort/tp/reproducer/f90user/./x002.f90:7: undefined reference to `__fd_acos_1'
flang-new: error: linker command failed with exit code 1 (use -v to see invocation)
$
```

```
$ gfortran x002.f90
$ ./a.out
 ACOS(ae)  =    1.57079637
 ACOS(ad)  =    1.5707963267948966
$
```

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy1VUtv4zYQ_jXyhbBAUTIlHXRwE7gIWuxisWmvASWObG5l0iCpJP33nZFlJfF6-zjUEERqhpzvm6dbp_9sEsnnh98nfPs7-GCcZa5n_aDsfm3hhSX5lmUy5SlPRAW8b3kGddnKttSiBynbrGxzCdDWlVJl1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