* src/SDCCast.c (isLoopCountable): fixed bug #1478316
[fw/sdcc] / src / SDCClabel.c
index d31f69d031d453e72303a9024b5c28ea5091dfb7..718e75f90fd3f7cb30ab7d57bf7ffb90c3276be4 100644 (file)
@@ -103,7 +103,7 @@ deleteIfx (iCode * loop, int key)
 {
   if (!options.lessPedantic)
     {
-      werror (W_CONTROL_FLOW, loop->filename, loop->lineno);
+      werrorfl (loop->filename, loop->lineno, W_CONTROL_FLOW);
     }
   hTabDeleteItem (&labelRef, key, loop, DELETE_ITEM, NULL);
              
@@ -384,6 +384,7 @@ labelUnreach (iCode * ic)
       /* statement is not a label           */
       if (loop->op == GOTO || loop->op == RETURN)
        {
+         int warn = 0;
 
          if (loop->next &&
              (loop->next->op == LABEL ||
@@ -405,15 +406,22 @@ labelUnreach (iCode * ic)
                  hTabDeleteItem (&labelRef, IC_LABEL (tic)->key, tic, DELETE_ITEM, NULL);
                  break;
                case IFX:
+                 warn = 1;
                  if (IC_TRUE (tic))
                    hTabDeleteItem (&labelRef, IC_TRUE (tic)->key, tic, DELETE_ITEM, NULL);
                  else
                    hTabDeleteItem (&labelRef, IC_FALSE (tic)->key, tic, DELETE_ITEM, NULL);
                  break;
+               default:
+                 warn = 1;
 
                }
            }
 
+         if (warn)
+           werrorfl (loop->next->filename, loop->next->lineno,
+                     W_CODE_UNREACH);
+
          /* now set up the pointers */
          loop->next = loop2;
          if (loop2)