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

    <tr>
        <th>Summary</th>
        <td>
            When -ffast-math was specified on Clang command line, it seems to be impossible to later turn off FP contraction via pragmas
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          rygorous
      </td>
    </tr>
</table>

<pre>
    Example C code:

```
float g(float a, float b, float c) {
    return a * b + c;
}
#pragma float_control(precise, on)
#pragma STDC FP_CONTRACT OFF

float f(float a, float b, float c) {
    return a * b + c;
}
```

Compile for x86-64 with `-mfma -O2 -ffast-math`. Expectation is that g may use FMAs but f may not, but in fact both produce FMAs in Clang-14.0.0. Compiler Explorer link with repro: https://godbolt.org/z/TacbzWzxn

It works when there is no `-ffast-math` on the command line. Presumably the presence of that flag on the command line triggers some global override behavior?

I would love to just remove fast-math from the command line for the relevant TU, but this turns out to be problematic in the build setup for the project I need this in. I was asked to use pragmas for my use case instead, but can't properly because of the above problem.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy1U0FzmzwQ_TX4smMPERDHBw6JU8_k0KbTz9_02FnBAmqExEjCTvLruwLcJm2vxVispNXu231P0tYv5Ydn7AdNsIfK1pRkt0l6n6SX8Tpd3mnaaIsB2kTczBYmYg-zKX-ZVSJ2kGzv5jPAj6MwOgMIibgFyeMdO2WLQ7K9XwyRDQ7bHuc43yprgrOasw2OKuUpprCGo__u_9_xfg-Hz9_2j5-OX273R3g8HN6WMeNq_hXu902ax73tB8VtbayD55vr9XUOZxU6YLd13zDm9aOAddOgD-seQ8frG_jwPFAVMChrQHkIXew29PgCoyc4fLz1IEcuZFoyNkTscUEZaLDiYixnGJytx2px5529RtOur_JNyj9YcLmYS1vHhlbmacbmiM-yAqALYfBRCuLAb2traXXYWMfMH175f8RKvn59fTZvK34IcLbuycO5I8PYyVEswtip5neVMovRgRXX92jqCIE28NmRH3uU-mXaZNI9GS7ENnMnGo3t305CcKptyXnwtidotZWowZ7IOVUTSOrwpKxLsneaeGC0o-YI7AjBwvfRB-5AH6c_sULjbP9nwkhqXHSk6YQmwPH_CxWhi8SxajzYOLWcP1IiNXFAVUVG4lE5Kk7uWWDDz3Ds9p35hwcwRPUcSpkNz8_oAf1TXLSTFmbh--loP8ujQh6U8YGwvqCpkK_LNsTIAzlurKQKo_PUUwKUsdwF3mZVl1m9y3a4CipoKr9GIt8wN8HwLFHVKIZiF229603MrAIXRr1fqlf9YL1XnCIuaAwsuule2abhWwvTPWf5RtWfFF5qW41Ol78pkVU6yg3n44nWp8tnvXSOp8r7kTwbRb4Txaora6rTrWyy4iYvrpCKtBBZneeY7bJ0t93mK42StC-T4i4RwtAZphBsJ8X9SpUiFSLNr4r0utgJsdnKSoimSsW2wjSXIslTJlbpTcQRr8jKlRMkObaeN7Xywf_aRG5Ey-xO6Tg-jqGzrnQvrXV29Kspdzlh_wFwm9FU">