[flang-commits] [flang] 8a84596 - [flang] Dodge bogus GCC 13.2.0 error message in new code (#86708)

via flang-commits flang-commits at lists.llvm.org
Tue Mar 26 12:41:57 PDT 2024


Author: Peter Klausler
Date: 2024-03-26T12:41:54-07:00
New Revision: 8a84596310f5b141817c784f0b4b46a636767e6e

URL: https://github.com/llvm/llvm-project/commit/8a84596310f5b141817c784f0b4b46a636767e6e
DIFF: https://github.com/llvm/llvm-project/commit/8a84596310f5b141817c784f0b4b46a636767e6e.diff

LOG: [flang] Dodge bogus GCC 13.2.0 error message in new code (#86708)

Rearrange some new code a little bit to avoid a bogus error message
coming out from GCC 13.2.0 about an uninitialized data member in a
parser.

Added: 
    

Modified: 
    flang/include/flang/Parser/parse-tree.h
    flang/lib/Parser/Fortran-parsers.cpp

Removed: 
    


################################################################################
diff  --git a/flang/include/flang/Parser/parse-tree.h b/flang/include/flang/Parser/parse-tree.h
index 85e8121dd1250c..26b2e5f4e34b06 100644
--- a/flang/include/flang/Parser/parse-tree.h
+++ b/flang/include/flang/Parser/parse-tree.h
@@ -3317,7 +3317,7 @@ struct CompilerDirective {
     TUPLE_CLASS_BOILERPLATE(NameValue);
     std::tuple<Name, std::optional<std::uint64_t>> t;
   };
-  struct Unrecognized {};
+  EMPTY_CLASS(Unrecognized);
   CharBlock source;
   std::variant<std::list<IgnoreTKR>, LoopCount, std::list<AssumeAligned>,
       std::list<NameValue>, Unrecognized>

diff  --git a/flang/lib/Parser/Fortran-parsers.cpp b/flang/lib/Parser/Fortran-parsers.cpp
index fd28eea0f947d2..21185694227d98 100644
--- a/flang/lib/Parser/Fortran-parsers.cpp
+++ b/flang/lib/Parser/Fortran-parsers.cpp
@@ -1280,9 +1280,8 @@ TYPE_PARSER(beginDirective >> "DIR$ "_tok >>
                     many(construct<CompilerDirective::NameValue>(
                         name, maybe(("="_tok || ":"_tok) >> digitString64))))) /
             endOfStmt ||
-        construct<CompilerDirective>(
-            SkipTo<'\n'>{} >> pure<CompilerDirective::Unrecognized>()) /
-            endOfStmt))
+        construct<CompilerDirective>(pure<CompilerDirective::Unrecognized>()) /
+            SkipTo<'\n'>{}))
 
 TYPE_PARSER(extension<LanguageFeature::CrayPointer>(
     "nonstandard usage: based POINTER"_port_en_US,


        


More information about the flang-commits mailing list