Skip to content

Commit 3ab70e3

Browse files
authored
[Flang] Change sizeof argument name to "x" (llvm#130189)
This closes llvm#128610 by fixing the name of the argument to the sizeof function to be "x" and adds a test.
1 parent 304454f commit 3ab70e3

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

flang/lib/Evaluate/intrinsics.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -940,7 +940,7 @@ static const IntrinsicInterface genericIntrinsicFunction[]{
940940
OptionalDIM, // unless array is assumed-size
941941
SizeDefaultKIND},
942942
KINDInt, Rank::scalar, IntrinsicClass::inquiryFunction},
943-
{"sizeof", {{"a", AnyData, Rank::anyOrAssumedRank}}, SubscriptInt,
943+
{"sizeof", {{"x", AnyData, Rank::anyOrAssumedRank}}, SubscriptInt,
944944
Rank::scalar, IntrinsicClass::inquiryFunction},
945945
{"spacing", {{"x", SameReal}}, SameReal},
946946
{"spread",

flang/test/Semantics/sizeof.f90

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
! RUN: %python %S/test_errors.py %s %flang_fc1
2+
character(len=20) :: a, b
3+
if (sizeof(a) == sizeof(x=b)) then
4+
print *, "pass"
5+
else
6+
print *, "fail"
7+
end if
8+
!ERROR: unknown keyword argument to intrinsic 'sizeof'
9+
print *, sizeof(a=a)
10+
end

0 commit comments

Comments
 (0)