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]

a minor dbgcnt bug fix


Hi, the attached patch fixes a bug in dbgcnt limit setting by name.
The length is not checked which will result in false matching. For
instance -fdbg-cnt=dce:10 will find counter dce_ud.

Testing: bootstrap and tested on i686/linux.

Ok to commit?

Thanks,

David
Index: gcc/dbgcnt.c
===================================================================
--- gcc/dbgcnt.c	(revision 149643)
+++ gcc/dbgcnt.c	(working copy)
@@ -82,7 +82,8 @@ dbg_cnt_set_limit_by_name (const char *n
 {
   int i;
   for (i = debug_counter_number_of_counters - 1; i >= 0; i--)
-    if (!strncmp (map[i].name, name, len))
+    if (strncmp (map[i].name, name, len) == 0
+        && map[i].name[len] == '\0')
       break;
 
   if (i < 0)

Attachment: dbg.chg
Description: Binary data


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