<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hello,</p>
    <p>I have a question regarding the sanitizers. I would like to
      suppress one error in a third-party library, but still have the
      program exit 1 on any other failed check. It seems to me that
      -fno-sanitize-recover will exit the program regardless of the
      suppressions file's contents. With -fsanitize-recover on the other
      hand, the specified error is correctly suppressed and the other
      one still printed, but the program exits normally, which I don't
      want.</p>
    <p><br>
    </p>
    <pre>$ cat main.cpp
int main() {
  int k = 0x7fffffff;
  k++;      // signed-integer-overflow
  k <<= k;  // invalid-shift-exponent
  return 0;
}</pre>
    <pre>
$ clang++ -fsanitize=undefined -fno-sanitize-recover main.cpp -o main</pre>
    <pre>
$ cat supp.txt
signed-integer-overflow:main.cpp</pre>
    <pre>
$ UBSAN_OPTIONS=report_error_type=1,suppressions=supp.txt ./main
main.cpp:3:4: runtime error: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'
SUMMARY: UndefinedBehaviorSanitizer: signed-integer-overflow main.cpp:3:4 in</pre>
    <pre>
$ echo $?
1</pre>
    <pre>
$ clang++ -fsanitize=undefined -fsanitize-recover main.cpp -o main</pre>
    <pre>
$ UBSAN_OPTIONS=report_error_type=1,suppressions=supp.txt ./main
main.cpp:4:5: runtime error: shift exponent -2147483648 is negative
SUMMARY: UndefinedBehaviorSanitizer: invalid-shift-exponent main.cpp:4:5 in</pre>
    <pre>
$ echo $?
0</pre>
    <p><br>
    </p>
    <p>How can I achieve the desired behavior? Are Ubsan suppressions
      and -fno-sanitize-recover really mutually exclusive?<br>
    </p>
    <p>Cheers<br>
      Laurenz<br>
    </p>
  </body>
</html>