fold: fix use of protected_set_expr_location_unshare
authorJason Merrill <jason@redhat.com>
Wed, 21 Dec 2022 02:06:09 +0000 (21:06 -0500)
committerJason Merrill <jason@redhat.com>
Wed, 21 Dec 2022 02:07:31 +0000 (21:07 -0500)
Unlike protected_set_expr_location, this variant can return
a different tree.

gcc/ChangeLog:

* fold-const.cc (fold_convert_loc): Check return value of
protected_set_expr_location_unshare.

gcc/fold-const.cc

index 42547f4..00e2af0 100644 (file)
@@ -2618,7 +2618,7 @@ fold_convert_loc (location_t loc, tree type, tree arg)
       gcc_unreachable ();
     }
  fold_convert_exit:
-  protected_set_expr_location_unshare (tem, loc);
+  tem = protected_set_expr_location_unshare (tem, loc);
   return tem;
 }
 \f