http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55022
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org --- Comment #18 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to Mircea Namolaru from comment #17) > Vladimir Kargov, Tobias Grosser and me found that the problem is caused by > incorrect folding of the floord operator. As a result Cloog translates the > expression > -4294967296*floord(_19-i_17,4294967296) > to the tree-SSA expression > 4294967296*floord(_19-i_17,-4294967296) > > This is wrong, in the first case floord is 0 and in the second is -1. Not sure where that "folding" happens or what "floord" is, but if you are refering to negate_expr () negating a /[fl] CST as a /[fl] -CST then yes, that looks suspicious. OTOH the division variant tree codes don't appear in the IL very often so it's hard to notice these mistakes. Testing Index: gcc/fold-const.c =================================================================== *** gcc/fold-const.c (revision 209292) --- gcc/fold-const.c (working copy) *************** negate_expr_p (tree t) *** 484,491 **** case TRUNC_DIV_EXPR: case ROUND_DIV_EXPR: - case FLOOR_DIV_EXPR: - case CEIL_DIV_EXPR: case EXACT_DIV_EXPR: /* In general we can't negate A / B, because if A is INT_MIN and B is 1, we may turn this into INT_MIN / -1 which is undefined --- 484,489 ---- *************** fold_negate_expr (location_t loc, tree t *** 682,689 **** case TRUNC_DIV_EXPR: case ROUND_DIV_EXPR: - case FLOOR_DIV_EXPR: - case CEIL_DIV_EXPR: case EXACT_DIV_EXPR: /* In general we can't negate A / B, because if A is INT_MIN and B is 1, we may turn this into INT_MIN / -1 which is undefined --- 680,685 ----