libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / pr116024-2-fwrapv.c
blobb9e88ba79fc4084673dacda29a92e5106307043c
1 /* PR tree-optimization/116024 */
2 /* { dg-do compile } */
3 /* { dg-options "-O1 -fdump-tree-forwprop1-details -fwrapv" } */
5 #include <stdint.h>
6 #include <limits.h>
8 uint32_t f(void);
10 int32_t i3(void)
12 int32_t l = -10 + (int32_t)f();
13 return l <= INT32_MAX - 10; // f() >= INT32_MIN + 10
16 int32_t i3a(void)
18 int32_t l = -20 + (int32_t)f();
19 return l < INT32_MAX - 19; // f() > INT32_MAX + 20
22 int32_t i3b(void)
24 int32_t l = 30 + (int32_t)f();
25 return l >= INT32_MIN + 30; // f() <= INT32_MAX - 30
28 int32_t i3c(void)
30 int32_t l = 40 + (int32_t)f();
31 return l > INT32_MIN + 39; // f() < INT32_MIN - 40
34 /* { dg-final { scan-tree-dump-times "Removing dead stmt:.*? \\+" 4 "forwprop1" } } */
35 /* { dg-final { scan-tree-dump-times "gimple_simplified to.* >= -2147483638" 1 "forwprop1" } } */
36 /* { dg-final { scan-tree-dump-times "gimple_simplified to.* >= -2147483628" 1 "forwprop1" } } */
37 /* { dg-final { scan-tree-dump-times "gimple_simplified to.* <= 2147483617" 1 "forwprop1" } } */
38 /* { dg-final { scan-tree-dump-times "gimple_simplified to.* <= 2147483607" 1 "forwprop1" } } */