forked from OSchip/llvm-project
[flang] Responses to pull request comments
I cleaned up some code and reverted a change to semantic checking for the exponent letter in REAL literals. Original-commit: flang-compiler/f18@e81f57fcf5 Reviewed-on: https://github.com/flang-compiler/f18/pull/1031
This commit is contained in:
parent
657aaf8b8d
commit
84b2909ded
|
@ -524,10 +524,12 @@ MaybeExpr ExpressionAnalyzer::Analyze(const parser::RealLiteralConstant &x) {
|
||||||
if (letterKind) {
|
if (letterKind) {
|
||||||
defaultKind = *letterKind;
|
defaultKind = *letterKind;
|
||||||
}
|
}
|
||||||
|
// C716 requires 'E' as an exponent, but this is more useful
|
||||||
auto kind{AnalyzeKindParam(x.kind, defaultKind)};
|
auto kind{AnalyzeKindParam(x.kind, defaultKind)};
|
||||||
if (x.kind && letterKind && expoLetter != 'e') { // C716
|
if (letterKind && kind != *letterKind && expoLetter != 'e') {
|
||||||
Say("Explicit kind parameter on REAL constant can only be used with"
|
Say("Explicit kind parameter on real constant disagrees with "
|
||||||
" exponent letter 'E'"_err_en_US);
|
"exponent letter '%c'"_en_US,
|
||||||
|
expoLetter);
|
||||||
}
|
}
|
||||||
auto result{common::SearchTypes(
|
auto result{common::SearchTypes(
|
||||||
RealTypeVisitor{kind, x.real.source, GetFoldingContext()})};
|
RealTypeVisitor{kind, x.real.source, GetFoldingContext()})};
|
||||||
|
|
|
@ -3277,7 +3277,8 @@ void DeclarationVisitor::Post(const parser::CharSelector::LengthAndKind &x) {
|
||||||
!evaluate::IsValidKindOfIntrinsicType(
|
!evaluate::IsValidKindOfIntrinsicType(
|
||||||
TypeCategory::Character, *intKind)) { // C715, C719
|
TypeCategory::Character, *intKind)) { // C715, C719
|
||||||
Say(currStmtSource().value(),
|
Say(currStmtSource().value(),
|
||||||
"KIND value (%jd) not valid for CHARACTER"_err_en_US, *intKind);
|
"KIND value (%jd) not valid for CHARACTER"_err_en_US,
|
||||||
|
static_cast<std::intmax_t>(*intKind));
|
||||||
}
|
}
|
||||||
if (x.length) {
|
if (x.length) {
|
||||||
charInfo_.length = GetParamValue(*x.length, common::TypeParamAttr::Len);
|
charInfo_.length = GetParamValue(*x.length, common::TypeParamAttr::Len);
|
||||||
|
|
|
@ -198,10 +198,7 @@ bool IsDummy(const Symbol &symbol) {
|
||||||
|
|
||||||
bool IsStmtFunction(const Symbol &symbol) {
|
bool IsStmtFunction(const Symbol &symbol) {
|
||||||
const auto *subprogram{symbol.detailsIf<SubprogramDetails>()};
|
const auto *subprogram{symbol.detailsIf<SubprogramDetails>()};
|
||||||
if (subprogram && subprogram->stmtFunction()) {
|
return subprogram && subprogram->stmtFunction();
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsInStmtFunction(const Symbol &symbol) {
|
bool IsInStmtFunction(const Symbol &symbol) {
|
||||||
|
|
|
@ -6,9 +6,7 @@ subroutine s(var)
|
||||||
real :: realvar1 = 4.0E6_4
|
real :: realvar1 = 4.0E6_4
|
||||||
real :: realvar2 = 4.0D6
|
real :: realvar2 = 4.0D6
|
||||||
real :: realvar3 = 4.0Q6
|
real :: realvar3 = 4.0Q6
|
||||||
!ERROR: Explicit kind parameter on REAL constant can only be used with exponent letter 'E'
|
|
||||||
real :: realvar4 = 4.0D6_8
|
real :: realvar4 = 4.0D6_8
|
||||||
!ERROR: Explicit kind parameter on REAL constant can only be used with exponent letter 'E'
|
|
||||||
real :: realvar5 = 4.0Q6_16
|
real :: realvar5 = 4.0Q6_16
|
||||||
real :: realvar6 = 4.0E6_8
|
real :: realvar6 = 4.0E6_8
|
||||||
real :: realvar7 = 4.0E6_10
|
real :: realvar7 = 4.0E6_10
|
||||||
|
@ -19,9 +17,7 @@ subroutine s(var)
|
||||||
double precision :: doublevar1 = 4.0E6_4
|
double precision :: doublevar1 = 4.0E6_4
|
||||||
double precision :: doublevar2 = 4.0D6
|
double precision :: doublevar2 = 4.0D6
|
||||||
double precision :: doublevar3 = 4.0Q6
|
double precision :: doublevar3 = 4.0Q6
|
||||||
!ERROR: Explicit kind parameter on REAL constant can only be used with exponent letter 'E'
|
|
||||||
double precision :: doublevar4 = 4.0D6_8
|
double precision :: doublevar4 = 4.0D6_8
|
||||||
!ERROR: Explicit kind parameter on REAL constant can only be used with exponent letter 'E'
|
|
||||||
double precision :: doublevar5 = 4.0Q6_16
|
double precision :: doublevar5 = 4.0Q6_16
|
||||||
double precision :: doublevar6 = 4.0E6_8
|
double precision :: doublevar6 = 4.0E6_8
|
||||||
double precision :: doublevar7 = 4.0E6_10
|
double precision :: doublevar7 = 4.0E6_10
|
||||||
|
|
Loading…
Reference in New Issue