Hi All,
You should know that gcc 10.2.0 is not compatible with previous gcc versions, and could easily miscompile previously working source.
1. an interesting thing, that memory addresses and builtins work differently. This will cause a segfault:
Code:
memcpy(&data + x, &data + y, ...);
However these compile correctly:
Code:
memcpy((void*)&data + x, (void*)&data + y, ...); or
memcpy(&data[x], &data[y], ...);
This was reported to me
here, you can try the code and all (single file example,
mkboot.c).
2. strings are concatenated incorrectly, this is specially important for UEFI boot loader writers. gcc prior to 10.2.0 concatenated
L"a" "b" "c" correctly into
L"abc". But with 10.2.0 not any more!
I can't even describe this with C syntax, only in a dump: prior 10.2.0 that string constant was
'a' 0 'b' 0 'c' 0 0 0, but with 10.2.0:
'a' 0 'b' 'c' 0. This is particularly annoying if your code uses POSIX defines like PRIu64 and others, since they are defined as strings and not as widestrings. Watch out! For example
L"%" PRIu64 " bytes" won't become
L"%lu bytes" as expected (and how it was prior to 10.2.0), but you have to use
L"%" L##PRIu64 L" bytes" or something! I run into this problem with my USBImager's Windows port
here, which uses wchar_t and therefore needs L"" constants.
Cheers,
bzt