fix gcc bug #34130 (wrong multiplication with negative constants

inside abs()) which got some attention in the linux kernel mailing
list recently
This commit is contained in:
drochner 2007-11-20 23:27:56 +00:00
parent f0927a591f
commit ad37bd5da3
1 changed files with 3 additions and 0 deletions

View File

@ -5340,6 +5340,9 @@ extract_muldiv_1 (tree t, tree c, enum tree_code code, tree wide_type)
}
break;
}
/* If the constant is negative, we cannot simplify this. */
if (tree_int_cst_sgn (c) == -1)
break;
/* FALLTHROUGH */
case NEGATE_EXPR:
if ((t1 = extract_muldiv (op0, c, code, wide_type)) != 0)