re PR debug/69705 (segfault in libgomp.fortran/task1.f90 with -flto -fno-use-linker...
authorJakub Jelinek <jakub@gcc.gnu.org>
Wed, 24 Feb 2016 22:04:09 +0000 (23:04 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 24 Feb 2016 22:04:09 +0000 (23:04 +0100)
PR debug/69705
* dwarf2out.c (gen_variable_die): Work around buggy LTO
- allow NULL decl for Fortran DW_TAG_common_block variables.

From-SVN: r233685

gcc/ChangeLog
gcc/dwarf2out.c
gcc/testsuite/ChangeLog

index 913abc8..3cae3cb 100644 (file)
@@ -1,9 +1,15 @@
+2016-02-24  Jakub Jelinek  <jakub@redhat.com>
+
+       PR debug/69705
+       * dwarf2out.c (gen_variable_die): Work around buggy LTO
+       - allow NULL decl for Fortran DW_TAG_common_block variables.
+
 2016-02-24  Jason Merrill  <jason@redhat.com>
 
        * common.opt (flifetime-dse): Add -flifetime-dse=1.
 
 2016-02-24  Richard Biener  <rguenther@suse.de>
-       Jakub Jelinek  <jakub@redhat.com>
+           Jakub Jelinek  <jakub@redhat.com>
 
        PR middle-end/69760
        * tree-scalar-evolution.c (interpret_rhs_expr): Re-write
index d8ca1b7..97e192b 100644 (file)
@@ -21055,7 +21055,7 @@ gen_variable_die (tree decl, tree origin, dw_die_ref context_die)
                 DW_TAG_common_block and DW_TAG_variable.  */
              loc = loc_list_from_tree (com_decl, 2, NULL);
            }
-          else if (DECL_EXTERNAL (decl))
+         else if (DECL_EXTERNAL (decl_or_origin))
            add_AT_flag (com_die, DW_AT_declaration, 1);
          if (want_pubnames ())
            add_pubname_string (cnam, com_die); /* ??? needed? */
@@ -21070,8 +21070,9 @@ gen_variable_die (tree decl, tree origin, dw_die_ref context_die)
          remove_AT (com_die, DW_AT_declaration);
        }
       var_die = new_die (DW_TAG_variable, com_die, decl);
-      add_name_and_src_coords_attributes (var_die, decl);
-      add_type_attribute (var_die, TREE_TYPE (decl), decl_quals (decl), false,
+      add_name_and_src_coords_attributes (var_die, decl_or_origin);
+      add_type_attribute (var_die, TREE_TYPE (decl_or_origin),
+                         decl_quals (decl_or_origin), false,
                          context_die);
       add_AT_flag (var_die, DW_AT_external, 1);
       if (loc)
@@ -21093,9 +21094,10 @@ gen_variable_die (tree decl, tree origin, dw_die_ref context_die)
            }
          add_AT_location_description (var_die, DW_AT_location, loc);
        }
-      else if (DECL_EXTERNAL (decl))
+      else if (DECL_EXTERNAL (decl_or_origin))
        add_AT_flag (var_die, DW_AT_declaration, 1);
-      equate_decl_number_to_die (decl, var_die);
+      if (decl)
+       equate_decl_number_to_die (decl, var_die);
       return;
     }
 
index e5cfd9a..305ebf7 100644 (file)
@@ -28,7 +28,7 @@
        * g++.dg/pr61033.C: Add a regression testcase for PR debug/61033.
 
 2016-02-24  Richard Biener  <rguenther@suse.de>
-       Jakub Jelinek  <jakub@redhat.com>
+           Jakub Jelinek  <jakub@redhat.com>
 
        PR middle-end/69760
        * gcc.dg/torture/pr69760.c: New testcase.