[flang-commits] [flang] 506b4cd - [flang] Change vector always errors to warnings (#95908)
via flang-commits
flang-commits at lists.llvm.org
Tue Jun 18 06:26:01 PDT 2024
Author: David Truby
Date: 2024-06-18T14:25:56+01:00
New Revision: 506b4cdae0929ff4bc7174cb580b5e55b8a74a0b
URL: https://github.com/llvm/llvm-project/commit/506b4cdae0929ff4bc7174cb580b5e55b8a74a0b
DIFF: https://github.com/llvm/llvm-project/commit/506b4cdae0929ff4bc7174cb580b5e55b8a74a0b.diff
LOG: [flang] Change vector always errors to warnings (#95908)
Added:
Modified:
flang/lib/Lower/Bridge.cpp
flang/lib/Semantics/canonicalize-directives.cpp
flang/test/Semantics/loop-directives.f90
Removed:
################################################################################
diff --git a/flang/lib/Lower/Bridge.cpp b/flang/lib/Lower/Bridge.cpp
index 423c418889a00..a3088b55a3f78 100644
--- a/flang/lib/Lower/Bridge.cpp
+++ b/flang/lib/Lower/Bridge.cpp
@@ -2609,9 +2609,6 @@ class FirConverter : public Fortran::lower::AbstractConverter {
if (e->isA<Fortran::parser::NonLabelDoStmt>())
e->dirs.push_back(&dir);
- else
- fir::emitFatalError(toLocation(),
- "loop directive must appear before a loop");
}
void genFIR(const Fortran::parser::CompilerDirective &dir) {
diff --git a/flang/lib/Semantics/canonicalize-directives.cpp b/flang/lib/Semantics/canonicalize-directives.cpp
index 4bf36754eb10b..ae691ab612ba2 100644
--- a/flang/lib/Semantics/canonicalize-directives.cpp
+++ b/flang/lib/Semantics/canonicalize-directives.cpp
@@ -104,7 +104,7 @@ void CanonicalizationOfDirectives::CheckLoopDirective(
std::string s{parser::ToUpperCaseLetters(dir.source.ToString())};
s.pop_back(); // Remove trailing newline from source string
messages_.Say(
- dir.source, "A DO loop must follow the %s directive"_err_en_US, s);
+ dir.source, "A DO loop must follow the %s directive"_warn_en_US, s);
}
}
diff --git a/flang/test/Semantics/loop-directives.f90 b/flang/test/Semantics/loop-directives.f90
index e2807c1f9d0e2..6f994c767d45f 100644
--- a/flang/test/Semantics/loop-directives.f90
+++ b/flang/test/Semantics/loop-directives.f90
@@ -1,19 +1,19 @@
-! RUN: %python %S/test_errors.py %s %flang
+! RUN: %python %S/test_errors.py %s %flang_fc1 -Werror
subroutine empty
- ! ERROR: A DO loop must follow the VECTOR ALWAYS directive
+ ! WARNING: A DO loop must follow the VECTOR ALWAYS directive
!dir$ vector always
end subroutine empty
subroutine non_do
- ! ERROR: A DO loop must follow the VECTOR ALWAYS directive
+ ! WARNING: A DO loop must follow the VECTOR ALWAYS directive
!dir$ vector always
a = 1
end subroutine non_do
subroutine execution_part
do i=1,10
- ! ERROR: A DO loop must follow the VECTOR ALWAYS directive
+ ! WARNING: A DO loop must follow the VECTOR ALWAYS directive
!dir$ vector always
end do
end subroutine execution_part
More information about the flang-commits
mailing list