<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/66555>66555</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Complex division doesn't respect pragma float_control
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang:codegen,
floating-point
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
andykaylor
</td>
</tr>
</table>
<pre>
If I am compiling with fast-math enabled, but use #pragma float_control(precise, on) for a function, complex division within that function is still represented as if fast math were enabled.
```
#pragma float_control(precise, on)
complex double foo(complex double x, complex double y) {
return x / y;
}
```
https://godbolt.org/z/3sP44nEE5
This is happening because ComplexExprEmitter::EmitBinDiv() is checking CGF.getLangOpts().FastMath and not looking for the possibility that the option is being overridden by a pragma.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMU8GOpDYQ_RpzKQ2iC-huDhxmuodopUTJIffI2AU4a2xkF73d-frI0LtJRnOIhEB-PKreq1fIGM3oiFpRv4n6msmVJx9a6fTjq3xYH7Le60f7ZYAvIGdQfl6MNW6Eb4YnGGTkl1nyBORkb0kLvEC_MqyRQGC5BDnOEgbrJf-hvOPgrcDzEkiZSInsncAGBh9AwrA6xSYhl62RpTtoczPReLf1Mw54kvyDCCZCZGMtBFoCRXJMGmQEM2zSYJP2jQJ915eL4iqK1-f9WDyv_fi_9e78HxL92luCwXuB5w_g_T9eduyRHIvT214FIBCvwcEdBHbwEOXzhThdP5U5MS9RlK8CO4Hd6HXvLec-jAK7vwR2Zfytqtz7e_1vq79PJqZpTXJZyKX8elIypXTZxb3fl_A-G2YKqXb5mg5vxl3NTeA5KTYR1ETqa_r48lOXj8Q_Szf-unDcGXknI_-SJi6dBucZrPcbPcXLE8HiYzS9sYYfe5AJ9Mv3KHtKZH-jEIzW5KB_gIQ9kzzTbambspEZtYdjU50PJzw32dRi3VSo1EnpQ4O6lIdalbLQdX1EfTyXh8y0WGBZNIcasayqJu_PvZbDoKpTVeCAjagKmqWxubW3OU0yMzGu1B6PdV1nVvZk4_Z_ICor3SjKV-U1jeQEosCLQNw2xrjxZfHGcYLraxbaVPClX8coqsKayPGfFmzYUnv5uObaU3QCTwyB4kKK4bOdzNZg2w-LYHha-1z5WWCXujwfL0vwf5Jigd3mKgrsNmN_BwAA___TX000">