Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Apr 24, 2024
Merged

Conversation

klausler
Copy link
Contributor

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

Fixes #89851.

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

Fixes llvm#89851.
@llvmbot
Copy link
Collaborator

llvmbot commented Apr 24, 2024

@llvm/pr-subscribers-flang-semantics

Author: Peter Klausler (klausler)

Changes

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

Fixes #89851.


Full diff: https://github.com/llvm/llvm-project/pull/89993.diff

1 Files Affected:

  • (modified) flang/lib/Evaluate/intrinsics.cpp (+3-1)
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},

Copy link
Contributor

@clementval clementval left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@klausler klausler merged commit 14339ab into llvm:main Apr 24, 2024
6 of 7 checks passed
@klausler klausler deleted the bug89851 branch April 24, 2024 22:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flang:semantics flang Flang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Flang] flang-new crashes when NCOPIES argument of REPEAT intrinsic is not a scalar
3 participants