This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Another missing trunc_int_for_mode
- From: Geoff Keating <geoffk at geoffk dot org>
- To: Daniel Jacobowitz <drow at mvista dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: 18 Feb 2003 17:08:58 -0800
- Subject: Re: Another missing trunc_int_for_mode
- References: <20030218212504.GA23662@nevyn.them.org>
Daniel Jacobowitz <drow@mvista.com> writes:
> A current (3.2, 3.3, HEAD, but 2.95.3 is OK) PowerPC compiler can't compile
> this testcase:
>
> int global_one;
>
> void clobber_register()
> {
> *(volatile unsigned char *)(0xE0000000 * global_one) = 0x00;
> }
>
> The error is:
> main.i: In function `clobber_register':
> main.i:6: could not split insn
> (insn 12 10 14 (set (reg:SI 0 r0 [118])
> (const_int 3758096384 [0xe0000000])) 296 {*movsi_internal1} (nil)
> (expr_list:REG_EQUIV (const_int 3758096384 [0xe0000000])
> (nil)))
> main.i:6: Internal compiler error in final_scan_insn, at final.c:2622
>
>
> Franz pointed out that this problem is caused by a non-sign-extended
> const_int; here's a patch to fix this one. On a more general note should
> most of the GEN_INT's on user trees in expand_expr all be gen_int_mode? I
> bet they have similar problems.
>
> Patch and testcase OK? How about for 3.2?
This is OK as far as it goes, but really there should be a routine
that takes an INTEGER_CST and returns the proper
CONST_INT/CONST_DOUBLE, rather than playing with tree_low_cst.
> --
> Daniel Jacobowitz
> MontaVista Software Debian GNU/Linux Developer
>
> 2003-02-18 Daniel Jacobowitz <drow@mvista.com>
>
> * expr.c (expand_expr): Use gen_int_mode for the argument
> to gen_rtx_MULT.
>
> Index: expr.c
> ===================================================================
> RCS file: /big/fsf/rsync/gcc-cvs/gcc/gcc/expr.c,v
> retrieving revision 1.505
> diff -u -p -r1.505 expr.c
> --- expr.c 1 Feb 2003 18:59:43 -0000 1.505
> +++ expr.c 18 Feb 2003 16:46:46 -0000
> @@ -8089,6 +8089,8 @@ expand_expr (exp, target, tmode, modifie
> if (modifier == EXPAND_SUM && mode == ptr_mode
> && host_integerp (TREE_OPERAND (exp, 1), 0))
> {
> + tree exp1 = TREE_OPERAND (exp, 1);
> +
> op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode,
> EXPAND_SUM);
>
> @@ -8107,9 +8109,9 @@ expand_expr (exp, target, tmode, modifie
> if (GET_CODE (op0) != REG)
> op0 = copy_to_mode_reg (mode, op0);
>
> - return
> - gen_rtx_MULT (mode, op0,
> - GEN_INT (tree_low_cst (TREE_OPERAND (exp, 1), 0)));
> + return gen_rtx_MULT (mode, op0,
> + gen_int_mode (tree_low_cst (exp1, 0),
> + TYPE_MODE (TREE_TYPE (exp1))));
> }
>
> if (! safe_from_p (subtarget, TREE_OPERAND (exp, 1), 1))
>
--
- Geoffrey Keating <geoffk@geoffk.org>