Debian Codegraph @

gcc/testsuite/g++.dg/torture/harden-cfr-throw-returning.C

raw
1 /* { dg-do compile } */
2 /* { dg-options "-fharden-control-flow-redundancy -fhardcfr-check-noreturn-calls=never -foptimize-sibling-calls -fdump-tree-hardcfr -ffat-lto-objects" } */
3
4 /* Check that we insert cleanups for checking around the bodies of
5 maybe-throwing functions. These results depend on checking before
6 returning calls, which is only enabled when sibcall optimizations
7 are enabled, so change the optimization mode to -O1 for f and f2,
8 so that -foptimize-sibling-calls can take effect and enable
9 -fhardcfr-check-returning-calls, so that we get the same results.
10 There is a separate test for -O0. */
11
12 #if ! __OPTIMIZE__
13 void __attribute__ ((__optimize__ (1, "-foptimize-sibling-calls"))) f(int i);
14 void __attribute__ ((__optimize__ (1, "-foptimize-sibling-calls"))) f2(int i);
15 void __attribute__ ((__optimize__ (1, "-foptimize-sibling-calls"))) h3(void);
16 #endif
17
18 #include "harden-cfr-throw.C"
19
20 /* f gets out-of-line checks before the unwrapped tail call and in the
21 else edge. */
22 /* f2 gets out-of-line checks before both unwrapped tail calls. */
23 /* h gets out-of-line checks before the implicit return and in the
24 cleanup block. */
25 /* h2 and h2b get out-of-line checks before the cleanup returning
26 call, and in the cleanup block. */
27 /* h3 gets an inline check before the __cxa_end_catch returning call. */
28 /* h4 gets an inline check in the cleanup block. */
29
30 /* { dg-final { scan-tree-dump-times "hardcfr_check" 10 "hardcfr" } } */
31 /* { dg-final { scan-tree-dump-times "builtin_trap" 2 "hardcfr" } } */