1 /* { dg-do compile } */
2 /* { dg-options "-fharden-control-flow-redundancy -fhardcfr-check-returning-calls -fno-hardcfr-check-exceptions -fdump-tree-hardcfr -ffat-lto-objects -Wno-return-type" } */
4 /* Check that we insert CFR checking so as to not disrupt tail calls.
5 Mandatory tail calls are not available in C, and optimizing calls as tail
6 calls only takes place after hardcfr, so we insert checking before calls
7 followed by copies and return stmts with the same return value, that might
8 (or might not) end up optimized to tail calls. */
13 /* Inline check before the returning call. */
17 extern void g2 (int i
);
20 /* Inline check before the returning call, that ignores the returned value,
21 matching the value-less return. */
27 /* Inline check before the returning call. */
33 /* Out-of-line check before the returning call. */
35 /* Out-of-line check before implicit return. */
39 /* Not regarded as a returning call, returning value other than callee's
42 /* Inline check after the non-returning call. */
46 /* Out-of-line checks in f4, before returning calls and before return. */
47 /* { dg-final { scan-tree-dump-times "hardcfr_check" 2 "hardcfr" } } */
48 /* Inline checking in all other functions. */
49 /* { dg-final { scan-tree-dump-times "__builtin_trap" 4 "hardcfr" } } */
50 /* Check before tail-call in all but f5, but f4 is out-of-line. */
51 /* { dg-final { scan-tree-dump-times "Inserting inline check before stmt" 3 "hardcfr" } } */
52 /* { dg-final { scan-tree-dump-times "Inserting out-of-line check before stmt" 1 "hardcfr" } } */