On 01/03/2012 08:25 AM, Jakub Jelinek wrote:
Hi!

Referring to malloced strings from GC hashtable macinfo_table entries
and then freeing them at the end of compilation process is problematic
with PCH, because without PCH the strings are malloced, but with PCH
ggc allocated after restore and thus free on them is invalid.

Fixed by making the strings GC allocated all the time.

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

@@ -20909,7 +20905,6 @@ output_macinfo (void)
          if (!VEC_empty (macinfo_entry, files))
            {
              macinfo_entry *file = VEC_last (macinfo_entry, files);
-             free (CONST_CAST (char *, file->info));
              VEC_pop (macinfo_entry, files);
            }
          break;

This breaks bootstrap:
../../trunk/gcc/dwarf2out.c: In function ‘void output_macinfo()’:
../../trunk/gcc/dwarf2out.c:20907:23: error: unused variable ‘file’ [-Werror=unused-variable]
cc1plus: all warnings being treated as errors

I guess it is a way to fix it.

Index: gcc/dwarf2out.c
===================================================================
--- gcc/dwarf2out.c     (revision 182848)
+++ gcc/dwarf2out.c     (working copy)
@@ -20904,7 +20904,6 @@ output_macinfo (void)
        case DW_MACINFO_end_file:
          if (!VEC_empty (macinfo_entry, files))
            {
-             macinfo_entry *file = VEC_last (macinfo_entry, files);
              VEC_pop (macinfo_entry, files);
            }
          break;

Patrick Marlier.

Reply via email to