assert_fail.c 436 B

12345678910111213141516171819
  1. /* Let's see what happens when an assert fails.
  2. *
  3. * Outcome on Ubuntu 19.04 shows the failure line:
  4. *
  5. * assert_fail.out: /path/to/linux-kernel-module-cheat/userland/c/assert_fail.c:15: main: Assertion `0' failed.
  6. *
  7. * and exit status 134 == 128 + 6, which corresponds to SIGABORT (6).
  8. */
  9. #include <assert.h>
  10. #include <stdlib.h>
  11. #include <stdio.h>
  12. int main(void) {
  13. assert(0);
  14. puts("here");
  15. return EXIT_SUCCESS;
  16. }