[Bug middle-end/19689] [4.0 Regression] ICE in store_bit_field, at expmed.c

steven at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Sat Jan 29 12:50:00 GMT 2005


------- Additional Comments From steven at gcc dot gnu dot org  2005-01-29 12:49 -------
rth's comment on the patch: 
5220          /* If EXP is a NOP_EXPR of precision less than its mode, then 
that 
5221             implies a mask operation.  If the precision is the same size 
as 
5222             the field we're storing into, that mask is redundant.  This 
is 
5223             particularly common with bit field assignments generated by 
the 
5224             C front end.  */ 
5225          if (TREE_CODE (exp) == NOP_EXPR 
5226              && INTEGRAL_TYPE_P (TREE_TYPE (exp)) 
5227              && (TYPE_PRECISION (TREE_TYPE (exp)) 
5228                  < GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (exp)))) 
5229              && bitsize == TYPE_PRECISION (TREE_TYPE (exp))) 
 
But in this case the NOP_EXPR also changes the mode of its operand from 
HImode to SImode: 
(gdb) p debug_tree(exp) 
 <nop_expr 0x2a95a31000 
    type <integer_type 0x2a95988a90 SI 
        size <integer_cst 0x2a95890a80 constant invariant 32> 
        unit size <integer_cst 0x2a958905a0 constant invariant 4> 
        align 32 symtab 0 alias set -1 precision 29 min <integer_cst 
0x2a958a8d80 -268435456> max <integer_cst 0x2a95a2e270 268435455>> 
 
    arg 0 <parm_decl 0x2a95988c30 j 
        type <integer_type 0x2a958968f0 short int HI 
            size <integer_cst 0x2a958908a0 constant invariant 16> 
            unit size <integer_cst 0x2a958908d0 constant invariant 2> 
            align 16 symtab 0 alias set -1 precision 16 min <integer_cst 
0x2a958907e0 -32768> max <integer_cst 0x2a95890840 32767> 
            pointer_to_this <pointer_type 0x2a95928000>> 
        used HI file t.c line 8 size <integer_cst 0x2a958908a0 16> unit size 
<integer_cst 0x2a958908d0 2> 
        align 16 context <function_decl 0x2a95988dd0 foo> result <integer_type 
0x2a958968f0 short int> initial <integer_type 0x2a95896a90 int> 
        (reg/v:HI 58 [ j ]) 
        arg-type <integer_type 0x2a95896a90 int public SI size <integer_cst 
0x2a95890a80 32> unit size <integer_cst 0x2a958905a0 4> 
            align 32 symtab 0 alias set -1 precision 32 min <integer_cst 
0x2a958909f0 -2147483648> max <integer_cst 0x2a95890a20 2147483647> 
            pointer_to_this <pointer_type 0x2a958ae4e0>> arg-type-as-written 
<integer_type 0x2a958968f0 short int> 
        incoming-rtl (reg:SI 5 di [ j ])>> 
 

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19689



More information about the Gcc-bugs mailing list