Unlike a static analysis check, this check will be done at run-time as explained in the following blog entry: GCC Undefined Behavior Sanitizer – ubsan. It will output a runtime error when it detects undefined behavior:
In order to check your program with ubsan, compile and link the
program with -fsanitize=undefined option. Such instrumented binaries
have to be executed; if ubsan detects any problem, it outputs a
“runtime error:” message, and in most cases continues executing the
program. There is a possibility of making these diagnostic messages
abort — just use the option -fno-sanitize-recover.
And we can see an example from there:
int main() {
int i = 23;
i <<= 32;
}
when ran using -fsanitize=undefined
will output (see it live):
runtime error: shift exponent 32 is too large for 32-bit type 'int'
GCC documents this option in their Options for Debugging Your Program or GCC section and it says:
Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
Various computations are instrumented to detect undefined behavior at
runtime.
As for the asan issue this address-sanitizer document gives you an example and the expected results. Perhaps your case it related to this gcc bug.