On Mon, Jun 23, 2025, 6:09 PM Jeff Law <jeffreya...@gmail.com> wrote:

>
>
> On 6/7/25 1:04 AM, Andrew Pinski wrote:
> > Currently expand_constructor when it comes to BLKmode types, we store out
> > the constructor to memory. But for the zero case, we could just use
> `const_int 0`
> > instead for types who are less than or equal to BITS_PER_WORD.
> > This is only valid if we expanding without a target.
> >
> > This fixes the storing zeros of `char[3]` and `char[7]` into registers.
> >
> > Boostrapped and tested on x86_64-linux-gnu.
> > Build and tested for aarch64-linux-gnu.
> >
> >       PR middle-end/110459
> >
> > gcc/ChangeLog:
> >
> >       * expr.cc (expand_constructor): For expansion of `{}` without a
> target
> >       and the size is less than BITS_PER_WORD, just return the constant
> 0.
> >
> > gcc/testsuite/ChangeLog:
> >
> >       * g++.target/aarch64/array-return-1.C: New test.
> >       * g++.target/i386/array-return-1.C: New test.
> OK.  I guess.  My worry is that even for a non-addressable, we can't do
> directly BLKmode assignments and this increases the risk that one of
> those creeps in.  Though emit_move_insn and friend check for this IIRC.
> So I don't have a concrete objection, just a vague uneasiness :-)
>
> So I'll ACK.  But we probably need to keep an eye out for fallout.
>


I forgot to withdraw this patch via a reply here as it did cause some
failures on arm-linux-gnueabi . I did make a mention of it in
https://gcc.gnu.org/pipermail/gcc-patches/2025-June/686065.html .
And richi asked something slightly different but I Have not got around to
trying it out as I was on vacation until yesterday.

Thanks,
Andrew


> jeff
>

Reply via email to