[flang-commits] [flang] c1a750b - [flang] Make sure range is valid (#104281)

via flang-commits flang-commits at lists.llvm.org
Thu Aug 15 14:11:07 PDT 2024


Author: Valentin Clement (バレンタイン クレメン)
Date: 2024-08-15T14:11:03-07:00
New Revision: c1a750b8bf7c7bfcd4e72537fcf76e5f23d0f06a

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

LOG: [flang] Make sure range is valid (#104281)

Attempt to solve #102495

Added: 
    

Modified: 
    flang/lib/Parser/provenance.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Parser/provenance.cpp b/flang/lib/Parser/provenance.cpp
index e31038b09e4072..fe92aa7f64fb1d 100644
--- a/flang/lib/Parser/provenance.cpp
+++ b/flang/lib/Parser/provenance.cpp
@@ -248,7 +248,7 @@ static void EmitPrefix(llvm::raw_ostream &o, llvm::raw_ostream::Colors color,
 
 std::optional<ProvenanceRange> AllSources::GetInclusionInfo(
     const std::optional<ProvenanceRange> &range) const {
-  if (!range)
+  if (!range || !IsValid(range->start()))
     return std::nullopt;
   const Origin &origin{MapToOrigin(range->start())};
 


        


More information about the flang-commits mailing list