[PATCH] fix an uninitialized use of loc when parsing gimple switches

tbsaunde+gcc@tbsaunde.org tbsaunde+gcc@tbsaunde.org
Thu Oct 27 04:09:00 GMT 2016


From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>

gcc/c/ChangeLog:

2016-10-27  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* gimple-parser.c (c_parser_gimple_switch_stmt): Fix
	uninitialized use of loc.
---
 gcc/c/gimple-parser.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gcc/c/gimple-parser.c b/gcc/c/gimple-parser.c
index e9e3aae..8db425f 100644
--- a/gcc/c/gimple-parser.c
+++ b/gcc/c/gimple-parser.c
@@ -1164,7 +1164,6 @@ c_parser_gimple_switch_stmt (c_parser *parser, gimple_seq *seq)
   auto_vec<tree> labels;
   tree default_label = NULL_TREE;
   gimple_seq switch_body = NULL;
-  location_t loc;
   c_parser_consume_token (parser);
 
   if (c_parser_require (parser, CPP_OPEN_PAREN, "expected %<(%>"))
@@ -1189,7 +1188,7 @@ c_parser_gimple_switch_stmt (c_parser *parser, gimple_seq *seq)
 	    case RID_CASE:
 	      {
 		c_expr exp1;
-		loc = c_parser_peek_token (parser)->location;
+		location_t loc = c_parser_peek_token (parser)->location;
 		c_parser_consume_token (parser);
 
 		if (c_parser_next_token_is (parser, CPP_NAME)
@@ -1224,6 +1223,7 @@ c_parser_gimple_switch_stmt (c_parser *parser, gimple_seq *seq)
 	      }
 	    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))
 		  {
@@ -1250,7 +1250,7 @@ c_parser_gimple_switch_stmt (c_parser *parser, gimple_seq *seq)
 	      }
 	    case RID_GOTO:
 	      {
-		loc = c_parser_peek_token (parser)->location;
+		location_t loc = c_parser_peek_token (parser)->location;
 		c_parser_consume_token (parser);
 		if (c_parser_next_token_is (parser, CPP_NAME))
 		  {
-- 
2.10.1



More information about the Gcc-patches mailing list