Comment by mananaysiempre
3 hours ago
I’m so used to sticking -Wall in my compilation flags the moment I write a build script that I didn’t realize it wasn’t there for this quick experiment. Yes, thank you, there are indeed diagnostics once you ask for them:
test.cpp: In function ‘double solve(double, ...)’:
test.cpp:4:20: warning: array subscript 1 is outside array bounds of ‘double [1]’ [-Warray-bounds=]
4 | return a + 1[&a] + 2[&a] + 3[&a];
| ~~~~^
test.cpp:3:58: note: at offset 8 into object ‘a’ of size 8
3 | extern "C" __attribute__((noinline)) double solve(double a, ...) {
| ~~~~~~~^
[repeat twice more for the other two accesses]
No comments yet
Contribute on Hacker News ↗