re PR bootstrap/81216 (bootstrap failed on i386 and powerpc64le)
authorMarek Polacek <polacek@redhat.com>
Tue, 27 Jun 2017 07:16:29 +0000 (07:16 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Tue, 27 Jun 2017 07:16:29 +0000 (07:16 +0000)
PR bootstrap/81216
* parser.c (cp_parser_already_scoped_statement): Initialize
LOC_AFTER_LABELS.

* g++.dg/warn/Wmultistatement-macros-1.C: New test.

From-SVN: r249676

gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/warn/Wmultistatement-macros-1.C [new file with mode: 0644]

index c067d23eb8a2f14a62d6f82cf71fc370db24956f..53aadf4ac44cc78c1396cab230722b30bebecc08 100644 (file)
@@ -1,3 +1,9 @@
+2017-06-27  Marek Polacek  <polacek@redhat.com>
+
+       PR bootstrap/81216
+       * parser.c (cp_parser_already_scoped_statement): Initialize
+       LOC_AFTER_LABELS.
+
 2017-06-26  Jason Merrill  <jason@redhat.com>
 
        PR c++/81215 - deduction failure with variadic TTP.
index c405fe5b77611fd1041b342bd105a9e6027f1e45..573b97a658f57075c499977cb4dda725c06e20d2 100644 (file)
@@ -12438,7 +12438,7 @@ cp_parser_already_scoped_statement (cp_parser* parser, bool *if_p,
     {
       token_indent_info body_tinfo
        = get_token_indent_info (cp_lexer_peek_token (parser->lexer));
-      location_t loc_after_labels;
+      location_t loc_after_labels = UNKNOWN_LOCATION;
 
       cp_parser_statement (parser, NULL_TREE, false, if_p, NULL,
                           &loc_after_labels);
@@ -12446,7 +12446,8 @@ cp_parser_already_scoped_statement (cp_parser* parser, bool *if_p,
        = get_token_indent_info (cp_lexer_peek_token (parser->lexer));
       warn_for_misleading_indentation (guard_tinfo, body_tinfo, next_tinfo);
 
-      if (next_tinfo.type != CPP_SEMICOLON)
+      if (loc_after_labels != UNKNOWN_LOCATION
+         && next_tinfo.type != CPP_SEMICOLON)
        warn_for_multistatement_macros (loc_after_labels, next_tinfo.location,
                                        guard_tinfo.location,
                                        guard_tinfo.keyword);
index d7c906aad6f59eb409eca43113c7d90e10b8a0f0..38e5c7a94348c0c695f2c17770dee0874cbbbbf8 100644 (file)
@@ -1,3 +1,8 @@
+2017-06-27  Marek Polacek  <polacek@redhat.com>
+
+       PR bootstrap/81216
+       * g++.dg/warn/Wmultistatement-macros-1.C: New test.
+
 2017-06-26  Martin Sebor  <msebor@redhat.com>
 
        PR c++/81169
diff --git a/gcc/testsuite/g++.dg/warn/Wmultistatement-macros-1.C b/gcc/testsuite/g++.dg/warn/Wmultistatement-macros-1.C
new file mode 100644 (file)
index 0000000..afaef9a
--- /dev/null
@@ -0,0 +1,13 @@
+// PR bootstrap/81216
+// { dg-options "-Wmultistatement-macros" }
+// { dg-do compile }
+
+template <typename A, typename B>
+static bool
+equal (A a, A b, B c)
+{
+  for (; a != b; ++a, (void)++c)
+    if (!(*a == *c))
+      return false;
+  return true;
+}