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 57810] Wasted work in validate_const_int()


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=57810 .

In method "validate_const_int()" in "gcc/read-rtl.c", the loop on line 804
should break immediately after "valid" is set to "0". All the iterations
after "valid" set to "0" do not perform any useful work, at best they just
set "valid" again to "0".

Suggested patch:

Index: gcc/read-rtl.c
===================================================================
--- gcc/read-rtl.c	(revision 200945)
+++ gcc/read-rtl.c	(working copy)
@@ -803,7 +803,11 @@
     valid = 0;
   for (; *cp; cp++)
     if (! ISDIGIT (*cp))
-      valid = 0;
+      {
+        valid = 0;
+        break;
+      }
+
   if (!valid)
     fatal_with_file_and_line ("invalid decimal constant \"%s\"\n", string);
 }

-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]