re PR debug/82933 (valgrind error in set_cur_line_info_table with -g)
authorJakub Jelinek <jakub@redhat.com>
Tue, 21 Nov 2017 07:50:15 +0000 (08:50 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 21 Nov 2017 07:50:15 +0000 (08:50 +0100)
PR debug/82933
* run-rtl-passes.c: Include debug.h.
(run_rtl_passes): Call debug_hooks->assembly_start.
* dwarf2out.c (dwarf2out_assembly_start): Return early if invoked
multiple times.

* gcc.dg/rtl/x86_64/pr82933.c: New test.

From-SVN: r254987

gcc/ChangeLog
gcc/dwarf2out.c
gcc/run-rtl-passes.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/rtl/x86_64/pr82933.c [new file with mode: 0644]

index 8efe4b7c59f979722d94f103904053d9821977ae..1c3aaede5ec0a945c88f8a56e6c636e28ee3989b 100644 (file)
@@ -1,5 +1,11 @@
 2017-11-21  Jakub Jelinek  <jakub@redhat.com>
 
+       PR debug/82933
+       * run-rtl-passes.c: Include debug.h.
+       (run_rtl_passes): Call debug_hooks->assembly_start.
+       * dwarf2out.c (dwarf2out_assembly_start): Return early if invoked
+       multiple times.
+
        PR target/82981
        * internal-fn.c (expand_mul_overflow): Use OPTAB_WIDEN instead of
        OPTAB_DIRECT in calls to expand_simple_binop.
index 76a538f1ff97a69a0356feed2e8a9f3630b8971a..7fd6ae37fd27cd0604f0bc4d559aff64098e7591 100644 (file)
@@ -27507,6 +27507,9 @@ dwarf2out_init (const char *filename ATTRIBUTE_UNUSED)
 static void
 dwarf2out_assembly_start (void)
 {
+  if (text_section_line_info)
+    return;
+
 #ifndef DWARF2_LINENO_DEBUGGING_INFO
   ASM_GENERATE_INTERNAL_LABEL (text_section_label, TEXT_SECTION_LABEL, 0);
   ASM_GENERATE_INTERNAL_LABEL (text_end_label, TEXT_END_LABEL, 0);
index e1ac4bd0954f8ae0f65df7f8e7860e3e90a15526..dfb5d53eb0dd6ef48096aa8630095ef7f9323fb7 100644 (file)
@@ -30,6 +30,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "bitmap.h"
 #include "df.h"
 #include "regs.h"
+#include "debug.h" /* for debug_hooks.  */
 #include "insn-attr-common.h" /* for INSN_SCHEDULING.  */
 #include "insn-attr.h" /* for init_sched_attrs.  */
 #include "run-rtl-passes.h"
@@ -43,6 +44,9 @@ run_rtl_passes (char *initial_pass_name)
   cfun->pass_startwith = initial_pass_name;
   max_regno = max_reg_num ();
 
+  /* cgraphunit.c normally handles this.  */
+  (*debug_hooks->assembly_start) ();
+
   /* Pass "expand" normally sets this up.  */
 #ifdef INSN_SCHEDULING
   init_sched_attrs ();
index 12a217f2b4679240568645d2f3c4c3778673b682..32fce8c44216efb8fa71040f888e1f8ce7c54c15 100644 (file)
@@ -1,3 +1,8 @@
+2017-11-21  Jakub Jelinek  <jakub@redhat.com>
+
+       PR debug/82933
+       * gcc.dg/rtl/x86_64/pr82933.c: New test.
+
 2017-11-20  Eric Gallager  <egall@gwmail.gwu.edu>
 
        PR preprocessor/81794
diff --git a/gcc/testsuite/gcc.dg/rtl/x86_64/pr82933.c b/gcc/testsuite/gcc.dg/rtl/x86_64/pr82933.c
new file mode 100644 (file)
index 0000000..68ffe45
--- /dev/null
@@ -0,0 +1,4 @@
+/* { dg-do run { target { { i?86-*-* x86_64-*-* } && lp64 } } } */
+/* { dg-options "-g" } */
+
+#include "into-cfglayout.c"