[Bug target/117584] PowerPC ABI for BitInt needs to be done

"jakub at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117584

--- Comment #12 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Manjunath S Matti from comment #11)
> (In reply to Manjunath S Matti from comment #10)
> > 
> > But a few failures need looking into
> > 
> > gcc.dg/torture/bitint-32.c	-m64	-O0 only (passes -O2)
> > gcc.dg/torture/bitint-33.c	-m64	-O0 only (passes -O2)
> > gcc.dg/torture/bitint-34.c	-m64	-O0 only (passes -O2)
> > gcc.dg/torture/bitint-35.c	-m64	-O0 only (passes -O2)
> > gcc.dg/torture/bitint-36.c	-m64	-O0 only (passes -O2)
> > gcc.dg/torture/bitint-37.c	-m64	-O0 only (passes -O2)
> > gcc.dg/torture/bitint-93.c	-m64	both -O0 and -O2	
> > gcc.dg/torture/bitint-94.c	-m64	both -O0 and -O2
> > 
> > I am debugging these issues, which points me to a code block in
> > gcc/gcc/gimple-lower-bitint.cc 
> > 
> > => tree src = build2 (MEM_REF, atype,
> > 		    build_fold_addr_expr (unshare_expr (obj)), off);
> > g = gimple_build_call (fn, 3,
> > 		       build_fold_addr_expr (unshare_expr (obj)),
> > 		       src, build_int_cst (size_type_node,
> > 					   obj_nelts * m_limb_size));
> 
> 
> The following change fixes this issue
> --- a/gcc/gimple-lower-bitint.cc
> +++ b/gcc/gimple-lower-bitint.cc
> @@ -4579,8 +4579,8 @@ bitint_large_huge::finish_arith_overflow (tree var,
> tree obj, tree type,
>           tree fn = builtin_decl_implicit (BUILT_IN_MEMMOVE);
>           tree off = build_int_cst (build_pointer_type (TREE_TYPE (obj)),
>                                     (nelts - obj_nelts) * m_limb_size);
> -         tree src = build2 (MEM_REF, atype,
> -                            build_fold_addr_expr (unshare_expr (obj)), off);
> +         tree src = build_fold_addr_expr (build2 (MEM_REF, atype,
> +                                 build_fold_addr_expr (unshare_expr (obj)),
> off));
>           g = gimple_build_call (fn, 3,
>                                  build_fold_addr_expr (unshare_expr (obj)),
>                                  src, build_int_cst (size_type_node,
> 
> Jakub is this the correct fix, can you please confirm.

It looks correct as in what it does, but the formatting is awful.
Better keep it as is and change instead the gimple_build_call operand, so
replace there
                                 src, build_int_cst (size_type_node,
with
                                 build_fold_addr_expr (src),
                                 build_int_cst (size_type_node,
It should be IMHO submitted separately from the rest.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.