On Fri, Feb 22, 2013 at 12:14 PM, Andrew Pinski <pins...@gmail.com> wrote: > On Thu, Feb 21, 2013 at 7:16 PM, Bin.Cheng <amker.ch...@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.