This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] PR 40219, avoid accessing outside built_in_decls array when computing tree hashes


On Fri, May 22, 2009 at 04:42:34PM -0400, Michael Meissner wrote:
> -      /* When referring to a built-in FUNCTION_DECL, use the
> -	 __builtin__ form.  Otherwise nodes that compare equal
> -	 according to operand_equal_p might get different
> -	 hash codes.  */
> -      if (DECL_BUILT_IN (t) && built_in_decls[DECL_FUNCTION_CODE (t)])
> +      /* When referring to a built-in FUNCTION_DECL, use the __builtin__ form.
> +	 Otherwise nodes that compare equal according to operand_equal_p might
> +	 get different hash codes.  However, don't do this for machine specific
> +	 or front end builtins, since the function code is overloaded in those
> +	 cases.  */
> +      if (DECL_BUILT_IN (t) && DECL_BUILT_IN_CLASS (t) == BUILT_IN_NORMAL
> +	  && built_in_decls[DECL_FUNCTION_CODE (t)])

Why not just
if (DECL_BUILT_IN_CLASS (t) == BUILT_IN_NORMAL
    && built_in_decls[DECL_FUNCTION_CODE (t)])
?
DECL_BUILT_IN (t) is DECL_BUILT_IN_CLASS (t) != NOT_BUILT_IN and
AFAIK almost all places that check for BUILT_IN_NORMAL only
check that and don't have DECL_BUILT_IN check before that
(I count 5 exceptions).

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]