clang-diagnostic-array-bounds warning for impossible case in switch statement #35463
Labels
bugzilla
Issues migrated from bugzilla
clang:diagnostics
New/improved warning or error message in Clang, but not in clang-tidy or static analyzer
clang
Clang issues not falling into any other category
Extended Description
STR:
clang-tidy -warnings-as-errors=clang-diagnostic-array-bounds test_case.c
/tmp/test_case.c:6:7: error: array index 300 is past the end of the array (which contains 10 elements) [clang-diagnostic-array-bounds,-warnings-as-errors]
y[300] = 4;
^
/tmp/test_case.c:3:3: note: array 'y' declared here
int y [10];
^
My test case is definitely contrived, but I see effectively the same thing running clang-tidy on the Linux kernel in include/linux/signal.h:122
The text was updated successfully, but these errors were encountered: