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: [C++ PATCH] Don't ICE in build_array_ref trying to SET_EXPR_LOCATION on error_mark_node (PR c++/37552)


> What I mean is that IMNSHO
> 
> if (t && t != error_mark_node && CAN_HAVE_LOCATION_P (t))
> 
> and
> 
> if (t && CAN_HAVE_LOCATION_P (t))
> 
> is equivalent, as CAN_HAVE_LOCATION_P (t) is
> 
> TREE_CODE_CLASS (TREE_CODE (t)) >= tcc_reference
> && TREE_CODE_CLASS (TREE_CODE (t)) <= tcc_expression
> 
> and
> 
> TREE_CODE_CLASS (ERROR_MARK) == tcc_exceptional
> 
> and
> 
> tcc_exceptional < tcc_reference.  In other words,
> CAN_HAVE_LOCATION_P (error_mark_node) is false, but can be
> safely evaluated, unlike CAN_HAVE_LOCATION_P (NULL).  But gcc isn't
> smart enough to optimize that check away (it doesn't know that
> TREE_CODE_CLASS (TREE_CODE (error_mark_node)) is tcc_exceptional).

Sure, that sounds reasonable.  Do you mind submitting a separate patch?


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