1 /* Verify the lower and upper bounds of floating directives with
2 precision whose range crosses zero.
4 { dg-options "-O2 -Wall -fdump-tree-optimized" } */
6 static const double x
= 1.23456789;
8 /* All calls to failure_range must be eliminated. */
9 extern void failure_range (int, int, int);
11 /* All calls to verify_{lo,hi}_bound must be retained. */
12 extern void verify_lo_bound (int, int);
13 extern void verify_hi_bound (int, int);
20 int n
= __builtin_snprintf (0, 0, "%.*A", p
, x
);
22 failure_range ('A', 6, 25);
24 if (n
== 6) verify_lo_bound ('A', 6);
25 if (n
== 25) verify_hi_bound ('A', 25);
35 int n
= __builtin_snprintf (0, 0, "%.*E", p
, x
);
37 failure_range ('E', 5, 17);
39 if (n
== 5) verify_lo_bound ('E', 5);
40 if (n
== 17) verify_hi_bound ('E', 17);
50 int n
= __builtin_snprintf (0, 0, "%.*F", p
, x
);
52 failure_range ('F', 1, 13);
54 if (n
== 1) verify_lo_bound ('F', 1);
55 if (n
== 13) verify_hi_bound ('F', 13);
65 int n
= __builtin_snprintf (0, 0, "%.*G", p
, x
);
67 failure_range ('G', 1, 12);
69 if (n
== 1) verify_lo_bound ('G', 1);
70 if (n
== 12) verify_hi_bound ('G', 12);
75 /* { dg-final { scan-tree-dump-times "snprintf" 4 "optimized"} }
76 { dg-final { scan-tree-dump-not "failure_range" "optimized"} }
77 { dg-final { scan-tree-dump-times "verify_" 8 "optimized"} } */