https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116984
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |INVALID Status|UNCONFIRMED |RESOLVED --- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> --- And note that ubsan instrumentation of array accesses isn't considered a side-effect for __builtin_object_size/__builtin_dynamic_object_size evaluation (otherwise the builtins with -fsanitize=undefined would be pretty useless, when cases like int index = 0; __builtin_object_size (&array[index], 0); would be considered side-effects for which the builtin is documented to return the "don't know" return value, (size_t)-1 for 0/1, 0 for 2/3 modes). So, &array[index] isn't considered to have side-effects even when instrumented and UB in it will be diagnosed (if any).