Hello! > I have just submitted a patch emitting some new floating-point code from the > Fortran front-end, > improving our IEEE support there: > https://gcc.gnu.org/ml/gcc-patches/2014-09/msg02444.html > > However, in one of the cases where we emit a call to __builtin_remainderf(), > we get wrong code > generation on i386. It is peculiar because: > > - the wrong code occurs at all optimization levels, and the following flags > (any or all) do not > affect it: > -mfpmath=sse -msse2 -fno-unsafe-math-optimizations -frounding-math > -fsignaling-nans > - the wrong code does not occur with -ffloat-store > - the code generate looks fine by every aspect I could try. I could not > generate a direct C > testcase, unfortunately, but it is equivalent to:
The __builtin_remainderf on x86 expands to x87 fprem1 instruction [1]. According to the table in [1], +inf is not handled, and generates division-by-zero exception. IMO, we have to add "&& flag_finite_math_only" to expander enable condition of remainder{sf,df,xf}3 expanders in i386.md [1] http://x86.renejeschke.de/html/file_module_x86_id_108.html Uros.