[Bug tree-optimization/81814] Incorrect behaviour at -O0 (conditional operator)
mpolacek at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Aug 16 16:56:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81814
--- Comment #8 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I wonder if I could just
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -3401,14 +3401,14 @@ operand_equal_for_comparison_p (tree arg0, tree arg1,
tree other)
primarg1 = get_narrower (arg1, &unsignedp1);
primother = get_narrower (other, &unsignedpo);
+ tree type = TREE_TYPE (arg0);
correct_width = TYPE_PRECISION (TREE_TYPE (arg1));
if (unsignedp1 == unsignedpo
+ && TYPE_PRECISION (TREE_TYPE (primarg1)) == TYPE_PRECISION (type)
&& TYPE_PRECISION (TREE_TYPE (primarg1)) < correct_width
&& TYPE_PRECISION (TREE_TYPE (primother)) < correct_width)
{
- tree type = TREE_TYPE (arg0);
-
/* Make sure shorter operand is extended the right way
to match the longer operand. */
primarg1 = fold_convert (signed_or_unsigned_type_for
so far it seems to work.
More information about the Gcc-bugs
mailing list