[flang-commits] [flang] [flang] Make sure range is valid (PR #104281)
Valentin Clement バレンタイン クレメン via flang-commits
flang-commits at lists.llvm.org
Wed Aug 14 14:58:12 PDT 2024
https://github.com/clementval created https://github.com/llvm/llvm-project/pull/104281
Attempt to solve #102495
>From b4aecc48cc553bca746ac35b452fa51be7d054fa Mon Sep 17 00:00:00 2001
From: Valentin Clement <clementval at gmail.com>
Date: Wed, 14 Aug 2024 14:57:26 -0700
Subject: [PATCH] [flang] Make sure range is valid
---
flang/lib/Parser/provenance.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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