Hi!

While glibc fprintf allows printing %s with NULL argument as (null),
other C libraries aren't that forgiving.  If loc isn't UNKNOWN_LOCATION,
but say BUILTINS_LOCATION, UNKNOWN_LOCATION with an associated BLOCK etc.,
we might ICE on those hosts.  The patch also changes find_loop_location,
so that it attempts to find a better location.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2013-01-22  Jakub Jelinek  <ja...@redhat.com>

        PR middle-end/56074
        * dumpfile.c (dump_loc): Only print loc if LOCATION_LOCUS (loc)
        isn't UNKNOWN_LOCATION nor BUILTINS_LOCATION.
        * tree-vect-loop-manip.c (find_loop_location): Also ignore
        stmt locations where LOCATION_LOCUS of the stmt location is
        UNKNOWN_LOCATION or BUILTINS_LOCATION.

--- gcc/dumpfile.c.jj   2013-01-18 21:23:04.000000000 +0100
+++ gcc/dumpfile.c      2013-01-22 10:53:29.933658993 +0100
@@ -260,7 +260,7 @@ dump_loc (int dump_kind, FILE *dfile, so
   /* Currently vectorization passes print location information.  */
   if (dump_kind)
     {
-      if (loc != UNKNOWN_LOCATION)
+      if (LOCATION_LOCUS (loc) > BUILTINS_LOCATION)
         fprintf (dfile, "\n%s:%d: note: ", LOCATION_FILE (loc),
                  LOCATION_LINE (loc));
       else if (current_function_decl)
--- gcc/tree-vect-loop-manip.c.jj       2013-01-16 17:04:19.000000000 +0100
+++ gcc/tree-vect-loop-manip.c  2013-01-22 10:56:08.984745253 +0100
@@ -1357,7 +1357,8 @@ find_loop_location (struct loop *loop)
 
   stmt = get_loop_exit_condition (loop);
 
-  if (stmt && gimple_location (stmt) != UNKNOWN_LOC)
+  if (stmt
+      && LOCATION_LOCUS (gimple_location (stmt)) > BUILTINS_LOCATION)
     return gimple_location (stmt);
 
   /* If we got here the loop is probably not "well formed",
@@ -1371,7 +1372,7 @@ find_loop_location (struct loop *loop)
   for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si))
     {
       stmt = gsi_stmt (si);
-      if (gimple_location (stmt) != UNKNOWN_LOC)
+      if (LOCATION_LOCUS (gimple_location (stmt)) > BUILTINS_LOCATION)
         return gimple_location (stmt);
     }
 

        Jakub

Reply via email to