re PR sanitizer/69055 (Internal compiler error -fsanitize=float-cast-overflow)
authorJakub Jelinek <jakub@redhat.com>
Fri, 1 Jan 2016 11:55:02 +0000 (12:55 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 1 Jan 2016 11:55:02 +0000 (12:55 +0100)
PR sanitizer/69055
* ubsan.c (ubsan_instrument_float_cast): Call
initialize_sanitizer_builtins.

* gfortran.dg/pr69055.f90: New test.

From-SVN: r232024

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/pr69055.f90 [new file with mode: 0644]
gcc/ubsan.c

index 32d3ecf545e4f36ee6d1e20805a0889ae8a76d7e..8f67593969f80de1518a5f7263df5b48bc2283f5 100644 (file)
@@ -1,5 +1,9 @@
 2016-01-01  Jakub Jelinek  <jakub@redhat.com>
 
+       PR sanitizer/69055
+       * ubsan.c (ubsan_instrument_float_cast): Call
+       initialize_sanitizer_builtins.
+
        PR target/69015
        * ifcvt.c (find_cond_trap): Give up if returnjump_p (jump).
 \f
index 178c13ee2d95cd1df611a8b074298a8fe02d9042..3de98fbbca156944b11161bfe8c6981944d8df78 100644 (file)
@@ -1,5 +1,8 @@
 2016-01-01  Jakub Jelinek  <jakub@redhat.com>
 
+       PR sanitizer/69055
+       * gfortran.dg/pr69055.f90: New test.
+
        PR target/69015
        * gcc.dg/pr69015.c: New test.
 \f
diff --git a/gcc/testsuite/gfortran.dg/pr69055.f90 b/gcc/testsuite/gfortran.dg/pr69055.f90
new file mode 100644 (file)
index 0000000..48b3442
--- /dev/null
@@ -0,0 +1,10 @@
+! { dg-do compile }
+! { dg-options "-fsanitize=float-cast-overflow" }
+
+subroutine pr69055
+  implicit none
+  integer :: n
+  real(8) :: b
+  b = huge(1.0D0)
+  n = b
+end subroutine pr69055
index 6fc6233c035edc3b0ada840daf817e6678c5c390..522967a22a0460cab485603df815e36be2e1680e 100644 (file)
@@ -1588,6 +1588,7 @@ ubsan_instrument_float_cast (location_t loc, tree type, tree expr, tree arg)
     {
       location_t *loc_ptr = NULL;
       unsigned num_locations = 0;
+      initialize_sanitizer_builtins ();
       /* Figure out if we can propagate location to ubsan_data and use new
          style handlers in libubsan.  */
       if (ubsan_use_new_style_p (loc))