[Bug rtl-optimization/90271] [missed-optimization] failure to keep variables in registers during "faux" memcpy
eyalroz at technion dot ac.il
gcc-bugzilla@gcc.gnu.org
Sun Apr 28 12:31:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90271
--- Comment #1 from Eyal Rozenberg <eyalroz at technion dot ac.il> ---
Can also reproduce this in C, with slightly different code:
int replace_bytes_3(int v1 ,char v2)
{
memcpy( (void*) (((char*)&v1)+1) , &v2 , sizeof(v2) );
return v1;
}
int foo3()
{
int x = 3;
char c = 1;
return replace_bytes_3(x,c);
}
GodBolt: https://godbolt.org/z/1K89xh
Again, clang optimizes this correctly. Note specifically the way it handles the
non-inlined replace_bytes_3.
More information about the Gcc-bugs
mailing list