This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: get_ref_base_and_extend based ctor folding
> > + if (AGGREGATE_TYPE_P (type) && AGGREGATE_TYPE_P (TREE_TYPE (ctor))
> > + && !offset
> > + && compare_tree_int (TYPE_SIZE (TREE_TYPE (ctor)), size) >=0)
> > + {
> > + ret = canonicalize_constructor_val (ctor);
> > + if (ret
> > + && !useless_type_conversion_p (type, TREE_TYPE (ret)))
> > + {
> > + /* VIEW_CONVERT_EXPR is valid only for matching operand sizes.
> > + For bitfields, the size of memory acccess differ from size of type,
> > + thus we need both compare that ctor is greater than memory access
> > + and that type sizes match. */
>
> See above. Could be factored out.
Actually I was thinking that most probably this should go into
canonicalize_constructor_val (extending it by type argument)
get_symbol_constant_value (the only other user if it) probably won't
mind pasing TREE_TYPE (sym).
Honza