[flang-commits] [clang] [flang] [flang] Diagnose integer MOD/MODULO when the divisor is zero (PR #222790)

via flang-commits flang-commits at lists.llvm.org
Tue Sep 15 11:27:46 PDT 2026


================
@@ -292,6 +292,14 @@ bool CodeGenAction::beginSourceFileAction() {
         mlir::BoolAttr::get(mod.getContext(), true));
   }
 
+  if (ci.getInvocation().getLangOpts().CheckIntegerModZero) {
+    mlir::ModuleOp mod = lb.getModule();
+    mod.getOperation()->setAttr(
+        mlir::StringAttr::get(mod.getContext(),
+                              llvm::Twine{"fir.check_integer_mod_zero"}),
----------------
junfengd-nv wrote:

Done.

https://github.com/llvm/llvm-project/pull/222790


More information about the flang-commits mailing list