This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Some help with fold_convert() on RECORD_TYPEs
On Fri, Feb 29, 2008 at 3:07 PM, FX <fxcoudert@gmail.com> wrote:
> > Yeah, it should return false for some classes of types, RECORD_TYPE, UNION_TYPE,
> > ARRAY_TYPE come to my mind here. Patch welcome ;)
>
> I'd suggest:
Works for me. Ok if that passes bootstrap / regtest and with a proper
changelog entry.
Richard.
> Index: fold-const.c
> ===================================================================
> --- fold-const.c (revision 131974)
> +++ fold-const.c (working copy)
> @@ -2476,8 +2476,15 @@ fold_convertible_p (const_tree type, con
> return (TREE_CODE (orig) == VECTOR_TYPE
> && tree_int_cst_equal (TYPE_SIZE (type), TYPE_SIZE (orig)));
>
> - default:
> + case REAL_TYPE:
> + case FIXED_POINT_TYPE:
> + case COMPLEX_TYPE:
> + case VECTOR_TYPE:
> + case VOID_TYPE:
> return TREE_CODE (type) == TREE_CODE (orig);
> +
> + default:
> + return false;
>
>
> }
> }
>
>
>
>
> --
> FX Coudert
> http://www.homepages.ucl.ac.uk/~uccafco/
>