[cfe-dev] floating point division by 0.0 and -ftrapv
Sean McBride
sean at rogue-research.com
Fri Dec 23 09:56:08 PST 2011
Hi all,
I know that integer div by 0 is undefined behaviour, but is fp div by zero also undefined? I've STFW a lot but find conflicting info.
CERT says:
<https://www.securecoding.cert.org/confluence/display/seccode/FLP03-C.+Detect+and+handle+floating+point+errors>
"Floating-point division by zero also results in undefined behavior" but then their "Compliant Solution" example does it anyway and then tests with fetestexcept().
Mind you, building their example also says: "warning: pragma STDC FENV_ACCESS ON is not supported, ignoring pragma".
I'm asking because clang with -ftrapv dies upon fp div by 0. Is this correct or not?
Thanks,
--
____________________________________________________________
Sean McBride, B. Eng sean at rogue-research.com
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
More information about the cfe-dev
mailing list