Debian Codegraph @

gcc/testsuite/g++.dg/ubsan/return-8b.C

raw
1 // PR c++/104642
2
3 // With -fsanitize=unreachable we shouldn't optimize away the call to f.
4
5 // { dg-do run }
6 // { dg-shouldfail { *-*-* } }
7 // { dg-additional-options "-O -fsanitize=unreachable" }
8
9 bool b;
10
11 int f() {
12 if (b) return 42;
13 __builtin_unreachable ();
14 return 24;
15 }
16
17 int main() { f(); }