Comment

Comment by qb45

I don't know if it's guaranteed to bark on all possible cases of UB, but there we go:

  $ cat test.c
  int main() {
          return *(int*)0;
  }
  $ gcc test.c -fsanitize=undefined -o test
  $ ./test
  test.c:2:9: runtime error: load of null pointer of type 'int'
  Segmentation fault
I'm pretty sure I've seen similar tool based on clang as well.

And there is valgrind.

parent qb45 11 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton