This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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

Attachment: patch.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]