I have a program that I have trimmed down that fails to build with GCC on F42 and F43. It used to build and does build with clang. The error generated makes no sense to me:
cc -O3 -Wall -Werror -Wextra -Wmissing-prototypes -Wstrict-prototypes -Wcast-align -Wcast-qual -Wformat=2 -Wundef -MD -MF obj/gccbug.o.d -c -o obj/gccbug.o gccbug.c
In function ‘setAll’,
inlined from ‘**do_work**’ at **gccbug.c:39:2**, inlined from ‘**main**’ at **gccbug.c:48:2**:gccbug.c:28:34: error: ‘__builtin_memset’ writing 632 bytes into a region of size 628 [-Werror=stringop-overflow=]
28 | *(ba->p + intSS) = ~0;
| **\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~^\~\~\~**In function ‘createBitArray’,
inlined from ‘**do_work**’ at **gccbug.c:38:7**, inlined from ‘**main**’ at **gccbug.c:48:2**:gccbug.c:19:17: note: destination object of size 628 allocated by ‘malloc’
19 | ba->p = malloc(ba->intsInArray * sizeof(BIT_WORD_TYPE));
| **^\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~**cc1: all warnings being treated as errors
I have seen the error both on X86_64 and riscv64. I would upload the source but I don’t see a way to do that here. Tell me how to do that and I will.