diff mbox

Use ggc allocated strings instead of malloced for debug macro sections (PR pch/51722)

Message ID 4F031D1D.5050607@gmail.com
State New
Headers show

Commit Message

Patrick Marlier Jan. 3, 2012, 3:22 p.m. UTC
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.


Patrick Marlier.

Comments

Jakub Jelinek Jan. 3, 2012, 3:34 p.m. UTC | #1
On Tue, Jan 03, 2012 at 10:22:05AM -0500, Patrick Marlier wrote:
> >@@ -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.

Just svn update, I've noticed it in my bootstrap and fixed it
for that, but forgot to update the patch I checked in.  Sorry.

	Jakub
diff mbox

Patch

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;