Increased internal buffer for large function and variable names.
authorjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 20 Mar 2001 11:14:25 +0000 (11:14 +0000)
committerjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 20 Mar 2001 11:14:25 +0000 (11:14 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@693 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/SDCCpeeph.c

index dbcb3eb04a5bfa96581cc00a3c4907ce816f8345..fb207ff21767cc4380c8485e6882b243b3b1cc30 100644 (file)
@@ -709,7 +709,9 @@ replaceRule (lineNode ** shead, lineNode * stail, peepRule * pr)
 {
   lineNode *cl = NULL;
   lineNode *pl = NULL, *lhead = NULL;
-  char lb[MAX_PATTERN_LEN];
+  /* a long function name and long variable name can evaluate to
+     4x max pattern length e.g. "mov dptr,((fie_var>>8)<<8)+fie_var" */
+  char lb[MAX_PATTERN_LEN*4];
   char *lbp;
   lineNode *comment = NULL;
 
@@ -745,11 +747,13 @@ replaceRule (lineNode ** shead, lineNode * stail, peepRule * pr)
                  l++;
                  continue;
                }
-             while (*v)
+             while (*v) {
                *lbp++ = *v++;
+             }
              l++;
-             while (isdigit (*l))
+             while (isdigit (*l)) {
                l++;
+             }
              continue;
            }
          *lbp++ = *l++;
@@ -953,7 +957,6 @@ top:
 
       for (spl = *pls; spl; spl = spl->next)
        {
-
          /* if inline assembler then no peep hole */
          if (spl->isInline)
            continue;