> Isn't this a function of the language and in some cases isn't it > implementation defined (true for C/C++ until C++11)?
I don't think that C/C++ use FLOOR_MOD_EXPR, only Ada does AFAIK. In any case, I don't see how this can be implementation-defined given: /* Division for integer result that rounds the quotient toward zero. */ DEFTREECODE (TRUNC_DIV_EXPR, "trunc_div_expr", tcc_binary, 2) /* Division for integer result that rounds the quotient toward infinity. */ DEFTREECODE (CEIL_DIV_EXPR, "ceil_div_expr", tcc_binary, 2) /* Division for integer result that rounds toward minus infinity. */ DEFTREECODE (FLOOR_DIV_EXPR, "floor_div_expr", tcc_binary, 2) /* Division for integer result that rounds toward nearest integer. */ DEFTREECODE (ROUND_DIV_EXPR, "round_div_expr", tcc_binary, 2) /* Four kinds of remainder that go with the four kinds of division. */ DEFTREECODE (TRUNC_MOD_EXPR, "trunc_mod_expr", tcc_binary, 2) DEFTREECODE (CEIL_MOD_EXPR, "ceil_mod_expr", tcc_binary, 2) DEFTREECODE (FLOOR_MOD_EXPR, "floor_mod_expr", tcc_binary, 2) DEFTREECODE (ROUND_MOD_EXPR, "round_mod_expr", tcc_binary, 2) This isn't immediate but, given the definition of TRUNC_DIV_EXPR, you can prove that the sign of TRUNC_MOD_EXPR is that of the dividend; similarly, given the definition of FLOOR_DIV_EXPR, you can prove that the sign of FLOOR_MOD_EXPR is that of the divisor; given the definition of CEIL_DIV_EXPR, you can prove that the sign of CEIL_MOD_EXPR is the opposite of that of the divisor (but you cannot use the latter result in this context). -- Eric Botcazou