Closed kyku closed 5 months ago
I have tried to reproduce. I don't have a gcc 14.1.1 environment available, but I used godbolt: https://godbolt.org/z/Yvv85Evof Can you modify this so that it produces the error?
If not, could you tell me the platform and maybe give the full command line for compiling 11_calling_functions.cpp, (should be in your Makefile or build.ninja).
I'm building on Arch Linux.
I'm attaching compile commands where you can find all the invocations of the compiler… compile_commands.json
…as well as the build.log: build.log
It seems the error gets triggered when you add -O3 flag: https://godbolt.org/z/zE6noM8zT
Yeah, its pretty amazing how the compiler can shave away the abstractions.
I will fix it.
I'm tempted at adding a
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstringop-overflow="
#pragma GCC diagnostic pop
around the the code in question. This looks like a gcc bug to me. The warning as I understand the warning message is that a buffer is indexed with -1. The code that does this is this:
Can anyone chime in if they see that I'm missing the point here?
I have spent way to much on this. GCC is giving some false positives on these warnings. I have pushed a patch to resolve it somewhat, however I had to disable array-bounds checking with -Wno-array-bounds. I have checked the code where it complains and the warnings are not correct. I tried to make a small compilable example so I could send it to the gcc guys, but I was either in a docker env or in godbolt, and it was just too tedious. I would be very grateful if someone out there managed to do this.
I got these after just caling ./build.sh: