As discussed in the PR, Richard mentioned the method to figure out which VAR was not set TREE_ADDRESSABLE, and then cause this failure. It is address_expression which build addr_expr (build_fold_addr_expr_loc), but not set TREE_ADDRESSABLE.
I drafted this patch with reference the comments from Richard in this PR, while I'm not quite sure if more thing need to do. So, please have review, thanks! Bootstrap and regtest pass on ppc64le. Is this ok for trunk? Jiufu Guo. 2021-05-14 Richard Biener <rguent...@suse.de> Jiufu Guo <guoji...@linux.ibm.com> PR go/100537 * go-gcc.cc (Gcc_backend::address_expression): Set TREE_ADDRESSABLE. --- gcc/go/go-gcc.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/gcc/go/go-gcc.cc b/gcc/go/go-gcc.cc index 5d9dbb5d068..8ed20a3b479 100644 --- a/gcc/go/go-gcc.cc +++ b/gcc/go/go-gcc.cc @@ -1680,6 +1680,7 @@ Gcc_backend::address_expression(Bexpression* bexpr, Location location) if (expr == error_mark_node) return this->error_expression(); + TREE_ADDRESSABLE (expr) = 1; tree ret = build_fold_addr_expr_loc(location.gcc_location(), expr); return this->make_expression(ret); } -- 2.17.1