------- Comment #3 from roger at eyesopen dot com 2006-12-01 03:25 ------- Hi Manual,
This needs to be handled in the front-ends, and in fact is already handled by the front-ends. In c-typeck.c:build_binary_op, I see: case TRUNC_DIV_EXPR: case CEIL_DIV_EXPR: case FLOOR_DIV_EXPR: case ROUND_DIV_EXPR: case EXACT_DIV_EXPR: /* Floating point division by zero is a legitimate way to obtain infinities and NaNs. */ if (skip_evaluation == 0 && integer_zerop (op1)) warning (OPT_Wdiv_by_zero, "division by zero"); Likewise, there are several references to OPT_Wdiv_by_zero in cp/typeck.c. The real issue is that OPT_Wdiv_by_zero needs to be enabled by -pedantic in order to generate an error for -pedantic-errors, as requested by Joseph in comment #1. I hope this helps. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19976