https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106939

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Arseny Vakhrushev from comment #4)
> Thanks a lot, Andrew! Totally my bad. Well, comparison seems to work too:
> 
> extern char _src[], _dst[], _end[]; // Defined by the linker
> int main(void) {
>     char *src = &_src[0];
>     char *dst = &_dst[0];
>     char *end = &_end[0];
>     while (src < end) *dst++ = *src++;
>     return 0;
> }
> 
> Are the asm("" : "+r" (p)) statements strictly needed?

The inline-asm is needed because in C it is undefined to compare pointers that
are from different arrays. Basically it is a way to hide it from the compiler.

Reply via email to