https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90149

--- Comment #14 from rguenther at suse dot de <rguenther at suse dot de> ---
On Sat, 11 May 2019, msebor at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90149
> 
> --- Comment #13 from Martin Sebor <msebor at gcc dot gnu.org> ---
> I had started by doing that but gave up when I noticed that there are lots of
> them, some like this:
> 
>   if (TREE_CODE (expr) == REALPART_EXPR
>       || TREE_CODE (expr) == IMAGPART_EXPR
>       || TREE_CODE (expr) == BIT_FIELD_REF)
>     {
>       tree op = TREE_OPERAND (expr, 0);
>       if (!is_gimple_reg_type (TREE_TYPE (expr)))
>         {
>           error ("non-scalar BIT_FIELD_REF, IMAGPART_EXPR or REALPART_EXPR");
>           return true;
>         }
> 
> some like this:
> 
>     case VEC_UNPACK_HI_EXPR:
>     case VEC_UNPACK_LO_EXPR:
>     case VEC_UNPACK_FLOAT_HI_EXPR:
>     case VEC_UNPACK_FLOAT_LO_EXPR:
>     case VEC_UNPACK_FIX_TRUNC_HI_EXPR:
>     case VEC_UNPACK_FIX_TRUNC_LO_EXPR:
>     ...
>           error ("type mismatch in vector unpack expression");
> 
> that avoid mentioning the exact code altogether, or like this:
> 
>     case LSHIFT_EXPR:
>     case RSHIFT_EXPR:
>     case LROTATE_EXPR:
>     case RROTATE_EXPR:
>     ...
>             error ("type mismatch in shift expression");
> 
> and some even that "lie" for the sake of brevity.  It would be nice to always
> mention the exact code.

Ah, for these cases it looks an OK change.

> But I can save the result of get_tree_code_name (rhs_code) and use that 
> instead
> of calling it repeatedly.  (My initial approach was to add a new directive to
> the generic pretty-printer but, sadly, get_tree_code_name is defined in tree.c
> and not available there so I'd have had to duplicate the directive code for
> each front-end and for the middle-end.  That seems like too much hassle.)

No, I just thought I saw (the first) case where your replacement
was at a point the tree code was exactly known at compile-time?

Reply via email to