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

--- Comment #9 from rguenther at suse dot de <rguenther at suse dot de> ---
On Mon, 31 Jul 2017, mpolacek at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81607
> 
> --- Comment #8 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
> I'm actually testing this
> 
> --- a/gcc/cp/cp-gimplify.c
> +++ b/gcc/cp/cp-gimplify.c
> @@ -2314,9 +2314,9 @@ cp_fold (tree x)
> 
>        /* A COND_EXPR might have incompatible types in branches if one or both
>      arms are bitfields.  If folding exposed such a branch, fix it up.  */
> -      if (TREE_CODE (x) != code)
> -   if (tree type = is_bitfield_expr_with_lowered_type (x))
> -     x = fold_convert (type, x);
> +      if (TREE_CODE (x) != code
> +     && !useless_type_conversion_p (TREE_TYPE (org_x), TREE_TYPE (x)))
> +   x = fold_convert (TREE_TYPE (org_x), x);
> 
>        break;
> 
> so I hope that case is covered.  We'll see.

Yeah, hopefully the FE doesn't mess up types for aggregates ;)

useless_type_conversion_p should be fine in the gimplify hook.

Reply via email to