sberg added a comment.
I'm surprised that
$ cat test.c
struct S {
int m1;
int m2[1];
};
void f(struct S * s) {
s->m2[1] = 0;
}
$ clang -fsyntax-only -fstrict-flex-arrays=1 test.c
test.c:6:5: warning: array index 1 is past the end of the array (which
contains 1 element) [-Warray-bounds]
s->m2[1] = 0;
^ ~
test.c:3:5: note: array 'm2' declared here
int m2[1];
^
1 warning generated.
causes a warning? I would have expected it to be suppressed in this case, as
with the lax `-fstrict-flex-arrays=0` default, and only to hit with the
stricter `-fstrict-flex-arrays=2`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D126864/new/
https://reviews.llvm.org/D126864
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits