This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix ICE on conversion within initializer
> OK. Then I can generalize to something like
>
> + /* Allow view-conversions from BLKmode to non-BLKmode only if the
> + bit pattern is fully preserved afterwards; otherwise, the RTL
> + expander won't be able to apply a subsequent transformation to
> + the underlying constant in BLKmode. */
> + if (TYPE_MODE (src_type) == BLKmode && TYPE_MODE (dest_type) != BLKmode)
> + {
> + if (TYPE_MODE (endtype) == TYPE_MODE (dest_type))
> + return initializer_constant_valid_p (src, endtype);
> + else
> + return NULL_TREE;
> + }
That's not sufficient, the structure type and the CONSTRUCTOR have QImode...
So something like this:
+ /* Allow view-conversions from aggregate to non-aggregate type only
+ if the bit pattern is fully preserved afterwards; otherwise, the
+ RTL expander won't be able to apply a subsequent transformation to
+ the underlying constructor. */
+ if (AGGREGATE_TYPE_P (src_type) && !AGGREGATE_TYPE_P (dest_type))
+ {
+ if (TYPE_MODE (endtype) == TYPE_MODE (dest_type))
+ return initializer_constant_valid_p (src, endtype);
+ else
+ return NULL_TREE;
+ }
--
Eric Botcazou