[Bug c/29186] optimzation breaks floating point exception flag reading

glisse at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Feb 25 23:18:00 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=29186

--- Comment #23 from Marc Glisse <glisse at gcc dot gnu.org> ---
(In reply to Richard B. Kreckel from comment #22)
> I can't reproduce this bug any more,

I think you are just lucky, I am sure it hasn't been fixed and gcc will still
happily swap FP operations with function calls like fetestexcept. You still
need something like volatile to protect your operation, and even then the
compiler could theoretically move some unrelated FP op just before
fetestexcept, which would set more flags than the operation you wanted to test.


More information about the Gcc-bugs mailing list