Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion flang/lib/Evaluate/fold-integer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,7 @@ Expr<Type<TypeCategory::Integer, KIND>> FoldIntrinsicFunction(
} else {
DIE("first argument must be CHARACTER");
}
} else if (name == "int") {
} else if (name == "int" || name == "int2" || name == "int8") {
if (auto *expr{UnwrapExpr<Expr<SomeType>>(args[0])}) {
return common::visit(
[&](auto &&x) -> Expr<T> {
Expand Down
10 changes: 4 additions & 6 deletions flang/lib/Evaluate/intrinsics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,10 @@ static const IntrinsicInterface genericIntrinsicFunction[]{
DefaultingKIND},
KINDInt},
{"int", {{"a", AnyNumeric, Rank::elementalOrBOZ}, DefaultingKIND}, KINDInt},
{"int2", {{"a", AnyNumeric, Rank::elementalOrBOZ}},
TypePattern{IntType, KindCode::exactKind, 2}},
{"int8", {{"a", AnyNumeric, Rank::elementalOrBOZ}},
TypePattern{IntType, KindCode::exactKind, 8}},
{"int_ptr_kind", {}, DefaultInt, Rank::scalar},
{"ior", {{"i", OperandInt}, {"j", OperandInt, Rank::elementalOrBOZ}},
OperandInt},
Expand Down Expand Up @@ -1176,12 +1180,6 @@ static const SpecificIntrinsicInterface specificIntrinsicFunction[]{
// procedure pointer target.
{{"index", {{"string", DefaultChar}, {"substring", DefaultChar}},
DefaultInt}},
{{"int2", {{"a", AnyNumeric, Rank::elementalOrBOZ}},
TypePattern{IntType, KindCode::exactKind, 2}},
"int"},
{{"int8", {{"a", AnyNumeric, Rank::elementalOrBOZ}},
TypePattern{IntType, KindCode::exactKind, 8}},
"int"},
{{"isign", {{"a", DefaultInt}, {"b", DefaultInt}}, DefaultInt}, "sign"},
{{"jiabs", {{"a", TypePattern{IntType, KindCode::exactKind, 4}}},
TypePattern{IntType, KindCode::exactKind, 4}},
Expand Down
6 changes: 4 additions & 2 deletions flang/test/Evaluate/int8.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
! RUN: %flang_fc1 -fdebug-unparse %s 2>&1 | FileCheck %s
!RUN: not %flang_fc1 -fsyntax-only %s 2>&1 | FileCheck %s
!CHECK: warning: REAL(4) to INTEGER(2) conversion overflowed
!CHECK: PRINT *, 32767_2, 4000000000_8
print *, int2(4.e9), int8(4.e9)
!CHECK: error: 'int2' is not an unrestricted specific intrinsic procedure
!CHECK: error: 'int8' is not an unrestricted specific intrinsic procedure
call foo(int2,int8)
end
Loading