On Thu, Feb 14, 2019 at 05:48:29AM -0800, H.J. Lu wrote:
> I got
> 
> UNRESOLVED: c-c++-common/ubsan/opts-1.c   -O2 -flto
> -fuse-linker-plugin -fno-fat-lto-objects   scan-tree-dump-times
> optimized "__ubsan_handle_divrem_overflow" 2

Ah, yes, UNRESOLVED doesn't show up visible when running tests by hand,
rather than doing test_summary.  Here is an updated patch that adds the
needed dg-skip-if directives.  Ok for trunk?

2019-02-14  Jakub Jelinek  <ja...@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.

--- gcc/testsuite/c-c++-common/ubsan/opts-1.c.jj        2019-02-14 
11:31:33.144895232 +0100
+++ gcc/testsuite/c-c++-common/ubsan/opts-1.c   2019-02-14 11:33:23.049077585 
+0100
@@ -0,0 +1,23 @@
+/* { 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;
+}
--- gcc/testsuite/c-c++-common/ubsan/opts-2.c.jj        2019-02-14 
11:33:29.806965829 +0100
+++ gcc/testsuite/c-c++-common/ubsan/opts-2.c   2019-02-14 11:34:03.169414166 
+0100
@@ -0,0 +1,23 @@
+/* { 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;
+}
--- gcc/testsuite/c-c++-common/ubsan/opts-3.c.jj        2019-02-14 
11:34:10.538292322 +0100
+++ gcc/testsuite/c-c++-common/ubsan/opts-3.c   2019-02-14 11:34:35.512879358 
+0100
@@ -0,0 +1,23 @@
+/* { 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;
+}
--- gcc/testsuite/c-c++-common/ubsan/opts-4.c.jj        2019-02-14 
11:40:35.771922337 +0100
+++ gcc/testsuite/c-c++-common/ubsan/opts-4.c   2019-02-14 11:40:29.220030674 
+0100
@@ -0,0 +1,27 @@
+/* { 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;
+}


        Jakub

Reply via email to