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

Dehao Chen <dehao at google dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dehao at google dot com

--- Comment #3 from Dehao Chen <dehao at google dot com> ---
This is a bug when updating block during tree-inline. Basically, it is legal
for *n to be NULL. E.g. When gimple_block(id->gimple_call) is NULL,
remap_blocks_to_null will be called to set *n to NULL.

The problem is that we should check this before calling COMBINE_LOCATION_DATA,
which assumes block is not NULL.

The following patch can fix the problem:

Index: gcc/tree-inline.c
===================================================================
--- gcc/tree-inline.c    (revision 203208)
+++ gcc/tree-inline.c    (working copy)
@@ -2090,7 +2090,10 @@ copy_phis_for_bb (basic_block bb, copy_body_data *
           n = (tree *) pointer_map_contains (id->decl_map,
             LOCATION_BLOCK (locus));
           gcc_assert (n);
-          locus = COMBINE_LOCATION_DATA (line_table, locus, *n);
+          if (*n)
+            locus = COMBINE_LOCATION_DATA (line_table, locus, *n);
+          else
+            locus = LOCATION_LOCUS (locus);
         }
           else
         locus = LOCATION_LOCUS (locus);

Reply via email to