[Patch, PR 57805] Wasted work in write_roots()

pchang9@cs.wisc.edu pchang9@cs.wisc.edu
Wed Jul 17 16:41:00 GMT 2013


Hi,

The problem appears in revision 200945 in version 4.9.  I attached
a one-line patch that fixes it.  I also reported this problem at
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57805.

In method "write_roots()" in gcc/gengtype.c, the loop on line 4682 should
break immediately after "skip_p" is set to "1". All the iterations after
"skip_p" set to "1" do not perform any useful work, at best they just set
"skip_p" again to "1".

Suggested patch:

Index: gcc/gengtype.c
===================================================================
--- gcc/gengtype.c	(revision 200945)
+++ gcc/gengtype.c	(working copy)
@@ -4682,7 +4682,10 @@
       for (o = v->opt; o; o = o->next)
 	if (strcmp (o->name, "deletable") == 0
 	    || strcmp (o->name, "if_marked") == 0)
-	  skip_p = 1;
+	  {
+	    skip_p = 1;
+	    break;
+	  }

       if (skip_p)
 	continue;

-Chang
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch.diff
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20130717/7bb70157/attachment.ksh>


More information about the Gcc-patches mailing list