Debian Codegraph @

gcc/testsuite/gcc.dg/ubsan/commutative-1.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-fsanitize=undefined -fdump-tree-optimized" } */
3 /* { dg-skip-if "" { *-*-* } { "-O0" "-flto" } { "" } } */
4
5 int res[2];
6
7 void
8 f1 (int x, int y)
9 {
10 res[0] = x + y;
11 res[1] = y + x;
12 }
13
14 void
15 f2 (int x, int y)
16 {
17 res[0] = x - y;
18 res[1] = y - x;
19 }
20
21 void
22 f3 (int x, int y)
23 {
24 res[0] = x * y;
25 res[1] = y * x;
26 }
27
28 /* { dg-final { scan-tree-dump-times {\.UBSAN_CHECK_ADD} 1 "optimized" } } */
29 /* { dg-final { scan-tree-dump-times {\.UBSAN_CHECK_SUB} 2 "optimized" } } */
30 /* { dg-final { scan-tree-dump-times {\.UBSAN_CHECK_MUL} 1 "optimized" } } */