Bingfeng Mei wrote:
> I am tracking a bug, not sure whether it is a generic GCC bug or my porting
>  goes wrong.
> 
> To access the below structure,
> 
> typedef struct { long int p_x, p_y; } Point; ... p1.p_x = -1; ...
> 
> It is expanded to follwing RTL ;; p1.p_x = -1;
> 
> (insn 19 18 20 
> /projects/firepath/tools/work/bmei/gcc-head/src/gcc/testsuite/gcc.c-torture/execute/20000808-1.c:14
>  (set (reg:DI 98) (ior:DI (reg/v:DI 87 [ p1 ]) (const_int -1
> [0xffffffff]))) -1 (nil))
> 
> (insn 20 19 0 
> /projects/firepath/tools/work/bmei/gcc-head/src/gcc/testsuite/gcc.c-torture/execute/20000808-1.c:14
>  (set (reg/v:DI 87 [ p1 ]) (reg:DI 98)) -1 (nil))
> 
> According to your explaination, (reg:DI 98) will get -1 
> (0xffffffffffffffff) after insn 19, and is wrong. Am I right?

  Yes, that does look like it is wrong.  (Unless the next statement after your
code example was "p1.p_y = -1"!)

  My explanation was trying to say, that const_int does not have 'bitness';
it's an abstract integer number, not of any size.  See this from the internals
manual:

`VOIDmode'
     Void mode means the absence of a mode or an unspecified mode.  For
     example, RTL expressions of code `const_int' have mode `VOIDmode'
     because they can be taken to have whatever mode the context
     requires.  In debugging dumps of RTL, `VOIDmode' is expressed by
     the absence of any mode.

and:

12.9 RTL Expressions for Arithmetic
===================================

Unless otherwise specified, all the operands of arithmetic expressions
must be valid for mode M.  An operand is valid for mode M if it has
mode M, or if it is a `const_int' or `const_double' and M is a mode of
class `MODE_INT'.

  So the docs clearly say that the const_int has to be interpreted as being
the same size as the DImode operation, and that means it is
0xffffffffffffffff, because it's -1.

  I'm not sure off the top of my head where the problem would be coming from,
you might have to debug it.  Which dump is this from?  Seeing how it evolves
from the initial RTL generation up to the point where you first see an IOR
operation with const_int -1 appear should give you a big clue.  (If you don't
have a movdi pattern, the CSE code that handles BLKmode piecewise in registers
can go wrong here and get confused by reg notes, I've seen that happen before;
as a result gcc thought it was OK to set both halves of the register to -1.)

    cheers,
      DaveK

Reply via email to