<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Default fp-contract behavior does not match documentation"
href="https://bugs.llvm.org/show_bug.cgi?id=50222">50222</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Default fp-contract behavior does not match documentation
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Driver
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>andrew.kaylor@intel.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>According to the clang documentation for '-ffp-contract'
(<a href="https://clang.llvm.org/docs/UsersManual.html#cmdoption-ffp-contract">https://clang.llvm.org/docs/UsersManual.html#cmdoption-ffp-contract</a>), the
fp-contract state defaults to 'on' for languages other than CUDA/HIP .
The documentation for '-ffp-model'
(<a href="https://clang.llvm.org/docs/UsersManual.html#cmdoption-ffp-model">https://clang.llvm.org/docs/UsersManual.html#cmdoption-ffp-model</a>) says that
'-ffp-model=precise' implicitly enables '-ffp-contract=fast' and that 'precise'
is the default.
It appears that the current behavior (at least for C input with an x86-64
target) is equivalent to -fp-contract=off when the '-ffp-model' option isn't
used.
<a href="https://godbolt.org/z/7YM75hK9e">https://godbolt.org/z/7YM75hK9e</a>
Obviously, the documentation for the default settings for fp-contract and
fp-model are contradictory. I think the default described in the fp-contract
documentation is correct and that setting should be used by -ffp-model=precise.
Apart from the fp-contract setting, the default state is equivalent to
fp-model=precise.
So, three things should happen:
1) Fix whatever it is that's causing clang to default to fp-contract=off.
2) The clang toolchain code that handles -ffp-model should be changed to use
fp-contract=on instead of fp-contract=fast for the precise model.
3) Update the fp-model documentation.
FWIW, there was at one time a problem with one of the backends that was exposed
if fp-contract was enabled at -O0. That may be why the default behavior isn't
as documented.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>