forked from OSchip/llvm-project
[flang] EQUIVALENCE numeric/character as extension with warning
Original-commit: flang-compiler/f18@0182efb759 Reviewed-on: https://github.com/flang-compiler/f18/pull/508 Tree-same-pre-rewrite: false
This commit is contained in:
parent
40b1cc9b62
commit
9a9b450011
|
@ -69,6 +69,7 @@ Extensions, deletions, and legacy features supported by default
|
|||
* BOZ literals can be used as INTEGER values in contexts where the type is
|
||||
unambiguous (including the right hand sides of assigments and initializations
|
||||
of INTEGER entities).
|
||||
* EQUIVALENCE of numeric and character sequences (a ubiquitous extension)
|
||||
|
||||
Extensions supported when enabled by options
|
||||
--------------------------------------------
|
||||
|
|
|
@ -31,7 +31,7 @@ ENUM_CLASS(LanguageFeature, BackslashEscapes, OldDebugLines,
|
|||
ProgramParentheses, PercentRefAndVal, OmitFunctionDummies, CrayPointer,
|
||||
Hollerith, ArithmeticIF, Assign, AssignedGOTO, Pause, OpenMP,
|
||||
CruftAfterAmpersand, ClassicCComments, AdditionalFormats, BigIntLiterals,
|
||||
RealDoControls)
|
||||
RealDoControls, EquivalenceNumericWithCharacter)
|
||||
|
||||
using LanguageFeatures =
|
||||
common::EnumSet<LanguageFeature, LanguageFeature_enumSize>;
|
||||
|
|
|
@ -364,12 +364,24 @@ bool EquivalenceSets::CheckCanEquivalence(
|
|||
msg = "Equivalence set cannot contain '%s'"
|
||||
" with PROTECTED attribute and '%s' without"_err_en_US;
|
||||
} else if (isNum1) {
|
||||
if (!isNum2) { // C8110
|
||||
if (isChar2) {
|
||||
if (context_.ShouldWarn(
|
||||
parser::LanguageFeature::EquivalenceNumericWithCharacter)) {
|
||||
msg = "Equivalence set contains '%s' that is numeric sequence "
|
||||
"type and '%s' that is character"_en_US;
|
||||
}
|
||||
} else if (!isNum2) { // C8110
|
||||
msg = "Equivalence set cannot contain '%s'"
|
||||
" that is numeric sequence type and '%s' that is not"_err_en_US;
|
||||
}
|
||||
} else if (isChar1) {
|
||||
if (!isChar2) { // C8111
|
||||
if (isNum2) {
|
||||
if (context_.ShouldWarn(
|
||||
parser::LanguageFeature::EquivalenceNumericWithCharacter)) {
|
||||
msg = "Equivalence set contains '%s' that is character sequence "
|
||||
"type and '%s' that is numeric"_en_US;
|
||||
}
|
||||
} else if (!isChar2) { // C8111
|
||||
msg = "Equivalence set cannot contain '%s'"
|
||||
" that is character sequence type and '%s' that is not"_err_en_US;
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
PATH=/usr/bin:/bin
|
||||
srcdir=$(dirname $0)
|
||||
CMD="${F18:-../../../tools/f18/f18} -fdebug-resolve-names -fparse-only"
|
||||
CMD="${F18:-../../../tools/f18/f18} -fdebug-resolve-names -fparse-only -Mstandard"
|
||||
|
||||
if [[ $# != 1 ]]; then
|
||||
echo "Usage: $0 <fortran-source>"
|
||||
|
|
Loading…
Reference in New Issue