mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-29 05:01:11 +00:00
[flang] Make Fortran form of intrinsic types uppercase
`DynamicType::AsFortran` was using mixed case for intrinic type names. Make it upper case for consistency with TYPE(...) and CHARACTER when a length is present and other error messages. Original-commit: flang-compiler/f18@e16909d67f Reviewed-on: https://github.com/flang-compiler/f18/pull/928 Tree-same-pre-rewrite: false
This commit is contained in:
parent
c42a22091f
commit
355ab9bb82
@ -471,7 +471,8 @@ std::string DynamicType::AsFortran() const {
|
||||
} else if (IsTypelessIntrinsicArgument()) {
|
||||
return "(typeless intrinsic function argument)";
|
||||
} else {
|
||||
return EnumToString(category_) + '(' + std::to_string(kind_) + ')';
|
||||
return parser::ToUpperCaseLetters(EnumToString(category_)) + '(' +
|
||||
std::to_string(kind_) + ')';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ template<typename A> std::string AsFortran(const A &x) {
|
||||
|
||||
int main() {
|
||||
using DefaultIntegerExpr = Expr<Type<TypeCategory::Integer, 4>>;
|
||||
TEST(DefaultIntegerExpr::Result::AsFortran() == "Integer(4)");
|
||||
TEST(DefaultIntegerExpr::Result::AsFortran() == "INTEGER(4)");
|
||||
MATCH("666_4", AsFortran(DefaultIntegerExpr{666}));
|
||||
MATCH("-1_4", AsFortran(-DefaultIntegerExpr{1}));
|
||||
auto ex1{
|
||||
|
@ -15,12 +15,12 @@ end module m
|
||||
!Expect: m.mod
|
||||
!module m
|
||||
!real(4),parameter::a0=1._4
|
||||
!real(4),parameter::a1(1_8:2_8)=[Real(4)::2._4,3._4]
|
||||
!real(4),parameter::a2(1_8:2_8)=[Real(4)::4._4,5._4]
|
||||
!real(4),parameter::a3(1_8:0_8)=[Real(4)::]
|
||||
!real(4),parameter::a4(1_8:55_8)=[Real(4)::1._4,1._4,2._4,1._4,2._4,3._4,1._4,2._4,3._4,4._4,1._4,2._4,3._4,4._4,5._4,1._4,2._4,3._4,4._4,5._4,6._4,1._4,2._4,3._4,4._4,5._4,6._4,7._4,1._4,2._4,3._4,4._4,5._4,6._4,7._4,8._4,1._4,2._4,3._4,4._4,5._4,6._4,7._4,8._4,9._4,1._4,2._4,3._4,4._4,5._4,6._4,7._4,8._4,9._4,1.e1_4]
|
||||
!real(4),parameter::a5(1_8:*)=[Real(4)::6._4,7._4,8._4]
|
||||
!real(4),parameter::a6(1_8:2_8)=[Real(4)::9._4,1.e1_4]
|
||||
!real(4),parameter::a7(1_8:6_8)=[Real(4)::1._4,1._4,2._4,1._4,2._4,3._4]
|
||||
!real(4),parameter::a8(1_8:13_8)=[Real(4)::1._4,2._4,3._4,4._4,5._4,6._4,7._4,8._4,9._4,1.e1_4,1.1e1_4,1.2e1_4,1.3e1_4]
|
||||
!real(4),parameter::a1(1_8:2_8)=[REAL(4)::2._4,3._4]
|
||||
!real(4),parameter::a2(1_8:2_8)=[REAL(4)::4._4,5._4]
|
||||
!real(4),parameter::a3(1_8:0_8)=[REAL(4)::]
|
||||
!real(4),parameter::a4(1_8:55_8)=[REAL(4)::1._4,1._4,2._4,1._4,2._4,3._4,1._4,2._4,3._4,4._4,1._4,2._4,3._4,4._4,5._4,1._4,2._4,3._4,4._4,5._4,6._4,1._4,2._4,3._4,4._4,5._4,6._4,7._4,1._4,2._4,3._4,4._4,5._4,6._4,7._4,8._4,1._4,2._4,3._4,4._4,5._4,6._4,7._4,8._4,9._4,1._4,2._4,3._4,4._4,5._4,6._4,7._4,8._4,9._4,1.e1_4]
|
||||
!real(4),parameter::a5(1_8:*)=[REAL(4)::6._4,7._4,8._4]
|
||||
!real(4),parameter::a6(1_8:2_8)=[REAL(4)::9._4,1.e1_4]
|
||||
!real(4),parameter::a7(1_8:6_8)=[REAL(4)::1._4,1._4,2._4,1._4,2._4,3._4]
|
||||
!real(4),parameter::a8(1_8:13_8)=[REAL(4)::1._4,2._4,3._4,4._4,5._4,6._4,7._4,8._4,9._4,1.e1_4,1.1e1_4,1.2e1_4,1.3e1_4]
|
||||
!end
|
||||
|
@ -27,22 +27,22 @@ module m1
|
||||
end module m1
|
||||
!Expect: m1.mod
|
||||
! module m1
|
||||
! integer(8),parameter::a0s(1_8:*)=[Integer(8)::]
|
||||
! integer(8),parameter::a0s(1_8:*)=[INTEGER(8)::]
|
||||
! intrinsic::shape
|
||||
! real(4)::a1(1_8:5_8,1_8:5_8,1_8:5_8)
|
||||
! integer(8),parameter::a1s(1_8:*)=[Integer(8)::5_8,5_8,5_8]
|
||||
! integer(8),parameter::a1ss(1_8:*)=[Integer(8)::3_8]
|
||||
! integer(8),parameter::a1sss(1_8:*)=[Integer(8)::1_8]
|
||||
! integer(8),parameter::a1rs(1_8:*)=[Integer(8)::3_8,1_8,1_8,1_8]
|
||||
! integer(8),parameter::a1n(1_8:*)=[Integer(8)::125_8,5_8,5_8]
|
||||
! integer(8),parameter::a1sn(1_8:*)=[Integer(8)::3_8,1_8,1_8]
|
||||
! integer(8),parameter::ac1s(1_8:*)=[Integer(8)::1_8]
|
||||
! integer(8),parameter::ac2s(1_8:*)=[Integer(8)::3_8]
|
||||
! integer(8),parameter::ac3s(1_8:*)=[Integer(8)::4_8]
|
||||
! integer(8),parameter::ac3bs(1_8:*)=[Integer(8)::4_8]
|
||||
! integer(8),parameter::ac4s(1_8:*)=[Integer(8)::36_8]
|
||||
! integer(8),parameter::ac5s(1_8:*)=[Integer(8)::9_8]
|
||||
! integer(8),parameter::rss(1_8:*)=[Integer(8)::10_8,9_8]
|
||||
! integer(8),parameter::a1s(1_8:*)=[INTEGER(8)::5_8,5_8,5_8]
|
||||
! integer(8),parameter::a1ss(1_8:*)=[INTEGER(8)::3_8]
|
||||
! integer(8),parameter::a1sss(1_8:*)=[INTEGER(8)::1_8]
|
||||
! integer(8),parameter::a1rs(1_8:*)=[INTEGER(8)::3_8,1_8,1_8,1_8]
|
||||
! integer(8),parameter::a1n(1_8:*)=[INTEGER(8)::125_8,5_8,5_8]
|
||||
! integer(8),parameter::a1sn(1_8:*)=[INTEGER(8)::3_8,1_8,1_8]
|
||||
! integer(8),parameter::ac1s(1_8:*)=[INTEGER(8)::1_8]
|
||||
! integer(8),parameter::ac2s(1_8:*)=[INTEGER(8)::3_8]
|
||||
! integer(8),parameter::ac3s(1_8:*)=[INTEGER(8)::4_8]
|
||||
! integer(8),parameter::ac3bs(1_8:*)=[INTEGER(8)::4_8]
|
||||
! integer(8),parameter::ac4s(1_8:*)=[INTEGER(8)::36_8]
|
||||
! integer(8),parameter::ac5s(1_8:*)=[INTEGER(8)::9_8]
|
||||
! integer(8),parameter::rss(1_8:*)=[INTEGER(8)::10_8,9_8]
|
||||
! intrinsic::reshape
|
||||
! contains
|
||||
! subroutine subr(x,n1,n2)
|
||||
|
@ -63,25 +63,25 @@ module m1
|
||||
end module m1
|
||||
!Expect: m1.mod
|
||||
!module m1
|
||||
!integer(4),parameter::iranges(1_8:*)=[Integer(4)::2_4,4_4,9_4,18_4,38_4]
|
||||
!integer(4),parameter::iranges(1_8:*)=[INTEGER(4)::2_4,4_4,9_4,18_4,38_4]
|
||||
!logical(4),parameter::ircheck=.true._4
|
||||
!intrinsic::all
|
||||
!integer(4),parameter::intpvals(1_8:*)=[Integer(4)::0_4,2_4,3_4,4_4,5_4,9_4,10_4,18_4,19_4,38_4,39_4]
|
||||
!integer(4),parameter::intpkinds(1_8:*)=[Integer(4)::1_4,1_4,2_4,2_4,4_4,4_4,8_4,8_4,16_4,16_4,-1_4]
|
||||
!integer(4),parameter::intpvals(1_8:*)=[INTEGER(4)::0_4,2_4,3_4,4_4,5_4,9_4,10_4,18_4,19_4,38_4,39_4]
|
||||
!integer(4),parameter::intpkinds(1_8:*)=[INTEGER(4)::1_4,1_4,2_4,2_4,4_4,4_4,8_4,8_4,16_4,16_4,-1_4]
|
||||
!logical(4),parameter::ipcheck=.true._4
|
||||
!integer(4),parameter::realprecs(1_8:*)=[Integer(4)::3_4,2_4,6_4,15_4,18_4,33_4]
|
||||
!integer(4),parameter::realprecs(1_8:*)=[INTEGER(4)::3_4,2_4,6_4,15_4,18_4,33_4]
|
||||
!logical(4),parameter::rpreccheck=.true._4
|
||||
!integer(4),parameter::realpvals(1_8:*)=[Integer(4)::0_4,3_4,4_4,6_4,7_4,15_4,16_4,18_4,19_4,33_4,34_4]
|
||||
!integer(4),parameter::realpkinds(1_8:*)=[Integer(4)::2_4,2_4,4_4,4_4,8_4,8_4,10_4,10_4,16_4,16_4,-1_4]
|
||||
!integer(4),parameter::realpvals(1_8:*)=[INTEGER(4)::0_4,3_4,4_4,6_4,7_4,15_4,16_4,18_4,19_4,33_4,34_4]
|
||||
!integer(4),parameter::realpkinds(1_8:*)=[INTEGER(4)::2_4,2_4,4_4,4_4,8_4,8_4,10_4,10_4,16_4,16_4,-1_4]
|
||||
!logical(4),parameter::realpcheck=.true._4
|
||||
!integer(4),parameter::realranges(1_8:*)=[Integer(4)::4_4,37_4,37_4,307_4,4931_4,9863_4]
|
||||
!integer(4),parameter::realranges(1_8:*)=[INTEGER(4)::4_4,37_4,37_4,307_4,4931_4,9863_4]
|
||||
!logical(4),parameter::rrangecheck=.true._4
|
||||
!integer(4),parameter::realrvals(1_8:*)=[Integer(4)::0_4,4_4,5_4,37_4,38_4,307_4,308_4,4931_4,4932_4,9863_4,9864_4]
|
||||
!integer(4),parameter::realrkinds(1_8:*)=[Integer(4)::2_4,2_4,3_4,3_4,8_4,8_4,10_4,10_4,16_4,16_4,-2_4]
|
||||
!integer(4),parameter::realrvals(1_8:*)=[INTEGER(4)::0_4,4_4,5_4,37_4,38_4,307_4,308_4,4931_4,4932_4,9863_4,9864_4]
|
||||
!integer(4),parameter::realrkinds(1_8:*)=[INTEGER(4)::2_4,2_4,3_4,3_4,8_4,8_4,10_4,10_4,16_4,16_4,-2_4]
|
||||
!logical(4),parameter::realrcheck=.true._4
|
||||
!logical(4),parameter::radixcheck=.true._4
|
||||
!integer(4),parameter::intdigits(1_8:*)=[Integer(4)::7_4,15_4,31_4,63_4,127_4]
|
||||
!integer(4),parameter::intdigits(1_8:*)=[INTEGER(4)::7_4,15_4,31_4,63_4,127_4]
|
||||
!logical(4),parameter::intdigitscheck=.true._4
|
||||
!integer(4),parameter::realdigits(1_8:*)=[Integer(4)::11_4,8_4,24_4,53_4,64_4,112_4]
|
||||
!integer(4),parameter::realdigits(1_8:*)=[INTEGER(4)::11_4,8_4,24_4,53_4,64_4,112_4]
|
||||
!logical(4),parameter::realdigitscheck=.true._4
|
||||
!end
|
||||
|
@ -28,7 +28,7 @@ end module m1
|
||||
!type::t1
|
||||
!integer(4)::ia1(1_8:2_8)
|
||||
!end type
|
||||
!type(t1),parameter::t1x1(1_8:*)=[t1::t1(ia1=[Integer(4)::1_4,2_4]),t1(ia1=[Integer(4)::3_4,4_4])]
|
||||
!type(t1),parameter::t1x1(1_8:*)=[t1::t1(ia1=[INTEGER(4)::1_4,2_4]),t1(ia1=[INTEGER(4)::3_4,4_4])]
|
||||
!logical(4),parameter::t1check1=.true._4
|
||||
!logical(4),parameter::t1check2=.true._4
|
||||
!intrinsic::all
|
||||
@ -36,7 +36,7 @@ end module m1
|
||||
!type::t2
|
||||
!type(t1)::dta1(1_8:2_8)
|
||||
!end type
|
||||
!type(t2),parameter::t2x1(1_8:*)=[t2::t2(dta1=[t1::t1(ia1=[Integer(4)::1_4,2_4]),t1(ia1=[Integer(4)::3_4,4_4])]),t2(dta1=[t1::t1(ia1=[Integer(4)::5_4,6_4]),t1(ia1=[Integer(4)::7_4,8_4])])]
|
||||
!type(t2),parameter::t2x1(1_8:*)=[t2::t2(dta1=[t1::t1(ia1=[INTEGER(4)::1_4,2_4]),t1(ia1=[INTEGER(4)::3_4,4_4])]),t2(dta1=[t1::t1(ia1=[INTEGER(4)::5_4,6_4]),t1(ia1=[INTEGER(4)::7_4,8_4])])]
|
||||
!logical(4),parameter::t2check1=.true._4
|
||||
!logical(4),parameter::t2check2=.true._4
|
||||
!logical(4),parameter::t2check3=.true._4
|
||||
|
@ -18,7 +18,7 @@ end
|
||||
|
||||
!Expect: m1.mod
|
||||
!module m1
|
||||
!integer(4),parameter::x(1_8:1_8)=[Integer(4)::4_4]
|
||||
!integer(4),parameter::x(1_8:1_8)=[INTEGER(4)::4_4]
|
||||
!integer(4),parameter::red=0_4
|
||||
!integer(4),parameter::green=1_4
|
||||
!integer(4),parameter::blue=2_4
|
||||
|
@ -60,10 +60,10 @@ subroutine test
|
||||
dt0x = dt0(ip0=null())
|
||||
dt0x = dt0(ip0=null(ip0))
|
||||
dt0x = dt0(ip0=null(mold=ip0))
|
||||
!ERROR: TARGET type 'Real(4)' is not compatible with POINTER type 'Integer(4)'
|
||||
!ERROR: TARGET type 'REAL(4)' is not compatible with POINTER type 'INTEGER(4)'
|
||||
!ERROR: pointer 'ip0' is associated with the result of a reference to function 'null' whose pointer result has an incompatible type or shape
|
||||
dt0x = dt0(ip0=null(mold=rp0))
|
||||
!ERROR: TARGET type 'Real(4)' is not compatible with POINTER type 'Integer(4)'
|
||||
!ERROR: TARGET type 'REAL(4)' is not compatible with POINTER type 'INTEGER(4)'
|
||||
!ERROR: pointer 'ip1' is associated with the result of a reference to function 'null' whose pointer result has an incompatible type or shape
|
||||
dt1x = dt1(ip1=null(mold=rp1))
|
||||
dt2x = dt2(pps0=null())
|
||||
|
@ -29,7 +29,7 @@
|
||||
end select
|
||||
select type(a)
|
||||
type is (integer)
|
||||
!ERROR: Actual argument for 'x=' has bad type 'Integer(4)'
|
||||
!ERROR: Actual argument for 'x=' has bad type 'INTEGER(4)'
|
||||
res = acos(a)
|
||||
end select
|
||||
|
||||
@ -41,12 +41,12 @@
|
||||
type is (real)
|
||||
res = acos(a)
|
||||
res = acos(y)
|
||||
!ERROR: Actual argument for 'x=' has bad type 'Integer(4)'
|
||||
!ERROR: Actual argument for 'x=' has bad type 'INTEGER(4)'
|
||||
res = acos(b)
|
||||
type is (integer)
|
||||
ires = selected_int_kind(b)
|
||||
zres = acos(z)
|
||||
!ERROR: Actual argument for 'x=' has bad type 'Integer(4)'
|
||||
!ERROR: Actual argument for 'x=' has bad type 'INTEGER(4)'
|
||||
res = acos(a)
|
||||
end select
|
||||
end associate
|
||||
|
@ -30,11 +30,11 @@ module module1
|
||||
! call scalararg(scalar(4)(5.,6,(7._8,8._2),4_'b',.true._4))
|
||||
call scalararg(scalar(4)(ix=5.,rx=6,zx=(7._8,8._2),cx=4_'b',lx=.true.))
|
||||
call scalararg(scalar(4)(5.,6,(7._8,8._2),4_'b',.true.))
|
||||
!ERROR: Value in structure constructor of type Character(1) is incompatible with component 'ix' of type Integer(4)
|
||||
!ERROR: Value in structure constructor of type CHARACTER(1) is incompatible with component 'ix' of type INTEGER(4)
|
||||
call scalararg(scalar(4)(ix='a'))
|
||||
!ERROR: Value in structure constructor of type Logical(4) is incompatible with component 'ix' of type Integer(4)
|
||||
!ERROR: Value in structure constructor of type LOGICAL(4) is incompatible with component 'ix' of type INTEGER(4)
|
||||
call scalararg(scalar(4)(ix=.false.))
|
||||
!ERROR: Value in structure constructor of type Integer(4) is incompatible with component 'ix' of type Integer(4)
|
||||
!ERROR: Value in structure constructor of type INTEGER(4) is incompatible with component 'ix' of type INTEGER(4)
|
||||
call scalararg(scalar(4)(ix=[1]))
|
||||
!TODO more!
|
||||
end subroutine errors
|
||||
|
Loading…
x
Reference in New Issue
Block a user