From: Kewen Lin Date: Thu, 17 Nov 2022 05:08:23 +0000 (-0600) Subject: Fix typo in gimple_fold_partial_load_store_mem_ref X-Git-Tag: basepoints/gcc-14~3087 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=928bc5b863f126189753e45ef45a40265ae028c5;p=thirdparty%2Fgcc.git Fix typo in gimple_fold_partial_load_store_mem_ref As Robin spotted, my recent commit r13-3716 caused an ICE on s390 if vector access with length is enabled there (his patch for the enablement hasn't been committed yet). The failure is caused by one stupid typo, the bias on s390 is -1, so the assertion should use tree_fits_shwi_p rather than tree_fits_uhwi_p. Thanks for Robin's catching. I just reproduced the ICE and verified the fix worked fine with a cross build, the optimized dump against the test case gcc.target/powerpc/pr107412.c looked expected. gcc/ChangeLog: * gimple-fold.cc (gimple_fold_partial_load_store_mem_ref): Use tree_fits_shwi_p rather than tree_fits_uhwi_p as bias is signed. --- diff --git a/gcc/gimple-fold.cc b/gcc/gimple-fold.cc index 0a212e6d0d42..f8a1875ea3e3 100644 --- a/gcc/gimple-fold.cc +++ b/gcc/gimple-fold.cc @@ -5392,7 +5392,7 @@ gimple_fold_partial_load_store_mem_ref (gcall *call, tree vectype, bool mask_p) return NULL_TREE; unsigned int nargs = gimple_call_num_args (call); tree bias = gimple_call_arg (call, nargs - 1); - gcc_assert (tree_fits_uhwi_p (bias)); + gcc_assert (tree_fits_shwi_p (bias)); tree biased_len = int_const_binop (MINUS_EXPR, basic_len, bias); unsigned int len = tree_to_uhwi (biased_len); unsigned int vect_len