Re: [RFC] Turning off trapping-math for C and C++ front-ends by default
Thomas Koenig via Gcc <[email protected]> Thu, 2 Jul 2026 21:18:05 +0200
| Newsgroups | gmane.comp.gcc.devel |
|---|---|
| Message-ID | <[email protected]> |
Am 02.07.26 um 20:16 schrieb Marc Glisse via Gcc: > Richard Biener: > >> One complication of #pragma FENV access is that the restrictions >> of placement is too lose as we can properly only support >> at most per-function level changes via options. > > I am not sure about that. Supporting even the per-function level is not really doable with the current representation of FP operations in gcc. The closest I can think would be replacing (in the front-end) every FP operation by a call to a noipa function that does the actual operation, marking the whole function noipa, and possibly more to protect from other functions called from there. The concepts are somewhat different, but would it make sense to look at what Fortran is doing with its IEEE modules? This calls _gfortran_ieee_procedure_entry and _gfortran_ieee_procedure_exit on entry and exit, respectively, which deals with handling floating point flags (according to Fortran semantics of course, I don't know how that corresponds to what C/C++ are doing. This carries a significant overhead, but if your function spends a lot of time in that particular procedure, that may not matter too much, and... [...] > (anyway, if someone found a way to implement fenv_access at the function level without making it imply -O0, I certainly wouldn't complain) -O0 is not required.