re PR bootstrap/79052 (bootstrap-ubsan failures due to warnings)
authorRichard Biener <rguenther@suse.de>
Wed, 11 Jan 2017 11:26:59 +0000 (11:26 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 11 Jan 2017 11:26:59 +0000 (11:26 +0000)
2017-01-11  Richard Biener  <rguenther@suse.de>

PR bootstrap/79052
* gimple-parser.c (c_parser_gimple_switch_stmt): Add missing
returns on parse errors.

From-SVN: r244310

gcc/c/ChangeLog
gcc/c/gimple-parser.c

index 6e1c985701681da2c68a14b6d4f5c4460480dd33..a47e10c06ea690b591b60aad27c0c145317b2f02 100644 (file)
@@ -1,3 +1,9 @@
+2017-01-11  Richard Biener  <rguenther@suse.de>
+
+       PR bootstrap/79052
+       * gimple-parser.c (c_parser_gimple_switch_stmt): Add missing
+       returns on parse errors.
+
 2017-01-04  Marek Polacek  <polacek@redhat.com>
 
        PR c++/64767
index 291bbf6159e7736c3f764ee5a2a9929bc2f9a515..37e792ac35554d60206803056511b592638fd7d2 100644 (file)
@@ -1259,118 +1259,120 @@ c_parser_gimple_switch_stmt (c_parser *parser, gimple_seq *seq)
   gimple_seq switch_body = NULL;
   c_parser_consume_token (parser);
 
-  if (c_parser_require (parser, CPP_OPEN_PAREN, "expected %<(%>"))
-    {
-      cond_expr = c_parser_gimple_postfix_expression (parser);
-      if (! c_parser_require (parser, CPP_CLOSE_PAREN, "expected %<)%>"))
-       return;
-    }
+  if (! c_parser_require (parser, CPP_OPEN_PAREN, "expected %<(%>"))
+    return;
+  cond_expr = c_parser_gimple_postfix_expression (parser);
+  if (! c_parser_require (parser, CPP_CLOSE_PAREN, "expected %<)%>"))
+    return;
+
+  if (! c_parser_require (parser, CPP_OPEN_BRACE, "expected %<{%>"))
+    return;
 
-  if (c_parser_require (parser, CPP_OPEN_BRACE, "expected %<{%>"))
+  while (c_parser_next_token_is_not (parser, CPP_CLOSE_BRACE))
     {
-      while (c_parser_next_token_is_not (parser, CPP_CLOSE_BRACE))
+      if (c_parser_next_token_is (parser, CPP_EOF))
        {
-         if (c_parser_next_token_is (parser, CPP_EOF))
-           {
-             c_parser_error (parser, "expected statement");
-             return;
-           }
+         c_parser_error (parser, "expected statement");
+         return;
+       }
 
-         switch (c_parser_peek_token (parser)->keyword)
-           {
-           case RID_CASE:
-             {
-               c_expr exp1;
-               location_t loc = c_parser_peek_token (parser)->location;
-               c_parser_consume_token (parser);
+      switch (c_parser_peek_token (parser)->keyword)
+       {
+       case RID_CASE:
+         {
+           c_expr exp1;
+           location_t loc = c_parser_peek_token (parser)->location;
+           c_parser_consume_token (parser);
 
-               if (c_parser_next_token_is (parser, CPP_NAME)
-                   || c_parser_peek_token (parser)->type == CPP_NUMBER)
-                 exp1 = c_parser_gimple_postfix_expression (parser);
-               else
-                 c_parser_error (parser, "expected expression");
+           if (c_parser_next_token_is (parser, CPP_NAME)
+               || c_parser_peek_token (parser)->type == CPP_NUMBER)
+             exp1 = c_parser_gimple_postfix_expression (parser);
+           else
+             {
+               c_parser_error (parser, "expected expression");
+               return;
+             }
 
-               if (c_parser_next_token_is (parser, CPP_COLON))
+           if (c_parser_next_token_is (parser, CPP_COLON))
+             {
+               c_parser_consume_token (parser);
+               if (c_parser_next_token_is (parser, CPP_NAME))
                  {
+                   label = c_parser_peek_token (parser)->value;
                    c_parser_consume_token (parser);
-                   if (c_parser_next_token_is (parser, CPP_NAME))
-                     {
-                       label = c_parser_peek_token (parser)->value;
-                       c_parser_consume_token (parser);
-                       tree decl = lookup_label_for_goto (loc, label);
-                       case_label = build_case_label (exp1.value, NULL_TREE,
-                                                      decl);
-                       labels.safe_push (case_label);
-                       if (! c_parser_require (parser, CPP_SEMICOLON,
-                                               "expected %<;%>"))
-                         return;
-                     }
-                   else if (! c_parser_require (parser, CPP_NAME,
-                                                "expected label"))
+                   tree decl = lookup_label_for_goto (loc, label);
+                   case_label = build_case_label (exp1.value, NULL_TREE,
+                                                  decl);
+                   labels.safe_push (case_label);
+                   if (! c_parser_require (parser, CPP_SEMICOLON,
+                                           "expected %<;%>"))
                      return;
                  }
-               else if (! c_parser_require (parser, CPP_SEMICOLON,
-                                           "expected %<:%>"))
+               else if (! c_parser_require (parser, CPP_NAME,
+                                            "expected label"))
                  return;
-               break;
              }
-           case RID_DEFAULT:
+           else if (! c_parser_require (parser, CPP_SEMICOLON,
+                                        "expected %<:%>"))
+             return;
+           break;
+         }
+       case RID_DEFAULT:
+         {
+           location_t loc = c_parser_peek_token (parser)->location;
+           c_parser_consume_token (parser);
+           if (c_parser_next_token_is (parser, CPP_COLON))
              {
-               location_t loc = c_parser_peek_token (parser)->location;
                c_parser_consume_token (parser);
-               if (c_parser_next_token_is (parser, CPP_COLON))
+               if (c_parser_next_token_is (parser, CPP_NAME))
                  {
+                   label = c_parser_peek_token (parser)->value;
                    c_parser_consume_token (parser);
-                   if (c_parser_next_token_is (parser, CPP_NAME))
-                     {
-                       label = c_parser_peek_token (parser)->value;
-                       c_parser_consume_token (parser);
-                       tree decl = lookup_label_for_goto (loc, label);
-                       default_label = build_case_label (NULL_TREE, NULL_TREE,
-                                                         decl);
-                       if (! c_parser_require (parser, CPP_SEMICOLON,
-                                               "expected %<;%>"))
-                         return;
-                     }
-                   else if (! c_parser_require (parser, CPP_NAME,
-                                                "expected label"))
+                   tree decl = lookup_label_for_goto (loc, label);
+                   default_label = build_case_label (NULL_TREE, NULL_TREE,
+                                                     decl);
+                   if (! c_parser_require (parser, CPP_SEMICOLON,
+                                           "expected %<;%>"))
                      return;
                  }
-               else if (! c_parser_require (parser, CPP_SEMICOLON,
-                                           "expected %<:%>"))
+               else if (! c_parser_require (parser, CPP_NAME,
+                                            "expected label"))
                  return;
-               break;
              }
-           case RID_GOTO:
+           else if (! c_parser_require (parser, CPP_SEMICOLON,
+                                        "expected %<:%>"))
+             return;
+           break;
+         }
+       case RID_GOTO:
+         {
+           location_t loc = c_parser_peek_token (parser)->location;
+           c_parser_consume_token (parser);
+           if (c_parser_next_token_is (parser, CPP_NAME))
              {
-               location_t loc = c_parser_peek_token (parser)->location;
+               c_parser_gimple_goto_stmt (loc,
+                                          c_parser_peek_token
+                                          (parser)->value,
+                                          &switch_body);
                c_parser_consume_token (parser);
-               if (c_parser_next_token_is (parser, CPP_NAME))
+               if (c_parser_next_token_is (parser, CPP_SEMICOLON))
+                 c_parser_consume_token (parser);
+               else
                  {
-                   c_parser_gimple_goto_stmt (loc,
-                                              c_parser_peek_token
-                                                (parser)->value,
-                                              &switch_body);
-                   c_parser_consume_token (parser);
-                   if (c_parser_next_token_is (parser, CPP_SEMICOLON))
-                     c_parser_consume_token (parser);
-                   else
-                     {
-                       c_parser_error (parser, "expected semicolon");
-                       return;
-                     }
+                   c_parser_error (parser, "expected semicolon");
+                   return;
                  }
-               else if (! c_parser_require (parser, CPP_NAME,
-                                           "expected label"))
-                 return;
-               break;
              }
-           default:
-             c_parser_error (parser, "expected case label or goto statement");
+           else if (! c_parser_require (parser, CPP_NAME,
+                                        "expected label"))
              return;
-           }
-
+           break;
+         }
+       default:
+         c_parser_error (parser, "expected case label or goto statement");
+         return;
        }
+
     }
   if (! c_parser_require (parser, CPP_CLOSE_BRACE, "expected %<}%>"))
     return;