diff --git a/flang/lib/Evaluate/intrinsics.cpp b/flang/lib/Evaluate/intrinsics.cpp --- a/flang/lib/Evaluate/intrinsics.cpp +++ b/flang/lib/Evaluate/intrinsics.cpp @@ -1040,6 +1040,16 @@ static const IntrinsicInterface intrinsicSubroutine[]{ {"abort", {}, {}, Rank::elemental, IntrinsicClass::impureSubroutine}, + {"co_sum", + {{"a", AnyNumeric, Rank::elemental, Optionality::required, + common::Intent::InOut}, + {"result_image", AnyInt, Rank::scalar, Optionality::optional, + common::Intent::In}, + {"stat", AnyInt, Rank::scalar, Optionality::optional, + common::Intent::Out}, + {"errmsg", DefaultChar, Rank::scalar, Optionality::optional, + common::Intent::InOut}}, + {}, Rank::elemental, IntrinsicClass::collectiveSubroutine}, {"cpu_time", {{"time", AnyReal, Rank::scalar, Optionality::required, common::Intent::Out}}, diff --git a/flang/test/Semantics/collectives01.f90 b/flang/test/Semantics/collectives01.f90 --- a/flang/test/Semantics/collectives01.f90 +++ b/flang/test/Semantics/collectives01.f90 @@ -1,7 +1,5 @@ ! RUN: %python %S/test_errors.py %s %flang_fc1 -! XFAIL: * ! Check for semantic errors in co_sum() subroutine calls -! To Do: add co_sum to the evaluation stage module test_co_sum implicit none @@ -29,15 +27,12 @@ call co_sum(array, result_image=1, stat=status, errmsg=message) call co_sum(z, result_image=1, stat=status, errmsg=message) - ! the error is seen as an incorrect type for the stat= argument !ERROR: Actual argument for 'stat=' has bad type 'CHARACTER(KIND=1,LEN=1_8)' call co_sum(i, 1, message) - ! the error is seen as too many arguments to the co_sum() call !ERROR: too many actual arguments for intrinsic 'co_sum' call co_sum(i, result_image=1, stat=status, errmsg=message, 3.4) - ! keyword argument with incorrect type !ERROR: unknown keyword argument to intrinsic 'co_sum' call co_sum(fake=3.4)