https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110676
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|builtin optimization |strlen of array[1] should |prevents ASan from |not be optimized to 1 if |detecting OOB reads |using ASAN Ever confirmed|0 |1 Status|UNCONFIRMED |NEW Last reconfirmed| |2023-07-15 --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Confirmed. It is only an array of size 1 which is going to cause this issue. array of size 2 is always fine, e.g.: ``` #include <string.h> int main(void) { char s[2] = "AA"; return strlen(s); } ``` gives the expected error message.