This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/59250] usan: ICE (segfault) with -fsanitize=undefined in ubsan_create_data


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59250

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Yeah, I bet this hunk

--- gcc/ubsan.c.jj    2013-11-22 01:40:03.000000000 +0100
+++ gcc/ubsan.c    2013-11-22 10:05:29.491725405 +0100
@@ -227,8 +227,8 @@ ubsan_source_location (location_t loc)
   xloc = expand_location (loc);

   /* Fill in the values from LOC.  */
-  size_t len = strlen (xloc.file);
-  tree str = build_string (len + 1, xloc.file);
+  size_t len = xloc.file ? strlen (xloc.file) : 0;
+  tree str = build_string (len + 1, xloc.file ? xloc.file : "");
   TREE_TYPE (str) = build_array_type (char_type_node,
                       build_index_type (size_int (len)));
   TREE_READONLY (str) = 1;
@@ -642,7 +642,7 @@ ubsan_pass (void)
     {
       struct walk_stmt_info wi;
       gimple stmt = gsi_stmt (gsi);
-      if (is_gimple_debug (stmt))
+      if (is_gimple_debug (stmt) || gimple_clobber_p (stmt))
         {
           gsi_next (&gsi);
           continue;

from Jakub's recent patch
(http://gcc.gnu.org/ml/gcc-patches/2013-11/msg02831.html) will fix it.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]