1 // { dg-do compile }
2 // { dg-options "-Os -fsanitize=signed-integer-overflow -fdump-tree-evrp" }
3
4 // Test that .UBSAN_CHECK_SUB(y, x) is treated as y-x for range
5 // purposes, where X and Y are related to each other.
6 //
7 // This effectively checks that range relationals work with builtins.
8
9 void unreachable();
10
foobar(int x,int y)11 int foobar(int x, int y)
12 {
13 if (x < y)
14 {
15 int z = y - x;
16 if (z == 0)
17 unreachable();
18 return z;
19 }
20 return 5;
21 }
22
23 // { dg-final { scan-tree-dump-not "unreachable" "evrp" } }
24