[libc-commits] [clang] [flang] [llvm] [libc] [clang-tools-extra] [compiler-rt] Apply kind code check on exitstat and cmdstat (PR #78286)
Yi Wu via libc-commits
libc-commits at lists.llvm.org
Tue Jan 23 09:04:09 PST 2024
https://github.com/yi-wu-arm updated https://github.com/llvm/llvm-project/pull/78286
>From d56eca56c8e4c64e649febc43e2c48b6e5146680 Mon Sep 17 00:00:00 2001
From: Yi Wu <yi.wu2 at arm.com>
Date: Tue, 16 Jan 2024 14:08:00 +0000
Subject: [PATCH 1/8] change exitstat and cmsstat from AnyInt to DefaultInt
---
flang/lib/Evaluate/intrinsics.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/flang/lib/Evaluate/intrinsics.cpp b/flang/lib/Evaluate/intrinsics.cpp
index da6d5970089884..0b9bdac88a78dc 100644
--- a/flang/lib/Evaluate/intrinsics.cpp
+++ b/flang/lib/Evaluate/intrinsics.cpp
@@ -1314,9 +1314,9 @@ static const IntrinsicInterface intrinsicSubroutine[]{
{"execute_command_line",
{{"command", DefaultChar, Rank::scalar},
{"wait", AnyLogical, Rank::scalar, Optionality::optional},
- {"exitstat", AnyInt, Rank::scalar, Optionality::optional,
+ {"exitstat", DefaultInt, Rank::scalar, Optionality::optional,
common::Intent::InOut},
- {"cmdstat", AnyInt, Rank::scalar, Optionality::optional,
+ {"cmdstat", DefaultInt, Rank::scalar, Optionality::optional,
common::Intent::Out},
{"cmdmsg", DefaultChar, Rank::scalar, Optionality::optional,
common::Intent::InOut}},
>From 2741652cae00ca1a94ae7a3310af1f25308e8105 Mon Sep 17 00:00:00 2001
From: Yi Wu <yi.wu2 at arm.com>
Date: Tue, 16 Jan 2024 16:54:42 +0000
Subject: [PATCH 2/8] add KindCode::greaterEqualToKind
Now execute_command_line will accept exitstat kind>=4, cmdstat kind >=2
---
flang/lib/Evaluate/intrinsics.cpp | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/flang/lib/Evaluate/intrinsics.cpp b/flang/lib/Evaluate/intrinsics.cpp
index 0b9bdac88a78dc..947e31967bdf45 100644
--- a/flang/lib/Evaluate/intrinsics.cpp
+++ b/flang/lib/Evaluate/intrinsics.cpp
@@ -77,7 +77,7 @@ static constexpr CategorySet AnyType{IntrinsicType | DerivedType};
ENUM_CLASS(KindCode, none, defaultIntegerKind,
defaultRealKind, // is also the default COMPLEX kind
- doublePrecision, defaultCharKind, defaultLogicalKind,
+ doublePrecision, defaultCharKind, defaultLogicalKind, greaterAndEqualToKind,
any, // matches any kind value; each instance is independent
// match any kind, but all "same" kinds must be equal. For characters, also
// implies that lengths must be equal.
@@ -104,7 +104,8 @@ ENUM_CLASS(KindCode, none, defaultIntegerKind,
struct TypePattern {
CategorySet categorySet;
KindCode kindCode{KindCode::none};
- int exactKindValue{0}; // for KindCode::exactKind
+ int kindValue{
+ 0}; // for KindCode::exactKind and KindCode::greaterAndEqualToKind
llvm::raw_ostream &Dump(llvm::raw_ostream &) const;
};
@@ -1314,10 +1315,12 @@ static const IntrinsicInterface intrinsicSubroutine[]{
{"execute_command_line",
{{"command", DefaultChar, Rank::scalar},
{"wait", AnyLogical, Rank::scalar, Optionality::optional},
- {"exitstat", DefaultInt, Rank::scalar, Optionality::optional,
- common::Intent::InOut},
- {"cmdstat", DefaultInt, Rank::scalar, Optionality::optional,
- common::Intent::Out},
+ {"exitstat",
+ TypePattern{IntType, KindCode::greaterAndEqualToKind, 4},
+ Rank::scalar, Optionality::optional, common::Intent::InOut},
+ {"cmdstat",
+ TypePattern{IntType, KindCode::greaterAndEqualToKind, 2},
+ Rank::scalar, Optionality::optional, common::Intent::Out},
{"cmdmsg", DefaultChar, Rank::scalar, Optionality::optional,
common::Intent::InOut}},
{}, Rank::elemental, IntrinsicClass::impureSubroutine},
@@ -1834,7 +1837,10 @@ std::optional<SpecificCall> IntrinsicInterface::Match(
argOk = true;
break;
case KindCode::exactKind:
- argOk = type->kind() == d.typePattern.exactKindValue;
+ argOk = type->kind() == d.typePattern.kindValue;
+ break;
+ case KindCode::greaterAndEqualToKind:
+ argOk = type->kind() >= d.typePattern.kindValue;
break;
case KindCode::sameAtom:
if (!sameArg) {
@@ -2177,8 +2183,9 @@ std::optional<SpecificCall> IntrinsicInterface::Match(
resultType = DynamicType{
GetBuiltinDerivedType(builtinsScope, "__builtin_team_type")};
break;
+ case KindCode::greaterAndEqualToKind:
case KindCode::exactKind:
- resultType = DynamicType{*category, result.exactKindValue};
+ resultType = DynamicType{*category, result.kindValue};
break;
case KindCode::typeless:
case KindCode::any:
>From cea484080cba83ad32abb5622048b1864e4a49dc Mon Sep 17 00:00:00 2001
From: Yi Wu <yi.wu2 at arm.com>
Date: Tue, 16 Jan 2024 17:25:12 +0000
Subject: [PATCH 3/8] doc fixes
---
flang/docs/Intrinsics.md | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/flang/docs/Intrinsics.md b/flang/docs/Intrinsics.md
index 5ade2574032977..9811903ab8130a 100644
--- a/flang/docs/Intrinsics.md
+++ b/flang/docs/Intrinsics.md
@@ -852,13 +852,14 @@ used in constant expressions have currently no folding support at all.
- **Syntax:** `CALL EXECUTE_COMMAND_LINE(COMMAND [, WAIT, EXITSTAT, CMDSTAT, CMDMSG ])`
- **Arguments:**
- | Argument | Description |
- |-----------|--------------------------------------------------------------|
- | `COMMAND` | Shall be a default CHARACTER scalar. |
- | `WAIT` | (Optional) Shall be a default LOGICAL scalar. |
- | `EXITSTAT`| (Optional) Shall be an INTEGER of the default kind. |
- | `CMDSTAT` | (Optional) Shall be an INTEGER of the default kind. |
- | `CMDMSG` | (Optional) Shall be a CHARACTER scalar of the default kind. |
+| Argument | Description |
+|------------|-----------------------------------------------------------------------|
+| `COMMAND` | Shall be a default CHARACTER scalar. |
+| `WAIT` | (Optional) Shall be a default LOGICAL scalar. |
+| `EXITSTAT` | (Optional) Shall be an INTEGER with kind greater than or equal to 2. |
+| `CMDSTAT` | (Optional) Shall be an INTEGER with kindgreater than or equal to 2. |
+| `CMDMSG` | (Optional) Shall be a CHARACTER scalar of the default kind. |
+
#### Implementation Specifics
>From 0b049991dd04edac358c7e865537aed8ed7c307a Mon Sep 17 00:00:00 2001
From: Yi Wu <yi.wu2 at arm.com>
Date: Wed, 17 Jan 2024 10:41:04 +0000
Subject: [PATCH 4/8] add test and rename variable
---
flang/lib/Evaluate/intrinsics.cpp | 13 ++++-----
flang/test/Semantics/execute_command_line.f90 | 28 +++++++++++++++++++
2 files changed, 34 insertions(+), 7 deletions(-)
create mode 100644 flang/test/Semantics/execute_command_line.f90
diff --git a/flang/lib/Evaluate/intrinsics.cpp b/flang/lib/Evaluate/intrinsics.cpp
index 947e31967bdf45..b2c0fcaf8e1110 100644
--- a/flang/lib/Evaluate/intrinsics.cpp
+++ b/flang/lib/Evaluate/intrinsics.cpp
@@ -77,7 +77,7 @@ static constexpr CategorySet AnyType{IntrinsicType | DerivedType};
ENUM_CLASS(KindCode, none, defaultIntegerKind,
defaultRealKind, // is also the default COMPLEX kind
- doublePrecision, defaultCharKind, defaultLogicalKind, greaterAndEqualToKind,
+ doublePrecision, defaultCharKind, defaultLogicalKind, greaterOrEqualToKind,
any, // matches any kind value; each instance is independent
// match any kind, but all "same" kinds must be equal. For characters, also
// implies that lengths must be equal.
@@ -105,7 +105,7 @@ struct TypePattern {
CategorySet categorySet;
KindCode kindCode{KindCode::none};
int kindValue{
- 0}; // for KindCode::exactKind and KindCode::greaterAndEqualToKind
+ 0}; // for KindCode::exactKind and KindCode::greaterOrEqualToKind
llvm::raw_ostream &Dump(llvm::raw_ostream &) const;
};
@@ -1316,10 +1316,9 @@ static const IntrinsicInterface intrinsicSubroutine[]{
{{"command", DefaultChar, Rank::scalar},
{"wait", AnyLogical, Rank::scalar, Optionality::optional},
{"exitstat",
- TypePattern{IntType, KindCode::greaterAndEqualToKind, 4},
+ TypePattern{IntType, KindCode::greaterOrEqualToKind, 4},
Rank::scalar, Optionality::optional, common::Intent::InOut},
- {"cmdstat",
- TypePattern{IntType, KindCode::greaterAndEqualToKind, 2},
+ {"cmdstat", TypePattern{IntType, KindCode::greaterOrEqualToKind, 2},
Rank::scalar, Optionality::optional, common::Intent::Out},
{"cmdmsg", DefaultChar, Rank::scalar, Optionality::optional,
common::Intent::InOut}},
@@ -1839,7 +1838,7 @@ std::optional<SpecificCall> IntrinsicInterface::Match(
case KindCode::exactKind:
argOk = type->kind() == d.typePattern.kindValue;
break;
- case KindCode::greaterAndEqualToKind:
+ case KindCode::greaterOrEqualToKind:
argOk = type->kind() >= d.typePattern.kindValue;
break;
case KindCode::sameAtom:
@@ -2183,7 +2182,7 @@ std::optional<SpecificCall> IntrinsicInterface::Match(
resultType = DynamicType{
GetBuiltinDerivedType(builtinsScope, "__builtin_team_type")};
break;
- case KindCode::greaterAndEqualToKind:
+ case KindCode::greaterOrEqualToKind:
case KindCode::exactKind:
resultType = DynamicType{*category, result.kindValue};
break;
diff --git a/flang/test/Semantics/execute_command_line.f90 b/flang/test/Semantics/execute_command_line.f90
new file mode 100644
index 00000000000000..f43b8ab60e9ce3
--- /dev/null
+++ b/flang/test/Semantics/execute_command_line.f90
@@ -0,0 +1,28 @@
+! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic
+! Tests for the EXECUTE_COMMAND_LINE intrinsics
+subroutine bad_kind(command, exitVal, cmdVal)
+CHARACTER(30) :: command
+INTEGER(KIND=2) :: exitVal
+INTEGER(KIND=1) :: cmdVal
+!ERROR: Actual argument for 'exitstat=' has bad type or kind 'INTEGER(2)'
+call execute_command_line(command, exitstat=exitVal)
+
+!ERROR: Actual argument for 'cmdstat=' has bad type or kind 'INTEGER(1)'
+call execute_command_line(command, cmdstat=cmdVal)
+end subroutine bad_kind
+
+subroutine good_kind_equal(command, exitVal, cmdVal)
+CHARACTER(30) :: command
+INTEGER(KIND=4) :: exitVal
+INTEGER(KIND=2) :: cmdVal
+call execute_command_line(command, exitstat=exitVal)
+call execute_command_line(command, cmdstat=cmdVal)
+end subroutine good_kind_equal
+
+subroutine good_kind_greater(command, exitVal, cmdVal)
+CHARACTER(30) :: command
+INTEGER(KIND=8) :: exitVal
+INTEGER(KIND=4) :: cmdVal
+call execute_command_line(command, exitstat=exitVal)
+call execute_command_line(command, cmdstat=cmdVal)
+end subroutine good_kind_greater
\ No newline at end of file
>From 450bc78b8db6f624dc617407b854407a3ff42cb4 Mon Sep 17 00:00:00 2001
From: Yi Wu <yi.wu2 at arm.com>
Date: Wed, 17 Jan 2024 10:45:36 +0000
Subject: [PATCH 5/8] doc and comment fixes
---
flang/docs/Intrinsics.md | 2 +-
flang/lib/Evaluate/intrinsics.cpp | 7 ++++---
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/flang/docs/Intrinsics.md b/flang/docs/Intrinsics.md
index 9811903ab8130a..2e5ffea1c12ebf 100644
--- a/flang/docs/Intrinsics.md
+++ b/flang/docs/Intrinsics.md
@@ -857,7 +857,7 @@ used in constant expressions have currently no folding support at all.
| `COMMAND` | Shall be a default CHARACTER scalar. |
| `WAIT` | (Optional) Shall be a default LOGICAL scalar. |
| `EXITSTAT` | (Optional) Shall be an INTEGER with kind greater than or equal to 2. |
-| `CMDSTAT` | (Optional) Shall be an INTEGER with kindgreater than or equal to 2. |
+| `CMDSTAT` | (Optional) Shall be an INTEGER with kind greater than or equal to 2. |
| `CMDMSG` | (Optional) Shall be a CHARACTER scalar of the default kind. |
diff --git a/flang/lib/Evaluate/intrinsics.cpp b/flang/lib/Evaluate/intrinsics.cpp
index b2c0fcaf8e1110..1701a475942ff5 100644
--- a/flang/lib/Evaluate/intrinsics.cpp
+++ b/flang/lib/Evaluate/intrinsics.cpp
@@ -77,7 +77,9 @@ static constexpr CategorySet AnyType{IntrinsicType | DerivedType};
ENUM_CLASS(KindCode, none, defaultIntegerKind,
defaultRealKind, // is also the default COMPLEX kind
- doublePrecision, defaultCharKind, defaultLogicalKind, greaterOrEqualToKind,
+ doublePrecision, defaultCharKind, defaultLogicalKind,
+ greaterOrEqualToKind, // match kind value greater than or equal to a single
+ // explicit kind value
any, // matches any kind value; each instance is independent
// match any kind, but all "same" kinds must be equal. For characters, also
// implies that lengths must be equal.
@@ -104,8 +106,7 @@ ENUM_CLASS(KindCode, none, defaultIntegerKind,
struct TypePattern {
CategorySet categorySet;
KindCode kindCode{KindCode::none};
- int kindValue{
- 0}; // for KindCode::exactKind and KindCode::greaterOrEqualToKind
+ int kindValue{0}; // for KindCode::exactKind and greaterOrEqualToKind
llvm::raw_ostream &Dump(llvm::raw_ostream &) const;
};
>From 98b3962d6fa62a0285c2eb7b410738abe96ab93f Mon Sep 17 00:00:00 2001
From: Yi Wu <yi.wu2 at arm.com>
Date: Wed, 17 Jan 2024 10:59:40 +0000
Subject: [PATCH 6/8] add a newline at end of the file
---
flang/test/Semantics/execute_command_line.f90 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/flang/test/Semantics/execute_command_line.f90 b/flang/test/Semantics/execute_command_line.f90
index f43b8ab60e9ce3..64c53bffc64628 100644
--- a/flang/test/Semantics/execute_command_line.f90
+++ b/flang/test/Semantics/execute_command_line.f90
@@ -25,4 +25,4 @@ subroutine good_kind_greater(command, exitVal, cmdVal)
INTEGER(KIND=4) :: cmdVal
call execute_command_line(command, exitstat=exitVal)
call execute_command_line(command, cmdstat=cmdVal)
-end subroutine good_kind_greater
\ No newline at end of file
+end subroutine good_kind_greater
>From 5ac4b760f1714ea4acc7476190caff0c7612ee1d Mon Sep 17 00:00:00 2001
From: Yi Wu <yi.wu2 at arm.com>
Date: Tue, 23 Jan 2024 10:30:45 +0000
Subject: [PATCH 7/8] format and doc fixes
---
flang/docs/Intrinsics.md | 3 +--
flang/test/Semantics/execute_command_line.f90 | 5 +++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/flang/docs/Intrinsics.md b/flang/docs/Intrinsics.md
index 2e5ffea1c12ebf..5ad6d01e8a8ed6 100644
--- a/flang/docs/Intrinsics.md
+++ b/flang/docs/Intrinsics.md
@@ -856,11 +856,10 @@ used in constant expressions have currently no folding support at all.
|------------|-----------------------------------------------------------------------|
| `COMMAND` | Shall be a default CHARACTER scalar. |
| `WAIT` | (Optional) Shall be a default LOGICAL scalar. |
-| `EXITSTAT` | (Optional) Shall be an INTEGER with kind greater than or equal to 2. |
+| `EXITSTAT` | (Optional) Shall be an INTEGER with kind greater than or equal to 4. |
| `CMDSTAT` | (Optional) Shall be an INTEGER with kind greater than or equal to 2. |
| `CMDMSG` | (Optional) Shall be a CHARACTER scalar of the default kind. |
-
#### Implementation Specifics
##### `COMMAND`:
diff --git a/flang/test/Semantics/execute_command_line.f90 b/flang/test/Semantics/execute_command_line.f90
index 64c53bffc64628..a66bbce705715d 100644
--- a/flang/test/Semantics/execute_command_line.f90
+++ b/flang/test/Semantics/execute_command_line.f90
@@ -1,6 +1,7 @@
! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic
! Tests for the EXECUTE_COMMAND_LINE intrinsics
-subroutine bad_kind(command, exitVal, cmdVal)
+
+subroutine bad_kind_error(command, exitVal, cmdVal)
CHARACTER(30) :: command
INTEGER(KIND=2) :: exitVal
INTEGER(KIND=1) :: cmdVal
@@ -9,7 +10,7 @@ subroutine bad_kind(command, exitVal, cmdVal)
!ERROR: Actual argument for 'cmdstat=' has bad type or kind 'INTEGER(1)'
call execute_command_line(command, cmdstat=cmdVal)
-end subroutine bad_kind
+end subroutine bad_kind_error
subroutine good_kind_equal(command, exitVal, cmdVal)
CHARACTER(30) :: command
>From 4d0d1c675935b9c16786b62955351e931401b4e5 Mon Sep 17 00:00:00 2001
From: Yi Wu <yi.wu2 at arm.com>
Date: Tue, 23 Jan 2024 16:40:12 +0000
Subject: [PATCH 8/8] add runtime kind code check for ExecuteCommandLine
---
flang/runtime/execute.cpp | 14 ++++++++-
flang/runtime/tools.cpp | 6 ++--
flang/runtime/tools.h | 3 +-
flang/unittests/Runtime/CommandTest.cpp | 38 +++++++++++++++++++++++++
4 files changed, 57 insertions(+), 4 deletions(-)
diff --git a/flang/runtime/execute.cpp b/flang/runtime/execute.cpp
index c84930c5c3287c..d7747fe71a4943 100644
--- a/flang/runtime/execute.cpp
+++ b/flang/runtime/execute.cpp
@@ -122,10 +122,22 @@ void RTNAME(ExecuteCommandLine)(const Descriptor &command, bool wait,
if (exitstat) {
RUNTIME_CHECK(terminator, IsValidIntDescriptor(exitstat));
+ auto exitstatKind{exitstat->type().GetCategoryAndKind()->second};
+ if (exitstatKind < 4) {
+ terminator.Crash("exitstat must have an integer kind greater or equal to "
+ "4 but have: %d",
+ exitstatKind);
+ }
}
if (cmdstat) {
- RUNTIME_CHECK(terminator, IsValidIntDescriptor(cmdstat));
+ RUNTIME_CHECK(terminator, IsValidIntDescriptor(cmdstat, 0));
+ auto cmdstatKind{cmdstat->type().GetCategoryAndKind()->second};
+ if (cmdstatKind < 2) {
+ terminator.Crash("cmdstat must have an integer kind greater or equal to "
+ "2 but have: %d",
+ cmdstatKind);
+ }
// Assigned 0 as specifed in standard, if error then overwrite
StoreIntToDescriptor(cmdstat, CMD_EXECUTED, terminator);
}
diff --git a/flang/runtime/tools.cpp b/flang/runtime/tools.cpp
index e653323ed1de03..c9274fefc91642 100644
--- a/flang/runtime/tools.cpp
+++ b/flang/runtime/tools.cpp
@@ -12,6 +12,7 @@
#include <cstdint>
#include <cstdlib>
#include <cstring>
+#include <stdio.h>
namespace Fortran::runtime {
@@ -191,12 +192,13 @@ RT_API_ATTRS bool IsValidCharDescriptor(const Descriptor *value) {
value->rank() == 0;
}
-RT_API_ATTRS bool IsValidIntDescriptor(const Descriptor *intVal) {
+RT_API_ATTRS bool IsValidIntDescriptor(
+ const Descriptor *intVal, const int minIntKind) {
// Check that our descriptor is allocated and is a scalar integer with
// kind != 1 (i.e. with a large enough decimal exponent range).
return intVal && intVal->IsAllocated() && intVal->rank() == 0 &&
intVal->type().IsInteger() && intVal->type().GetCategoryAndKind() &&
- intVal->type().GetCategoryAndKind()->second != 1;
+ intVal->type().GetCategoryAndKind()->second > minIntKind;
}
RT_API_ATTRS std::int32_t CopyCharsToDescriptor(const Descriptor &value,
diff --git a/flang/runtime/tools.h b/flang/runtime/tools.h
index 89e5069995748b..8d486658f3e48c 100644
--- a/flang/runtime/tools.h
+++ b/flang/runtime/tools.h
@@ -446,7 +446,8 @@ RT_API_ATTRS char *EnsureNullTerminated(
RT_API_ATTRS bool IsValidCharDescriptor(const Descriptor *value);
-RT_API_ATTRS bool IsValidIntDescriptor(const Descriptor *intVal);
+RT_API_ATTRS bool IsValidIntDescriptor(
+ const Descriptor *intVal, const int minIntKind = 1);
// Copy a null-terminated character array \p rawValue to descriptor \p value.
// The copy starts at the given \p offset, if not present then start at 0.
diff --git a/flang/unittests/Runtime/CommandTest.cpp b/flang/unittests/Runtime/CommandTest.cpp
index b2f6fe6177ed57..89402873b5a70f 100644
--- a/flang/unittests/Runtime/CommandTest.cpp
+++ b/flang/unittests/Runtime/CommandTest.cpp
@@ -422,6 +422,44 @@ TEST_F(ZeroArguments, ECLInvalidCommandAsyncDontAffectAsync) {
*command.get(), false, nullptr, nullptr, nullptr));
}
+TEST_F(ZeroArguments, ECLBadKindError) {
+ OwningPtr<Descriptor> command{CharDescriptor("echo hi")};
+ bool wait{true};
+ OwningPtr<Descriptor> exitStat{EmptyIntDescriptor<sizeof(std::int16_t)>()};
+ OwningPtr<Descriptor> cmdStat{EmptyIntDescriptor<sizeof(std::int8_t)>()};
+
+ EXPECT_DEATH(RTNAME(ExecuteCommandLine)(
+ *command.get(), wait, exitStat.get(), nullptr, nullptr),
+ "exitstat must have an integer kind greater or equal to 4 but have: 2");
+ EXPECT_DEATH(RTNAME(ExecuteCommandLine)(
+ *command.get(), wait, nullptr, cmdStat.get(), nullptr),
+ "cmdstat must have an integer kind greater or equal to 2 but have: 1");
+}
+
+TEST_F(ZeroArguments, ECLGoodKindEqual) {
+ OwningPtr<Descriptor> command{CharDescriptor("echo hi")};
+ bool wait{true};
+ OwningPtr<Descriptor> exitStat{EmptyIntDescriptor<sizeof(std::int32_t)>()};
+ OwningPtr<Descriptor> cmdStat{EmptyIntDescriptor<sizeof(std::int16_t)>()};
+
+ EXPECT_NO_FATAL_FAILURE(RTNAME(ExecuteCommandLine)(
+ *command.get(), wait, exitStat.get(), nullptr, nullptr));
+ EXPECT_NO_FATAL_FAILURE(RTNAME(ExecuteCommandLine)(
+ *command.get(), wait, nullptr, cmdStat.get(), nullptr));
+}
+
+TEST_F(ZeroArguments, ECLGoodKindGreater) {
+ OwningPtr<Descriptor> command{CharDescriptor("echo hi")};
+ bool wait{true};
+ OwningPtr<Descriptor> exitStat{EmptyIntDescriptor<sizeof(std::int64_t)>()};
+ OwningPtr<Descriptor> cmdStat{EmptyIntDescriptor<sizeof(std::int32_t)>()};
+
+ EXPECT_NO_FATAL_FAILURE(RTNAME(ExecuteCommandLine)(
+ *command.get(), wait, exitStat.get(), nullptr, nullptr));
+ EXPECT_NO_FATAL_FAILURE(RTNAME(ExecuteCommandLine)(
+ *command.get(), wait, nullptr, cmdStat.get(), nullptr));
+}
+
static const char *oneArgArgv[]{"aProgram", "anArgumentOfLength20"};
class OneArgument : public CommandFixture {
protected:
More information about the libc-commits
mailing list