This includes common_sanitizer pieces.
$ cat ub.c
int main(int argc, char **argv) {
int k = 0x7fffffff; k += argc; return 0;
}
$ /usr/pkg/bin/clang -fsanitize=undefined ./ub.c
$ ./a.out
ub.c:3:5: runtime error: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'
Part of the code inspired by the original work on libsanitizer in GCC 5.4 by Christos Zoluas.
Sponsored by <The NetBSD Foundation>
Seems fragile. :-(
One thing that might happen (I don't know the details of your scheduler) is that a thread hitting this case might spin forever and take most of the CPU time, since it might end up with its priority (might be a differently named concept on your scheduler), due to always relinquishing the CPU very quickly (I've seen this kind of thing happen). This might end up being a problem when threads with the same CPU affinity are waiting for each other.