Commit 906c3763 by Jakub Jelinek Committed by Jakub Jelinek

opts-1.c: New test.

	* c-c++-common/ubsan/opts-1.c: New test.
	* c-c++-common/ubsan/opts-2.c: New test.
	* c-c++-common/ubsan/opts-3.c: New test.
	* c-c++-common/ubsan/opts-4.c: New test.

From-SVN: r268929
parent 4c9ed22a
2019-02-15 Jakub Jelinek <jakub@redhat.com>
* c-c++-common/ubsan/opts-1.c: New test.
* c-c++-common/ubsan/opts-2.c: New test.
* c-c++-common/ubsan/opts-3.c: New test.
* c-c++-common/ubsan/opts-4.c: New test.
2019-02-15 Richard Biener <rguenther@suse.de>
Jakub Jelinek <jakub@redhat.com>
......
/* { dg-do compile } */
/* { dg-options "-fsanitize=undefined -fsanitize=shift -fsanitize=float-divide-by-zero -fdump-tree-optimized" } */
/* { dg-skip-if "" { *-*-* } { "-flto -fno-fat-lto-objects" } } */
/* { dg-final { scan-tree-dump-times "__ubsan_handle_divrem_overflow" 2 "optimized" } } */
/* { dg-final { scan-tree-dump-times "__ubsan_handle_shift_out_of_bounds" 1 "optimized" } } */
int
foo (int x, int y)
{
return x / y;
}
int
bar (int x, int y)
{
return x << y;
}
float
baz (float x, float y)
{
return x / y;
}
/* { dg-do compile } */
/* { dg-options "-fsanitize=undefined -fno-sanitize=shift -fsanitize=float-divide-by-zero -fdump-tree-optimized" } */
/* { dg-skip-if "" { *-*-* } { "-flto -fno-fat-lto-objects" } } */
/* { dg-final { scan-tree-dump-times "__ubsan_handle_divrem_overflow" 2 "optimized" } } */
/* { dg-final { scan-tree-dump-not "__ubsan_handle_shift_out_of_bounds" "optimized" } } */
int
foo (int x, int y)
{
return x / y;
}
int
bar (int x, int y)
{
return x << y;
}
float
baz (float x, float y)
{
return x / y;
}
/* { dg-do compile } */
/* { dg-options "-fsanitize=undefined -fno-sanitize=shift -fno-sanitize=float-divide-by-zero -fdump-tree-optimized" } */
/* { dg-skip-if "" { *-*-* } { "-flto -fno-fat-lto-objects" } } */
/* { dg-final { scan-tree-dump-times "__ubsan_handle_divrem_overflow" 1 "optimized" } } */
/* { dg-final { scan-tree-dump-not "__ubsan_handle_shift_out_of_bounds" "optimized" } } */
int
foo (int x, int y)
{
return x / y;
}
int
bar (int x, int y)
{
return x << y;
}
float
baz (float x, float y)
{
return x / y;
}
/* { dg-do compile } */
/* { dg-options "-fsanitize=undefined -fno-sanitize-recover=integer-divide-by-zero -fno-sanitize-recover=shift -fdump-tree-optimized" } */
/* { dg-skip-if "" { *-*-* } { "-flto -fno-fat-lto-objects" } } */
/* { dg-final { scan-tree-dump-times "__ubsan_handle_divrem_overflow_abort" 1 "optimized" } } */
/* { dg-final { scan-tree-dump-times "__ubsan_handle_shift_out_of_bounds_abort" 1 "optimized" } } */
/* { dg-final { scan-tree-dump-times "__ubsan_handle_type_mismatch_v1" 1 "optimized" } } */
/* { dg-final { scan-tree-dump-not "__ubsan_handle_type_mismatch_v1_abort" "optimized" } } */
int
foo (int x, int y)
{
return x / y;
}
int
bar (int x, int y)
{
return x << y;
}
enum E { E0, E1, E2, E3 };
enum E
baz (enum E *x)
{
return *x;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment