Created attachment 25273 [details] divide by zero example The attached C code, written using SSE intrinsics, prints -nan when no optimizations are used (as expected) and 0 otherwise. It seems constant folding of the divps instruction doesn't do the right thing. It works correctly when the first argument is non-zero though (including minus zero).
This bug has stayed as unconfirmed for a while. Is there anything that I could do to help?
Confirmed. Broken by CSE1 on RTL at -O1.
case DIV: /* Handle floating point and integers separately. */ if (SCALAR_FLOAT_MODE_P (mode)) { should probably be FLOAT_MODE_P (mode).
What's missing to get this fixed? Previous comment suggests the fix is trivial.
Sorry, forgot about this issue.
Author: rguenth Date: Fri Dec 23 09:10:18 2011 New Revision: 182653 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=182653 Log: 2011-12-23 Richard Guenther <rguenther@suse.de> PR rtl-optimization/50396 * simplify-rtx.c (simplify_binary_operation_1): Properly guard code that only works for integers. * gcc.dg/torture/pr50396.c: New testcase. Added: trunk/gcc/testsuite/gcc.dg/torture/pr50396.c Modified: trunk/gcc/ChangeLog trunk/gcc/simplify-rtx.c trunk/gcc/testsuite/ChangeLog
Author: rguenth Date: Fri Dec 23 09:16:08 2011 New Revision: 182654 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=182654 Log: 2011-12-23 Richard Guenther <rguenther@suse.de> PR rtl-optimization/50396 * simplify-rtx.c (simplify_binary_operation_1): Properly guard code that only works for integers. * gcc.dg/torture/pr50396.c: New testcase. Added: branches/gcc-4_6-branch/gcc/testsuite/gcc.dg/torture/pr50396.c Modified: branches/gcc-4_6-branch/gcc/ChangeLog branches/gcc-4_6-branch/gcc/simplify-rtx.c branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
Fixed for 4.6.3.