[Bug c/106939] Linker-defined symbols are stained due to 'array subscript is partly outside array bounds' warning
neoxic at icloud dot com
gcc-bugzilla@gcc.gnu.org
Wed Sep 14 18:41:38 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106939
--- Comment #6 from Arseny Vakhrushev <neoxic at icloud dot com> ---
Lots of thanks again, Andrew!
----------------------------------------------
#include <string.h>
#include <stdint.h>
extern char _dst[], _src[], _end[];
int main(void) {
memcpy(_dst, _src, _end - _src);
uint32_t *dst = (uint32_t *)_dst;
uint32_t *src = (uint32_t *)_src;
uint32_t *end = (uint32_t *)_end;
while (src < end) *dst++ = *src++;
return 0;
}
-----------------------------------------------
Well, I hope I'm not doing anything terribly wrong, but the above works very
nice for me, looks clean, involves pointer arithmetics and doesn't produce any
warnings. I also can't really understand how it is possible for pointer
comparison to be undefined. If you could point me to the corresponding C
standard section, I would really appreciate that! Thanks a lot again!
More information about the Gcc-bugs
mailing list