Inconsistency between code and document on nop_expr
Bin.Cheng
amker.cheng@gmail.com
Fri Feb 22 04:31:00 GMT 2013
On Fri, Feb 22, 2013 at 12:14 PM, Andrew Pinski <pinskia@gmail.com> wrote:
> On Thu, Feb 21, 2013 at 7:16 PM, Bin.Cheng <amker.cheng@gmail.com> wrote:
>> Hi,
>> GCCINT says that nop_expr is used to represent conversions that do not
>> require any code generation, while function tree_strip_nop_conversions
>> calls tree_nop_conversion, which returns false even for NOP_EXPR node
>> like "(unsigned int)a", where a has type int.
>
> Are you sure a has the type of int?
>
> The code does:
> if ((INTEGRAL_TYPE_P (outer_type)
> || POINTER_TYPE_P (outer_type)
> || TREE_CODE (outer_type) == OFFSET_TYPE)
> && (INTEGRAL_TYPE_P (inner_type)
> || POINTER_TYPE_P (inner_type)
> || TREE_CODE (inner_type) == OFFSET_TYPE))
> return TYPE_PRECISION (outer_type) == TYPE_PRECISION (inner_type);
>
> Which will return true for the case you mentioned. Also NOP_EXPR and
> CONVERT_EXPR are handled almost the same through out the whole
> compiler.
>
Oh, sorry about the mistake, a has type of signed short. Maybe we can
improve tree_nop_conversion with this case.
Thanks for your help.
--
Best Regards.
More information about the Gcc
mailing list