1 /* PR middle-end/78461 - [7 Regression] ICE: in operator+=, at
2 gimple-ssa-sprintf.c:214
3 Disable warnings to exercise code paths through the pass that may
4 not be exercised when the -Wformat-overflow option is in effect. */
6 { dg-options "-O2 -fdump-tree-optimized -w" } */
9 #define CAT(s, n) s ## n
10 #define FAIL(line) CAT (failure_on_line_, line)
12 /* Emit a call to a function named failure_on_line_NNN when EXPR is false. */
13 #define ASSERT(expr) \
15 extern void FAIL (__LINE__)(void); \
16 if (!(expr)) FAIL (__LINE__)(); \
19 #define KEEP(line) CAT (keep_call_on_line_, line)
21 /* Emit a call to a function named keep_call_on_line_NNN when EXPR is true.
22 Used to verify that the expression need not be the only one that holds. */
23 #define ASSERT_MAYBE(expr) \
25 extern void KEEP (__LINE__)(void); \
26 if (expr) KEEP (__LINE__)(); \
29 int f0 (const char *s
)
31 int n
= __builtin_snprintf (0, 0, "%.*s%08x", 1, s
, 1);
33 ASSERT (7 < n
&& n
< 10);
35 ASSERT_MAYBE (8 == n
);
36 ASSERT_MAYBE (9 == n
);
43 int f1 (const char *s
)
45 int n
= __builtin_snprintf (buf
, 64, "%.*s%08x", 1, s
, 1);
47 ASSERT (7 < n
&& n
< 10);
49 ASSERT_MAYBE (8 == n
);
50 ASSERT_MAYBE (9 == n
);
55 int f2 (const char *s
)
57 int n
= __builtin_snprintf (0, 0, "%.*s", 2, s
);
59 ASSERT (0 <= n
&& n
<= 2);
61 ASSERT_MAYBE (0 == n
);
62 ASSERT_MAYBE (1 == n
);
63 ASSERT_MAYBE (2 == n
);
68 /* { dg-final { scan-tree-dump-not "failure_on_line" "optimized"} }
69 { dg-final { scan-tree-dump-times "keep_call_on_line" 7 "optimized"} } */