[flang-commits] [flang] [flang] Catch error on REPEAT(x, NCOPIES=array) (PR #89993)

Peter Klausler via flang-commits flang-commits at lists.llvm.org
Wed Apr 24 14:28:51 PDT 2024


https://github.com/klausler created https://github.com/llvm/llvm-project/pull/89993

The NCOPIES= argument to the intrinsic function REPEAT must be a scalar integer.

Fixes https://github.com/llvm/llvm-project/issues/89851.

>From bb88c9a67f069cf4510442e3d58a44df63003cc4 Mon Sep 17 00:00:00 2001
From: Peter Klausler <pklausler at nvidia.com>
Date: Wed, 24 Apr 2024 14:26:50 -0700
Subject: [PATCH] [flang] Catch error on REPEAT(x,NCOPIES=array)

The NCOPIES= argument to the intrinsic function REPEAT must
be a scalar integer.

Fixes https://github.com/llvm/llvm-project/issues/89851.
---
 flang/lib/Evaluate/intrinsics.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/flang/lib/Evaluate/intrinsics.cpp b/flang/lib/Evaluate/intrinsics.cpp
index f07f94b1a022c9..1b73cadb682d98 100644
--- a/flang/lib/Evaluate/intrinsics.cpp
+++ b/flang/lib/Evaluate/intrinsics.cpp
@@ -777,7 +777,9 @@ static const IntrinsicInterface genericIntrinsicFunction[]{
             {"identity", SameType, Rank::scalar, Optionality::optional},
             {"ordered", AnyLogical, Rank::scalar, Optionality::optional}},
         SameType, Rank::scalar, IntrinsicClass::transformationalFunction},
-    {"repeat", {{"string", SameCharNoLen, Rank::scalar}, {"ncopies", AnyInt}},
+    {"repeat",
+        {{"string", SameCharNoLen, Rank::scalar},
+            {"ncopies", AnyInt, Rank::scalar}},
         SameCharNoLen, Rank::scalar, IntrinsicClass::transformationalFunction},
     {"reshape",
         {{"source", SameType, Rank::array}, {"shape", AnyInt, Rank::shape},



More information about the flang-commits mailing list