Debian Codegraph @

gcc/testsuite/c-c++-common/torture/harden-cfr-returning.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-fharden-control-flow-redundancy -fhardcfr-check-returning-calls -fno-exceptions -fdump-tree-hardcfr -ffat-lto-objects" } */
3
4 /* Check that we insert checks before returning calls and alternate paths, even
5 at -O0, because of the explicit command-line flag. */
6
7 void g (void);
8 void g2 (void);
9 void g3 (void);
10
11 void f (int i) {
12 if (!i)
13 /* Out-of-line checks here... */
14 g ();
15 else if (i > 0)
16 /* here... */
17 g2 ();
18 /* else */
19 /* and in the implicit else here. */
20 }
21
22 void f2 (int i) {
23 if (!i)
24 /* Out-of-line check here... */
25 g ();
26 else if (i > 0)
27 /* here... */
28 g2 ();
29 else
30 /* and here. */
31 g3 ();
32 }
33
34 /* { dg-final { scan-tree-dump-times "hardcfr_check" 6 "hardcfr" } } */
35 /* { dg-final { scan-tree-dump-times "__builtin_trap" 0 "hardcfr" } } */