https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108915
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- static char start_bar[0] says this is an array of size 0. The reduced testcase does not match up with the code in uboot though. Anyways GCC is correct for the reduced testcase, so is clang since it is undefined as you are accessing outside of the bounds of the array. The way to fix uboot code is to change the ll_entry_start/ll_entry_end to: #define ll_entry_start(_type, _list) \ ({ \ static char start[0] __aligned(CONFIG_LINKER_LIST_ALIGN) \ __attribute__((unused)) \ __section("__u_boot_list_2_"#_list"_1"); \ _type * tmp = (_type *)&start; \ asm("":"+r"(tmp)); \ tmp; \ }) #define ll_entry_end(_type, _list) \ ({ \ static char end[0] __aligned(4) __attribute__((unused)) \ __section("__u_boot_list_2_"#_list"_3"); \ _type * tmp = (_type *)&end; \ asm("":"+r"(tmp)); \ tmp; \ })