On 2/18/20 5:35 PM, Jim Wilson wrote:
On Sun, Feb 16, 2020 at 9:02 PM Kito Cheng <kito.ch...@gmail.com> wrote:
It cause the __builtin_strlen not optimized/folded in test_local_cpy_4,
and the reason is blocked by __builtin_memcpy, it's same issue in
strlenopt-80.c, so I there is two way to fix this issue:

Another possible solution is to use
    { dg-require-effective-target non_strict_align }
as is done in strlenopt-72.c

If you want the testcase to work, adding __attribute__ ((aligned(4)))
to the global b and test_local_cpy_4 local a works.  That allows the
RISC-V port to convert the memcpy into an aligned load/store.  The
RISC-V port only needs the attribute added to the local variable a,
because we align char array global variables, but other targets might
not, so to be safe I think you need the alignment attribute added to
both.  However, this is only OK if you weren't trying to test
unaligned accesses here, and it isn't obvious if you were trying to do
that or not.

I wasn't thinking of unaligned accesses.  I like the suggestion of
adding the attribute.  Let me do some testing with it on the other
targets mentioned in the bug and take care of it today.

Thanks
Martin

Reply via email to