From ef0abcbc400e0ecb8ed1ddf61d96f8f3f88fe63b Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 20 Dec 2022 21:06:09 -0500 Subject: [PATCH] fold: fix use of protected_set_expr_location_unshare 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/fold-const.cc b/gcc/fold-const.cc index 42547f433ed..00e2af0680c 100644 --- a/gcc/fold-const.cc +++ b/gcc/fold-const.cc @@ -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; } -- 2.11.4.GIT