This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/81814] Incorrect behaviour at -O0 (conditional operator)
- From: "mpolacek at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 16 Aug 2017 14:19:08 +0000
- Subject: [Bug tree-optimization/81814] Incorrect behaviour at -O0 (conditional operator)
- Auto-submitted: auto-generated
- References: <bug-81814-4@http.gcc.gnu.org/bugzilla/>
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.