https://github.com/ShashwathiNavada updated 
https://github.com/llvm/llvm-project/pull/200733

>From 41e30ff1295e902804a2e013deb775a86062ab1c Mon Sep 17 00:00:00 2001
From: ShashwathiNavada <[email protected]>
Date: Mon, 1 Jun 2026 01:51:03 -0500
Subject: [PATCH 1/4] [Flang] Fix -frelaxed-c-loc-checks being ignored when
 using the driver

---
 clang/lib/Driver/ToolChains/Flang.cpp    | 3 ++-
 flang/test/Semantics/c_loc01-relaxed.f90 | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Flang.cpp 
b/clang/lib/Driver/ToolChains/Flang.cpp
index 892a455167205..8b6e83528fecf 100644
--- a/clang/lib/Driver/ToolChains/Flang.cpp
+++ b/clang/lib/Driver/ToolChains/Flang.cpp
@@ -261,7 +261,8 @@ void Flang::addCodegenOptions(const ArgList &Args,
        options::OPT_frepack_arrays_contiguity_EQ,
        options::OPT_fstack_repack_arrays, options::OPT_fno_stack_repack_arrays,
        options::OPT_ftime_report, options::OPT_ftime_report_EQ,
-       options::OPT_funroll_loops, options::OPT_fno_unroll_loops});
+       options::OPT_funroll_loops, options::OPT_fno_unroll_loops,
+       options::OPT_relaxed_c_loc});
   if (Args.hasArg(options::OPT_fcoarray))
     CmdArgs.push_back("-fcoarray");
 }
diff --git a/flang/test/Semantics/c_loc01-relaxed.f90 
b/flang/test/Semantics/c_loc01-relaxed.f90
index 714d4acd5e06f..bfb036b6c0580 100644
--- a/flang/test/Semantics/c_loc01-relaxed.f90
+++ b/flang/test/Semantics/c_loc01-relaxed.f90
@@ -1,4 +1,5 @@
 ! RUN: %python %S/test_errors.py %s %flang_fc1 -frelaxed-c-loc-checks
+! RUN: %python %S/test_errors.py %s %flang -frelaxed-c-loc-checks
 module m
   use iso_c_binding
   type haslen(L)

>From 5bf76c3e49e217d2d986566e79a355ec4c3a7952 Mon Sep 17 00:00:00 2001
From: ShashwathiNavada <[email protected]>
Date: Mon, 1 Jun 2026 09:46:17 -0500
Subject: [PATCH 2/4] Suggested changes

---
 flang/test/Driver/frelaxed-c-loc-checks.f90 | 3 +++
 flang/test/Semantics/c_loc01-relaxed.f90    | 1 -
 2 files changed, 3 insertions(+), 1 deletion(-)
 create mode 100644 flang/test/Driver/frelaxed-c-loc-checks.f90

diff --git a/flang/test/Driver/frelaxed-c-loc-checks.f90 
b/flang/test/Driver/frelaxed-c-loc-checks.f90
new file mode 100644
index 0000000000000..4d5a1455fdc5c
--- /dev/null
+++ b/flang/test/Driver/frelaxed-c-loc-checks.f90
@@ -0,0 +1,3 @@
+RUN: %flang -### -frelaxed-c-loc-checks %s 2>&1 | FileCheck %s
+CHECK: "-fc1"
+CHECK-SAME: "-frelaxed-c-loc-checks"
diff --git a/flang/test/Semantics/c_loc01-relaxed.f90 
b/flang/test/Semantics/c_loc01-relaxed.f90
index bfb036b6c0580..714d4acd5e06f 100644
--- a/flang/test/Semantics/c_loc01-relaxed.f90
+++ b/flang/test/Semantics/c_loc01-relaxed.f90
@@ -1,5 +1,4 @@
 ! RUN: %python %S/test_errors.py %s %flang_fc1 -frelaxed-c-loc-checks
-! RUN: %python %S/test_errors.py %s %flang -frelaxed-c-loc-checks
 module m
   use iso_c_binding
   type haslen(L)

>From 8a2aea0a467317a445aabc586c4e967a5cc71416 Mon Sep 17 00:00:00 2001
From: ShashwathiNavada <[email protected]>
Date: Mon, 1 Jun 2026 09:51:59 -0500
Subject: [PATCH 3/4] Simple change

---
 flang/test/Driver/frelaxed-c-loc-checks.f90 | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/flang/test/Driver/frelaxed-c-loc-checks.f90 
b/flang/test/Driver/frelaxed-c-loc-checks.f90
index 4d5a1455fdc5c..320818ca707d3 100644
--- a/flang/test/Driver/frelaxed-c-loc-checks.f90
+++ b/flang/test/Driver/frelaxed-c-loc-checks.f90
@@ -1,3 +1,4 @@
-RUN: %flang -### -frelaxed-c-loc-checks %s 2>&1 | FileCheck %s
-CHECK: "-fc1"
-CHECK-SAME: "-frelaxed-c-loc-checks"
+! Check that -frelaxed-c-loc-checks is forwarded from the driver to fc1.
+! RUN: %flang -### -frelaxed-c-loc-checks %s 2>&1 | FileCheck %s
+! CHECK: "-fc1"
+! CHECK-SAME: "-frelaxed-c-loc-checks"

>From 38921f6af5aec428dd6dcae62c743a1d95e2363c Mon Sep 17 00:00:00 2001
From: ShashwathiNavada <[email protected]>
Date: Wed, 3 Jun 2026 17:11:08 +0530
Subject: [PATCH 4/4] Update Flang.cpp

---
 clang/lib/Driver/ToolChains/Flang.cpp | 1 -
 1 file changed, 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Flang.cpp 
b/clang/lib/Driver/ToolChains/Flang.cpp
index abcd487899747..a27cdd5f64fca 100644
--- a/clang/lib/Driver/ToolChains/Flang.cpp
+++ b/clang/lib/Driver/ToolChains/Flang.cpp
@@ -264,7 +264,6 @@ void Flang::addCodegenOptions(const ArgList &Args,
        options::OPT_funroll_loops, options::OPT_fno_unroll_loops,
        options::OPT_relaxed_c_loc});
 
-
   const llvm::Triple &Triple = getToolChain().getEffectiveTriple();
   addSeparateSectionFlags(Triple, Args, CmdArgs);
 

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to