On Thu, Jul 21, 2011 at 10:00 PM, H.J. Lu <hjl.to...@gmail.com> wrote:

>> /* Represents viewing something of one type as being of a second type.
>>   This corresponds to an "Unchecked Conversion" in Ada and roughly to
>>   the idiom *(type2 *)&X in C.  The only operand is the value to be
>>   viewed as being of another type.  **It is undefined if the type of the
>>   input and of the expression have different sizes.**
>>
>>   ...
>> DEFTREECODE (VIEW_CONVERT_EXPR, "view_convert_expr", tcc_reference, 1)
>>
>> We have:
>>
>> <bb 2>:
>>  D.2709_8 = VIEW_CONVERT_EXPR<double>(&xxxx);
>>  D.2702_1 = u.d;
>>  D.2704_3 = D.2702_1 == D.2709_8;
>>  D.2701_4 = (int) D.2704_3;
>>  return D.2701_4;
>>
>> Where
>>
>> sizeof (double) = 64
>> sizeof (ptr_type) = 32.
>>
>
> Are you sure that you used -mx32?  I couldn't reproduce it.
> It looks like an x86 backend bug to me.

Hm, can't reproduce it anymore... x32 -O2 looks OK:

<bb 2>:
  v = {};
  v.m = &xxxx;
  D.2702_1 = u.d;
  D.2703_2 = v.d;
  D.2704_3 = D.2702_1 == D.2703_2;
  D.2701_4 = (int) D.2704_3;
  return D.2701_4;

}

Expand generates:

(insn 8 6 9 (set (reg:SI 68)
        (symbol_ref:SI ("xxxx") [flags 0x40]  <var_decl 0x7fccc360b140 xxxx>)) p
r49798.c:12 -1
     (nil))

(insn 9 8 10 (set (reg:DI 67)
        (zero_extend:DI (reg:SI 68))) pr49798.c:12 -1
     (nil))

I don't know if this is OK to be transformed to DImode load.

Uros.

Reply via email to