Projet_SETI_RISC-V/riscv-gnu-toolchain/gcc/gcc/testsuite/gcc.dg/pr97505.c
2023-03-06 14:48:14 +01:00

23 lines
516 B
C

// { dg-do compile }
// { dg-options "-Os -fsanitize=signed-integer-overflow -fdump-tree-evrp" }
// Test that .UBSAN_CHECK_SUB(y, x) is treated as y-x for range
// purposes, where X and Y are related to each other.
//
// This effectively checks that range relationals work with builtins.
void unreachable();
int foobar(int x, int y)
{
if (x < y)
{
int z = y - x;
if (z == 0)
unreachable();
return z;
}
return 5;
}
// { dg-final { scan-tree-dump-not "unreachable" "evrp" } }