[flang-commits] [flang] [flang] Dodge bogus GCC 13.2.0 error message in new code (PR #86708)
via flang-commits
flang-commits at lists.llvm.org
Tue Mar 26 11:25:26 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-flang-parser
Author: Peter Klausler (klausler)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/86708.diff
2 Files Affected:
- (modified) flang/include/flang/Parser/parse-tree.h (+1-1)
- (modified) flang/lib/Parser/Fortran-parsers.cpp (+2-3)
``````````diff
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,
``````````
</details>
https://github.com/llvm/llvm-project/pull/86708
More information about the flang-commits
mailing list