gcc fails to build test/list.c on x86-32 with -Os
Obviously a niche issue, and I'm leaning towards this being a gcc bug, but I thought I'd file it here in case I'm missing something simple.
With CFLAGS=-Os on x86-32, gcc (v11.2.0 here) fails to build test/list.c:
In file included from ../test/list.c:32:
../test/list.c: In function ‘list_test’:
../include/list.h:311:10: error: array subscript 0 is outside array bounds of ‘struct parent[1]’ [-Werror=array-bounds]
311 | &pos->member != (head); \
../test/list.c:213:5: note: in expansion of macro ‘xorg_list_for_each_entry’
213 | xorg_list_for_each_entry(c, &parent.children, node) {
| ^~~~~~~~~~~~~~~~~~~~~~~~
../test/list.c:193:19: note: while referencing ‘parent’
193 | struct parent parent = { 0 };
| ^~~~~~
cc1: some warnings being treated as errors
The error array subscript 0 is outside array bounds of ‘struct parent[1]’
seems nonsensical on its face.
Neither gcc -O2, nor gcc on x86-64, nor clang -Os complain about the code. Before commit d189102c gcc didn't complain about this.