[flang][CLI] Have the CLI hint the flag to disable a warning (#144767)

Adds a hint to the warning message to disable a warning and updates the
tests to expect this.

Also fixes a bug in the storage of canonical spelling of error flags so
that they are not used after free.
This commit is contained in:
Andre Kuhlenschmidt 2025-06-30 10:17:05 -07:00 committed by GitHub
parent efc561c061
commit 83b462af17
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
162 changed files with 664 additions and 625 deletions

View File

@ -292,7 +292,8 @@ public:
std::optional<ProvenanceRange> GetProvenanceRange(
const AllCookedSources &) const;
void Emit(llvm::raw_ostream &, const AllCookedSources &,
bool echoSourceLine = true) const;
bool echoSourceLine = true,
const common::LanguageFeatureControl *hintFlags = nullptr) const;
// If this Message or any of its attachments locates itself via a CharBlock,
// replace its location with the corresponding ProvenanceRange.
@ -352,7 +353,8 @@ public:
void Copy(const Messages &);
void ResolveProvenances(const AllCookedSources &);
void Emit(llvm::raw_ostream &, const AllCookedSources &,
bool echoSourceLines = true) const;
bool echoSourceLines = true,
const common::LanguageFeatureControl *hintFlags = nullptr) const;
void AttachTo(Message &, std::optional<Severity> = std::nullopt);
bool AnyFatalError() const;

View File

@ -156,14 +156,13 @@ public:
private:
// Map from Cli syntax of language features and usage warnings to their enum
// values.
std::unordered_map<std::string, std::variant<LanguageFeature, UsageWarning>>
cliOptions_;
std::unordered_map<std::string, LanguageFeatureOrWarning> cliOptions_;
// These two arrays map the enum values to their cannonical Cli spellings.
// Since each of the CanonicalSpelling is a string in the domain of the map
// above we just use a view of the string instead of another copy.
std::array<std::string_view, LanguageFeature_enumSize>
std::array<std::string, LanguageFeature_enumSize>
languageFeatureCliCanonicalSpelling_;
std::array<std::string_view, UsageWarning_enumSize>
std::array<std::string, UsageWarning_enumSize>
usageWarningCliCanonicalSpelling_;
LanguageFeatures disable_;
LanguageFeatures warnLanguage_;

View File

@ -171,7 +171,10 @@ bool FrontendAction::runParse(bool emitMessages) {
if (emitMessages) {
// Report any non-fatal diagnostics from getParsing now rather than
// combining them with messages from semantics.
ci.getParsing().messages().Emit(llvm::errs(), ci.getAllCookedSources());
const common::LanguageFeatureControl &features{
ci.getInvocation().getFortranOpts().features};
ci.getParsing().messages().Emit(llvm::errs(), ci.getAllCookedSources(),
/*echoSourceLine=*/true, &features);
}
return true;
}
@ -223,6 +226,8 @@ bool FrontendAction::generateRtTypeTables() {
template <unsigned N>
bool FrontendAction::reportFatalErrors(const char (&message)[N]) {
const common::LanguageFeatureControl &features{
instance->getInvocation().getFortranOpts().features};
if (!instance->getParsing().messages().empty() &&
(instance->getInvocation().getWarnAsErr() ||
instance->getParsing().messages().AnyFatalError())) {
@ -230,7 +235,8 @@ bool FrontendAction::reportFatalErrors(const char (&message)[N]) {
clang::DiagnosticsEngine::Error, message);
instance->getDiagnostics().Report(diagID) << getCurrentFileOrBufferName();
instance->getParsing().messages().Emit(llvm::errs(),
instance->getAllCookedSources());
instance->getAllCookedSources(),
/*echoSourceLines=*/true, &features);
return true;
}
if (instance->getParsing().parseTree().has_value() &&
@ -240,7 +246,8 @@ bool FrontendAction::reportFatalErrors(const char (&message)[N]) {
clang::DiagnosticsEngine::Error, message);
instance->getDiagnostics().Report(diagID) << getCurrentFileOrBufferName();
instance->getParsing().messages().Emit(llvm::errs(),
instance->getAllCookedSources());
instance->getAllCookedSources(),
/*echoSourceLine=*/true, &features);
instance->getParsing().EmitMessage(
llvm::errs(), instance->getParsing().finalRestingPlace(),
"parser FAIL (final position)", "error: ", llvm::raw_ostream::RED);

View File

@ -273,14 +273,36 @@ static llvm::raw_ostream::Colors PrefixColor(Severity severity) {
return llvm::raw_ostream::SAVEDCOLOR;
}
static std::string HintLanguageControlFlag(
const common::LanguageFeatureControl *hintFlagPtr,
std::optional<common::LanguageFeature> feature,
std::optional<common::UsageWarning> warning) {
if (hintFlagPtr) {
std::string flag;
if (warning) {
flag = hintFlagPtr->getDefaultCliSpelling(*warning);
} else if (feature) {
flag = hintFlagPtr->getDefaultCliSpelling(*feature);
}
if (!flag.empty()) {
return " [-W" + flag + "]";
}
}
return "";
}
static constexpr int MAX_CONTEXTS_EMITTED{2};
static constexpr bool OMIT_SHARED_CONTEXTS{true};
void Message::Emit(llvm::raw_ostream &o, const AllCookedSources &allCooked,
bool echoSourceLine) const {
bool echoSourceLine,
const common::LanguageFeatureControl *hintFlagPtr) const {
std::optional<ProvenanceRange> provenanceRange{GetProvenanceRange(allCooked)};
const AllSources &sources{allCooked.allSources()};
sources.EmitMessage(o, provenanceRange, ToString(), Prefix(severity()),
const std::string text{ToString()};
const std::string hint{
HintLanguageControlFlag(hintFlagPtr, languageFeature_, usageWarning_)};
sources.EmitMessage(o, provenanceRange, text + hint, Prefix(severity()),
PrefixColor(severity()), echoSourceLine);
// Refers to whether the attachment in the loop below is a context, but can't
// be declared inside the loop because the previous iteration's
@ -430,7 +452,8 @@ void Messages::ResolveProvenances(const AllCookedSources &allCooked) {
}
void Messages::Emit(llvm::raw_ostream &o, const AllCookedSources &allCooked,
bool echoSourceLines) const {
bool echoSourceLines,
const common::LanguageFeatureControl *hintFlagPtr) const {
std::vector<const Message *> sorted;
for (const auto &msg : messages_) {
sorted.push_back(&msg);
@ -443,7 +466,7 @@ void Messages::Emit(llvm::raw_ostream &o, const AllCookedSources &allCooked,
// Don't emit two identical messages for the same location
continue;
}
msg->Emit(o, allCooked, echoSourceLines);
msg->Emit(o, allCooked, echoSourceLines, hintFlagPtr);
lastMsg = msg;
}
}

View File

@ -655,8 +655,10 @@ bool Semantics::Perform() {
void Semantics::EmitMessages(llvm::raw_ostream &os) {
// Resolve the CharBlock locations of the Messages to ProvenanceRanges
// so messages from parsing and semantics are intermixed in source order.
const common::LanguageFeatureControl &features{context_.languageFeatures()};
context_.messages().ResolveProvenances(context_.allCookedSources());
context_.messages().Emit(os, context_.allCookedSources());
context_.messages().Emit(
os, context_.allCookedSources(), /*echoSourceLine=*/true, &features);
}
void SemanticsContext::DumpSymbols(llvm::raw_ostream &os) {

View File

@ -59,7 +59,7 @@ LanguageFeatureControl::LanguageFeatureControl() {
std::string cliOption{details::CamelCaseToLowerCaseHyphenated(name)};
cliOptions_.insert({cliOption, {feature}});
languageFeatureCliCanonicalSpelling_[EnumToInt(feature)] =
std::string_view{cliOption};
std::move(cliOption);
});
ForEachUsageWarning([&](auto warning) {
@ -67,7 +67,7 @@ LanguageFeatureControl::LanguageFeatureControl() {
std::string cliOption{details::CamelCaseToLowerCaseHyphenated(name)};
cliOptions_.insert({cliOption, {warning}});
usageWarningCliCanonicalSpelling_[EnumToInt(warning)] =
std::string_view{cliOption};
std::move(cliOption);
});
// These features must be explicitly enabled by command line options.
@ -174,18 +174,16 @@ bool LanguageFeatureControl::EnableWarning(std::string_view input) {
void LanguageFeatureControl::ReplaceCliCanonicalSpelling(
LanguageFeature f, std::string input) {
std::string_view &old{languageFeatureCliCanonicalSpelling_[EnumToInt(f)]};
cliOptions_.erase(std::string{old});
languageFeatureCliCanonicalSpelling_[EnumToInt(f)] = input;
cliOptions_.erase(languageFeatureCliCanonicalSpelling_[EnumToInt(f)]);
cliOptions_.insert({input, {f}});
languageFeatureCliCanonicalSpelling_[EnumToInt(f)] = std::move(input);
}
void LanguageFeatureControl::ReplaceCliCanonicalSpelling(
UsageWarning w, std::string input) {
std::string_view &old{usageWarningCliCanonicalSpelling_[EnumToInt(w)]};
cliOptions_.erase(std::string{old});
usageWarningCliCanonicalSpelling_[EnumToInt(w)] = input;
cliOptions_.erase(usageWarningCliCanonicalSpelling_[EnumToInt(w)]);
cliOptions_.insert({input, {w}});
usageWarningCliCanonicalSpelling_[EnumToInt(w)] = std::move(input);
}
std::vector<const char *> LanguageFeatureControl::GetNames(

View File

@ -11,7 +11,7 @@ module m
logical, parameter :: test_a3 = dim(2., 1.) == 1.
logical, parameter :: test_a4 = dim(2., -1.) == 3.
logical, parameter :: test_a5 = dim(-1., 2.) == 0.
!WARN: warning: invalid argument on division
!WARN: warning: invalid argument on division [-Wfolding-exception]
real, parameter :: nan = 0./0.
logical, parameter :: test_a6 = dim(nan, 1.) /= dim(nan, 1.)
end module

View File

@ -19,16 +19,16 @@ module m1
real, parameter :: negZero = sign(0., -1.)
logical, parameter :: test_12 = nearest(negZero, 1.) == minSubnormal
logical, parameter :: test_13 = nearest(negZero, -1.) == -minSubnormal
!WARN: warning: NEAREST: S argument is zero
!WARN: warning: NEAREST: S argument is zero [-Wfolding-value-checks]
logical, parameter :: test_14 = nearest(0., negZero) == -minSubnormal
!WARN: warning: NEAREST: S argument is zero
!WARN: warning: NEAREST: S argument is zero [-Wfolding-value-checks]
logical, parameter :: test_15 = nearest(negZero, 0.) == minSubnormal
logical, parameter :: test_16 = nearest(tiny(1.),-1.) == 1.1754942E-38
logical, parameter :: test_17 = nearest(tiny(1.),1.) == 1.1754945E-38
contains
subroutine subr(a)
real, intent(in) :: a
!WARN: warning: NEAREST: S argument is zero
!WARN: warning: NEAREST: S argument is zero [-Wfolding-value-checks]
print *, nearest(a, 0.)
end
end module
@ -42,7 +42,7 @@ module m2
logical, parameter :: test_2 = ieee_next_after(minSubnormal, -1.) == 0
logical, parameter :: test_3 = ieee_next_after(1., 2.) == 1.0000001
logical, parameter :: test_4 = ieee_next_after(1.0000001, -1.) == 1
!WARN: warning: division by zero
!WARN: warning: division by zero [-Wfolding-exception]
real, parameter :: inf = 1. / 0.
logical, parameter :: test_5 = ieee_next_after(inf, inf) == inf
logical, parameter :: test_6 = ieee_next_after(inf, -inf) == h
@ -54,12 +54,12 @@ module m2
logical, parameter :: test_11 = ieee_next_after(1.9999999999999999999_10, 3.) == 2._10
#endif
logical, parameter :: test_12 = ieee_next_after(1., 1.) == 1.
!WARN: warning: invalid argument on division
!WARN: warning: invalid argument on division [-Wfolding-exception]
real, parameter :: nan = 0. / 0.
!WARN: warning: IEEE_NEXT_AFTER intrinsic folding: arguments are unordered
!WARN: warning: IEEE_NEXT_AFTER intrinsic folding: arguments are unordered [-Wfolding-value-checks]
real, parameter :: x13 = ieee_next_after(nan, nan)
logical, parameter :: test_13 = .not. (x13 == x13)
!WARN: warning: IEEE_NEXT_AFTER intrinsic folding: arguments are unordered
!WARN: warning: IEEE_NEXT_AFTER intrinsic folding: arguments are unordered [-Wfolding-value-checks]
real, parameter :: x14 = ieee_next_after(nan, 0.)
logical, parameter :: test_14 = .not. (x14 == x14)
end module
@ -72,7 +72,7 @@ module m3
logical, parameter :: test_2 = ieee_next_down(0.d0) == -minSubnormal
logical, parameter :: test_3 = ieee_next_up(1.d0) == 1.0000000000000002d0
logical, parameter :: test_4 = ieee_next_down(1.0000000000000002d0) == 1.d0
!WARN: warning: division by zero
!WARN: warning: division by zero [-Wfolding-exception]
real(kind(0.d0)), parameter :: inf = 1.d0 / 0.d0
logical, parameter :: test_5 = ieee_next_up(huge(0.d0)) == inf
logical, parameter :: test_6 = ieee_next_down(-huge(0.d0)) == -inf
@ -82,12 +82,12 @@ module m3
logical, parameter :: test_10 = ieee_next_down(-inf) == -inf
logical, parameter :: test_11 = ieee_next_up(1.9999999999999997d0) == 2.d0
logical, parameter :: test_12 = ieee_next_down(2.d0) == 1.9999999999999997d0
!WARN: warning: invalid argument on division
!WARN: warning: invalid argument on division [-Wfolding-exception]
real(kind(0.d0)), parameter :: nan = 0.d0 / 0.d0
!WARN: warning: IEEE_NEXT_UP intrinsic folding: argument is NaN
!WARN: warning: IEEE_NEXT_UP intrinsic folding: argument is NaN [-Wfolding-exception]
real(kind(0.d0)), parameter :: x13 = ieee_next_up(nan)
logical, parameter :: test_13 = .not. (x13 == x13)
!WARN: warning: IEEE_NEXT_DOWN intrinsic folding: argument is NaN
!WARN: warning: IEEE_NEXT_DOWN intrinsic folding: argument is NaN [-Wfolding-exception]
real(kind(0.d0)), parameter :: x14 = ieee_next_down(nan)
logical, parameter :: test_14 = .not. (x14 == x14)
end module

View File

@ -9,23 +9,23 @@ module m
integer(4), parameter :: i4v(*) = [ -huge(1_4) - 1_4, huge(1_4) ]
integer(8), parameter :: i8v(*) = [ -huge(1_8) - 1_8, huge(1_8) ]
integer(16), parameter :: i16v(*) = [ -huge(1_16) - 1_16, huge(1_16) ]
!WARN: warning: division by zero
!WARN: warning: invalid argument on division
!WARN: warning: division by zero [-Wfolding-exception]
!WARN: warning: invalid argument on division [-Wfolding-exception]
real(2), parameter :: r2v(*) = [ -huge(1._2), huge(1._2), 1._2/0._2, 0._2/0._2 ]
!WARN: warning: division by zero
!WARN: warning: invalid argument on division
!WARN: warning: division by zero [-Wfolding-exception]
!WARN: warning: invalid argument on division [-Wfolding-exception]
real(3), parameter :: r3v(*) = [ -huge(1._3), huge(1._3), 1._3/0._3, 0._3/0._3 ]
!WARN: warning: division by zero
!WARN: warning: invalid argument on division
!WARN: warning: division by zero [-Wfolding-exception]
!WARN: warning: invalid argument on division [-Wfolding-exception]
real(4), parameter :: r4v(*) = [ -huge(1._4), huge(1._4), 1._4/0._4, 0._4/0._4 ]
!WARN: warning: division by zero
!WARN: warning: invalid argument on division
!WARN: warning: division by zero [-Wfolding-exception]
!WARN: warning: invalid argument on division [-Wfolding-exception]
real(8), parameter :: r8v(*) = [ -huge(1._8), huge(1._8), 1._8/0._8, 0._8/0._8 ]
!WARN: warning: division by zero
!WARN: warning: invalid argument on division
!WARN: warning: division by zero [-Wfolding-exception]
!WARN: warning: invalid argument on division [-Wfolding-exception]
real(10), parameter :: r10v(*) = [ -huge(1._10), huge(1._10), 1._10/0._10, 0._10/0._10 ]
!WARN: warning: division by zero
!WARN: warning: invalid argument on division
!WARN: warning: division by zero [-Wfolding-exception]
!WARN: warning: invalid argument on division [-Wfolding-exception]
real(16), parameter :: r16v(*) = [ -huge(1._16), huge(1._16), 1._16/0._16, 0._16/0._16 ]
logical, parameter :: finites(*) = [ .true., .true., .false., .false. ]
@ -93,7 +93,7 @@ module m
logical, parameter :: test_r2r10 = .not. any(out_of_range(r2v, 1._10))
logical, parameter :: test_r2r16 = .not. any(out_of_range(r2v, 1._16))
logical, parameter :: test_r3r2 = all(out_of_range(r3v, 1._2) .eqv. finites)
!WARN: warning: invalid argument on REAL(2) to REAL(3) conversion
!WARN: warning: invalid argument on REAL(2) to REAL(3) conversion [-Wfolding-exception]
logical, parameter :: test_r3r2b = .not. any(out_of_range(real(r2v, 3), 1._2))
logical, parameter :: test_r3r3 = .not. any(out_of_range(r3v, 1._3))
logical, parameter :: test_r3r4 = .not. any(out_of_range(r3v, 1._4))
@ -101,55 +101,55 @@ module m
logical, parameter :: test_r3r10 = .not. any(out_of_range(r3v, 1._10))
logical, parameter :: test_r3r16 = .not. any(out_of_range(r3v, 1._16))
logical, parameter :: test_r4r2 = all(out_of_range(r4v, 1._2) .eqv. finites)
!WARN: warning: invalid argument on REAL(2) to REAL(4) conversion
!WARN: warning: invalid argument on REAL(2) to REAL(4) conversion [-Wfolding-exception]
logical, parameter :: test_r4r2b = .not. any(out_of_range(real(r2v, 4), 1._2))
logical, parameter :: test_r4r3 = all(out_of_range(r4v, 1._3) .eqv. finites)
!WARN: warning: invalid argument on REAL(3) to REAL(4) conversion
!WARN: warning: invalid argument on REAL(3) to REAL(4) conversion [-Wfolding-exception]
logical, parameter :: test_r4r3b = .not. any(out_of_range(real(r3v, 4), 1._3))
logical, parameter :: test_r4r4 = .not. any(out_of_range(r4v, 1._4))
logical, parameter :: test_r4r8 = .not. any(out_of_range(r4v, 1._8))
logical, parameter :: test_r4r10 = .not. any(out_of_range(r4v, 1._10))
logical, parameter :: test_r4r16 = .not. any(out_of_range(r4v, 1._16))
logical, parameter :: test_r8r2 = all(out_of_range(r8v, 1._2) .eqv. finites)
!WARN: warning: invalid argument on REAL(2) to REAL(8) conversion
!WARN: warning: invalid argument on REAL(2) to REAL(8) conversion [-Wfolding-exception]
logical, parameter :: test_r8r2b = .not. any(out_of_range(real(r2v, 8), 1._2))
logical, parameter :: test_r8r3 = all(out_of_range(r8v, 1._3) .eqv. finites)
!WARN: warning: invalid argument on REAL(3) to REAL(8) conversion
!WARN: warning: invalid argument on REAL(3) to REAL(8) conversion [-Wfolding-exception]
logical, parameter :: test_r8r3b = .not. any(out_of_range(real(r3v, 8), 1._3))
logical, parameter :: test_r8r4 = all(out_of_range(r8v, 1._4) .eqv. finites)
!WARN: warning: invalid argument on REAL(4) to REAL(8) conversion
!WARN: warning: invalid argument on REAL(4) to REAL(8) conversion [-Wfolding-exception]
logical, parameter :: test_r8r4b = .not. any(out_of_range(real(r4v, 8), 1._4))
logical, parameter :: test_r8r8 = .not. any(out_of_range(r8v, 1._8))
logical, parameter :: test_r8r10 = .not. any(out_of_range(r8v, 1._10))
logical, parameter :: test_r8r16 = .not. any(out_of_range(r8v, 1._16))
logical, parameter :: test_r10r2 = all(out_of_range(r10v, 1._2) .eqv. finites)
!WARN: warning: invalid argument on REAL(2) to REAL(10) conversion
!WARN: warning: invalid argument on REAL(2) to REAL(10) conversion [-Wfolding-exception]
logical, parameter :: test_r10r2b = .not. any(out_of_range(real(r2v, 10), 1._2))
logical, parameter :: test_r10r3 = all(out_of_range(r10v, 1._3) .eqv. finites)
!WARN: warning: invalid argument on REAL(3) to REAL(10) conversion
!WARN: warning: invalid argument on REAL(3) to REAL(10) conversion [-Wfolding-exception]
logical, parameter :: test_r10r3b = .not. any(out_of_range(real(r3v, 10), 1._3))
logical, parameter :: test_r10r4 = all(out_of_range(r10v, 1._4) .eqv. finites)
!WARN: warning: invalid argument on REAL(4) to REAL(10) conversion
!WARN: warning: invalid argument on REAL(4) to REAL(10) conversion [-Wfolding-exception]
logical, parameter :: test_r10r4b = .not. any(out_of_range(real(r4v, 10), 1._4))
logical, parameter :: test_r10r8 = all(out_of_range(r10v, 1._8) .eqv. finites)
!WARN: warning: invalid argument on REAL(8) to REAL(10) conversion
!WARN: warning: invalid argument on REAL(8) to REAL(10) conversion [-Wfolding-exception]
logical, parameter :: test_r10r8b = .not. any(out_of_range(real(r8v, 10), 1._8))
logical, parameter :: test_r10r10 = .not. any(out_of_range(r10v, 1._10))
logical, parameter :: test_r10r16 = .not. any(out_of_range(r10v, 1._16))
logical, parameter :: test_r16r2 = all(out_of_range(r16v, 1._2) .eqv. finites)
!WARN: warning: invalid argument on REAL(2) to REAL(16) conversion
!WARN: warning: invalid argument on REAL(2) to REAL(16) conversion [-Wfolding-exception]
logical, parameter :: test_r16r2b = .not. any(out_of_range(real(r2v, 16), 1._2))
logical, parameter :: test_r16r3 = all(out_of_range(r16v, 1._3) .eqv. finites)
!WARN: warning: invalid argument on REAL(3) to REAL(16) conversion
!WARN: warning: invalid argument on REAL(3) to REAL(16) conversion [-Wfolding-exception]
logical, parameter :: test_r16r3b = .not. any(out_of_range(real(r3v, 16), 1._3))
logical, parameter :: test_r16r4 = all(out_of_range(r16v, 1._4) .eqv. finites)
!WARN: warning: invalid argument on REAL(4) to REAL(16) conversion
!WARN: warning: invalid argument on REAL(4) to REAL(16) conversion [-Wfolding-exception]
logical, parameter :: test_r16r4b = .not. any(out_of_range(real(r4v, 16), 1._4))
logical, parameter :: test_r16r8 = all(out_of_range(r16v, 1._8) .eqv. finites)
!WARN: warning: invalid argument on REAL(8) to REAL(16) conversion
!WARN: warning: invalid argument on REAL(8) to REAL(16) conversion [-Wfolding-exception]
logical, parameter :: test_r16r8b = .not. any(out_of_range(real(r8v, 16), 1._8))
logical, parameter :: test_r16r10 = all(out_of_range(r16v, 1._10) .eqv. finites)
!WARN: warning: invalid argument on REAL(10) to REAL(16) conversion
!WARN: warning: invalid argument on REAL(10) to REAL(16) conversion [-Wfolding-exception]
logical, parameter :: test_r16r10b= .not. any(out_of_range(real(r10v, 16), 1._10))
logical, parameter :: test_r16r16 = .not. any(out_of_range(r16v, 1._16))
@ -223,29 +223,29 @@ module m
logical, parameter :: test_r2i2ur = all(out_of_range(real(i2v, kind=2)+.5_2, 1_2, .true.) .eqv. [.false., .true.])
logical, parameter :: test_r2i2d = all(out_of_range(real(i2v, kind=2)-.5_2, 1_2, .false.) .eqv. [.false., .true.])
logical, parameter :: test_r2i2dr = all(out_of_range(real(i2v, kind=2)-.5_2, 1_2, .true.) .eqv. [.false., .true.])
!WARN: warning: overflow on INTEGER(4) to REAL(2) conversion
!WARN: warning: overflow on INTEGER(4) to REAL(2) conversion [-Wfolding-exception]
logical, parameter :: test_r2i4u = all(out_of_range(real(i4v, kind=2)+.5_2, 1_4, .false.) .eqv. [.true., .true.])
!WARN: warning: overflow on INTEGER(4) to REAL(2) conversion
!WARN: warning: overflow on INTEGER(4) to REAL(2) conversion [-Wfolding-exception]
logical, parameter :: test_r2i4ur = all(out_of_range(real(i4v, kind=2)+.5_2, 1_4, .true.) .eqv. [.true., .true.])
!WARN: warning: overflow on INTEGER(4) to REAL(2) conversion
!WARN: warning: overflow on INTEGER(4) to REAL(2) conversion [-Wfolding-exception]
logical, parameter :: test_r2i4d = all(out_of_range(real(i4v, kind=2)-.5_2, 1_4, .false.) .eqv. [.true., .true.])
!WARN: warning: overflow on INTEGER(4) to REAL(2) conversion
!WARN: warning: overflow on INTEGER(4) to REAL(2) conversion [-Wfolding-exception]
logical, parameter :: test_r2i4dr = all(out_of_range(real(i4v, kind=2)-.5_2, 1_4, .true.) .eqv. [.true., .true.])
!WARN: warning: overflow on INTEGER(8) to REAL(2) conversion
!WARN: warning: overflow on INTEGER(8) to REAL(2) conversion [-Wfolding-exception]
logical, parameter :: test_r2i8u = all(out_of_range(real(i8v, kind=2)+.5_2, 1_8, .false.) .eqv. [.true., .true.])
!WARN: warning: overflow on INTEGER(8) to REAL(2) conversion
!WARN: warning: overflow on INTEGER(8) to REAL(2) conversion [-Wfolding-exception]
logical, parameter :: test_r2i8ur = all(out_of_range(real(i8v, kind=2)+.5_2, 1_8, .true.) .eqv. [.true., .true.])
!WARN: warning: overflow on INTEGER(8) to REAL(2) conversion
!WARN: warning: overflow on INTEGER(8) to REAL(2) conversion [-Wfolding-exception]
logical, parameter :: test_r2i8d = all(out_of_range(real(i8v, kind=2)-.5_2, 1_8, .false.) .eqv. [.true., .true.])
!WARN: warning: overflow on INTEGER(8) to REAL(2) conversion
!WARN: warning: overflow on INTEGER(8) to REAL(2) conversion [-Wfolding-exception]
logical, parameter :: test_r2i8dr = all(out_of_range(real(i8v, kind=2)-.5_2, 1_8, .true.) .eqv. [.true., .true.])
!WARN: warning: overflow on INTEGER(16) to REAL(2) conversion
!WARN: warning: overflow on INTEGER(16) to REAL(2) conversion [-Wfolding-exception]
logical, parameter :: test_r2i16u = all(out_of_range(real(i16v, kind=2)+.5_2, 1_16, .false.) .eqv. [.true., .true.])
!WARN: warning: overflow on INTEGER(16) to REAL(2) conversion
!WARN: warning: overflow on INTEGER(16) to REAL(2) conversion [-Wfolding-exception]
logical, parameter :: test_r2i16ur = all(out_of_range(real(i16v, kind=2)+.5_2, 1_16, .true.) .eqv. [.true., .true.])
!WARN: warning: overflow on INTEGER(16) to REAL(2) conversion
!WARN: warning: overflow on INTEGER(16) to REAL(2) conversion [-Wfolding-exception]
logical, parameter :: test_r2i16d = all(out_of_range(real(i16v, kind=2)-.5_2, 1_16, .false.) .eqv. [.true., .true.])
!WARN: warning: overflow on INTEGER(16) to REAL(2) conversion
!WARN: warning: overflow on INTEGER(16) to REAL(2) conversion [-Wfolding-exception]
logical, parameter :: test_r2i16dr = all(out_of_range(real(i16v, kind=2)-.5_2, 1_16, .true.) .eqv. [.true., .true.])
logical, parameter :: test_r3i1u = all(out_of_range(real(i1v, kind=3)+.5_3, 1_1, .false.) .eqv. [.false., .false.])
@ -357,7 +357,7 @@ module m
subroutine s(x, r)
real(8), intent(in) :: x
logical, intent(in), optional :: r
!WARN: warning: ROUND= argument to OUT_OF_RANGE() is an optional dummy argument that must be present at execution
!WARN: warning: ROUND= argument to OUT_OF_RANGE() is an optional dummy argument that must be present at execution [-Woptional-must-be-present]
print *, out_of_range(x, 1, round=r)
end
end

View File

@ -24,7 +24,7 @@ module m
logical, parameter :: test_cus0 = int(0u,1) == 0
logical, parameter :: test_cus0_k = kind(int(0u,1)) == 1
!WARN: warning: conversion of 255_U1 to INTEGER(1) overflowed; result is -1
!WARN: warning: conversion of 255_U1 to INTEGER(1) overflowed; result is -1 [-Wfolding-exception]
logical, parameter :: test_cus255 = int(255u_1,1) == -1
logical, parameter :: test_cur255 = real(255u) == 255.

View File

@ -15,32 +15,32 @@ module integer_tests
! Integer division by zero are not tested here because they are handled as fatal
! errors in constants.
!WARN: warning: INTEGER(4) negation overflowed
!WARN: warning: INTEGER(4) negation overflowed [-Wfolding-exception]
logical, parameter :: test_overflow_unary_minus1 = (-i4_nmax).EQ.i4_nmax
logical, parameter :: test_no_overflow_unary_minus1 = (-i4_pmax).EQ.(i4_nmax+1_4)
logical, parameter :: test_no_overflow_unary_plus1 = (+i4_pmax).EQ.i4_pmax
logical, parameter :: test_no_overflow_unary_plus2 = (+i4_nmax).EQ.i4_nmax
!WARN: warning: INTEGER(4) addition overflowed
!WARN: warning: INTEGER(4) addition overflowed [-Wfolding-exception]
logical, parameter :: test_overflow_add1 = (i4_pmax+1_4).EQ.i4_nmax
!WARN: warning: INTEGER(4) addition overflowed
!WARN: warning: INTEGER(4) addition overflowed [-Wfolding-exception]
logical, parameter :: test_overflow_add2 = (i4_nmax + (-1_4)).EQ.i4_pmax
!WARN: warning: INTEGER(4) addition overflowed
!WARN: warning: INTEGER(4) addition overflowed [-Wfolding-exception]
logical, parameter :: test_overflow_add3 = (i4_pmax + i4_pmax).EQ.(-2_4)
!WARN: warning: INTEGER(4) addition overflowed
!WARN: warning: INTEGER(4) addition overflowed [-Wfolding-exception]
logical, parameter :: test_overflow_add4 = (i4_nmax + i4_nmax).EQ.(0_4)
logical, parameter :: test_no_overflow_add1 = (i4_pmax + 0_4).EQ.i4_pmax
logical, parameter :: test_no_overflow_add2 = (i4_nmax + (-0_4)).EQ.i4_nmax
logical, parameter :: test_no_overflow_add3 = (i4_pmax + i4_nmax).EQ.(-1_4)
logical, parameter :: test_no_overflow_add4 = (i4_nmax + i4_pmax).EQ.(-1_4)
!WARN: warning: INTEGER(4) subtraction overflowed
!WARN: warning: INTEGER(4) subtraction overflowed [-Wfolding-exception]
logical, parameter :: test_overflow_sub1 = (i4_nmax - 1_4).EQ.i4_pmax
!WARN: warning: INTEGER(4) subtraction overflowed
!WARN: warning: INTEGER(4) subtraction overflowed [-Wfolding-exception]
logical, parameter :: test_overflow_sub2 = (i4_pmax - (-1_4)).EQ.i4_nmax
!WARN: warning: INTEGER(4) subtraction overflowed
!WARN: warning: INTEGER(4) subtraction overflowed [-Wfolding-exception]
logical, parameter :: test_overflow_sub3 = (i4_nmax - i4_pmax).EQ.(1_4)
!WARN: warning: INTEGER(4) subtraction overflowed
!WARN: warning: INTEGER(4) subtraction overflowed [-Wfolding-exception]
logical, parameter :: test_overflow_sub4 = (i4_pmax - i4_nmax).EQ.(-1_4)
logical, parameter :: test_no_overflow_sub1 = (i4_nmax - 0_4).EQ.i4_nmax
logical, parameter :: test_no_overflow_sub2 = (i4_pmax - (-0_4)).EQ.i4_pmax
@ -48,23 +48,23 @@ module integer_tests
logical, parameter :: test_no_overflow_sub4 = (i4_pmax - i4_pmax).EQ.0_4
!WARN: warning: INTEGER(4) multiplication overflowed
!WARN: warning: INTEGER(4) multiplication overflowed [-Wfolding-exception]
logical, parameter :: test_overflow_mult1 = (i4_pmax*2_4).EQ.(-2_4)
!WARN: warning: INTEGER(4) multiplication overflowed
!WARN: warning: INTEGER(4) multiplication overflowed [-Wfolding-exception]
logical, parameter :: test_overflow_mult2 = (i4_nmax*2_4).EQ.(0_4)
!WARN: warning: INTEGER(4) multiplication overflowed
!WARN: warning: INTEGER(4) multiplication overflowed [-Wfolding-exception]
logical, parameter :: test_overflow_mult3 = (i4_nmax*i4_nmax).EQ.(0_4)
!WARN: warning: INTEGER(4) multiplication overflowed
!WARN: warning: INTEGER(4) multiplication overflowed [-Wfolding-exception]
logical, parameter :: test_overflow_mult4 = (i4_pmax*i4_pmax).EQ.(1_4)
!WARN: warning: INTEGER(4) division overflowed
!WARN: warning: INTEGER(4) division overflowed [-Wfolding-exception]
logical, parameter :: test_overflow_div1 = (i4_nmax/(-1_4)).EQ.(i4_nmax)
logical, parameter :: test_no_overflow_div1 = (i4_nmax/(-2_4)).EQ.(1_4 + i4_pmax/2_4)
logical, parameter :: test_no_overflow_div2 = (i4_nmax/i4_nmax).EQ.(1_4)
!WARN: warning: INTEGER(4) power overflowed
!WARN: warning: INTEGER(4) power overflowed [-Wfolding-exception]
logical, parameter :: test_overflow_pow1 = (i4_pmax**2_4).EQ.(1_4)
!WARN: warning: INTEGER(4) power overflowed
!WARN: warning: INTEGER(4) power overflowed [-Wfolding-exception]
logical, parameter :: test_overflow_pow3 = (i4_nmax**2_4).EQ.(0_4)
logical, parameter :: test_no_overflow_pow1 = ((-1_4)**i4_nmax).EQ.(1_4)
logical, parameter :: test_no_overflow_pow2 = ((-1_4)**i4_pmax).EQ.(-1_4)
@ -76,12 +76,12 @@ module real_tests
real(4), parameter :: r4_pmax = 3.4028235E38
real(4), parameter :: r4_nmax = -3.4028235E38
!WARN: warning: invalid argument on division
!WARN: warning: invalid argument on division [-Wfolding-exception]
real(4), parameter :: r4_nan = 0._4/0._4
TEST_ISNAN(r4_nan)
!WARN: warning: division by zero
!WARN: warning: division by zero [-Wfolding-exception]
real(4), parameter :: r4_pinf = 1._4/0._4
!WARN: warning: division by zero
!WARN: warning: division by zero [-Wfolding-exception]
real(4), parameter :: r4_ninf = -1._4/0._4
logical, parameter :: test_r4_nan_parentheses1 = .NOT.(((r4_nan)).EQ.r4_nan)
@ -106,13 +106,13 @@ module real_tests
real(4), parameter :: r4_nan_plus = (+r4_nan)
TEST_ISNAN(r4_nan_plus)
!WARN: warning: overflow on addition
!WARN: warning: overflow on addition [-Wfolding-exception]
logical, parameter :: test_inf_r4_add9 = (r4_pmax + r4_pmax).eq.(r4_pinf)
!WARN: warning: overflow on addition
!WARN: warning: overflow on addition [-Wfolding-exception]
logical, parameter :: test_inf_r4_add10 = (r4_nmax + r4_nmax).eq.(r4_ninf)
!WARN: warning: overflow on subtraction
!WARN: warning: overflow on subtraction [-Wfolding-exception]
logical, parameter :: test_inf_r4_sub9 = (r4_pmax - r4_nmax).eq.(r4_pinf)
!WARN: warning: overflow on subtraction
!WARN: warning: overflow on subtraction [-Wfolding-exception]
logical, parameter :: test_inf_r4_sub10 = (r4_nmax - r4_pmax).eq.(r4_ninf)
! No warnings expected below (inf propagation).
@ -125,16 +125,16 @@ module real_tests
logical, parameter :: test_inf_r4_add7 = (r4_ninf + 0._4).EQ.(r4_ninf)
logical, parameter :: test_inf_r4_add8 = (r4_pinf + 0._4).EQ.(r4_pinf)
!WARN: warning: invalid argument on subtraction
!WARN: warning: invalid argument on subtraction [-Wfolding-exception]
real(4), parameter :: r4_nan_sub1 = r4_pinf - r4_pinf
TEST_ISNAN(r4_nan_sub1)
!WARN: warning: invalid argument on subtraction
!WARN: warning: invalid argument on subtraction [-Wfolding-exception]
real(4), parameter :: r4_nan_sub2 = r4_ninf - r4_ninf
TEST_ISNAN(r4_nan_sub2)
!WARN: warning: invalid argument on addition
!WARN: warning: invalid argument on addition [-Wfolding-exception]
real(4), parameter :: r4_nan_add1 = r4_ninf + r4_pinf
TEST_ISNAN(r4_nan_add1)
!WARN: warning: invalid argument on addition
!WARN: warning: invalid argument on addition [-Wfolding-exception]
real(4), parameter :: r4_nan_add2 = r4_pinf + r4_ninf
TEST_ISNAN(r4_nan_add2)
@ -156,13 +156,13 @@ module real_tests
real(4), parameter :: r4_nan_add6 = r4_nan + r4_nan
TEST_ISNAN(r4_nan_add6)
!WARN: warning: overflow on multiplication
!WARN: warning: overflow on multiplication [-Wfolding-exception]
logical, parameter :: test_inf_r4_mult1 = (1.5_4*r4_pmax).eq.(r4_pinf)
!WARN: warning: overflow on multiplication
!WARN: warning: overflow on multiplication [-Wfolding-exception]
logical, parameter :: test_inf_r4_mult2 = (1.5_4*r4_nmax).eq.(r4_ninf)
!WARN: warning: overflow on division
!WARN: warning: overflow on division [-Wfolding-exception]
logical, parameter :: test_inf_r4_div1 = (r4_nmax/(-0.5_4)).eq.(r4_pinf)
!WARN: warning: overflow on division
!WARN: warning: overflow on division [-Wfolding-exception]
logical, parameter :: test_inf_r4_div2 = (r4_pmax/(-0.5_4)).eq.(r4_ninf)
! No warnings expected below (inf propagation).
@ -179,25 +179,25 @@ module real_tests
logical, parameter :: test_inf_r4_div9 = (r4_nmax/r4_pinf).EQ.(0.)
logical, parameter :: test_inf_r4_div10 = (r4_nmax/r4_ninf).EQ.(0.)
!WARN: warning: invalid argument on division
!WARN: warning: invalid argument on division [-Wfolding-exception]
real(4), parameter :: r4_nan_div1 = 0._4/0._4
TEST_ISNAN(r4_nan_div1)
!WARN: warning: invalid argument on division
!WARN: warning: invalid argument on division [-Wfolding-exception]
real(4), parameter :: r4_nan_div2 = r4_ninf/r4_ninf
TEST_ISNAN(r4_nan_div2)
!WARN: warning: invalid argument on division
!WARN: warning: invalid argument on division [-Wfolding-exception]
real(4), parameter :: r4_nan_div3 = r4_ninf/r4_pinf
TEST_ISNAN(r4_nan_div3)
!WARN: warning: invalid argument on division
!WARN: warning: invalid argument on division [-Wfolding-exception]
real(4), parameter :: r4_nan_div4 = r4_pinf/r4_ninf
TEST_ISNAN(r4_nan_div4)
!WARN: warning: invalid argument on division
!WARN: warning: invalid argument on division [-Wfolding-exception]
real(4), parameter :: r4_nan_div5 = r4_pinf/r4_pinf
TEST_ISNAN(r4_nan_div5)
!WARN: warning: invalid argument on multiplication
!WARN: warning: invalid argument on multiplication [-Wfolding-exception]
real(4), parameter :: r4_nan_mult1 = r4_pinf*0._4
TEST_ISNAN(r4_nan_mult1)
!WARN: warning: invalid argument on multiplication
!WARN: warning: invalid argument on multiplication [-Wfolding-exception]
real(4), parameter :: r4_nan_mult2 = 0._4*r4_ninf
TEST_ISNAN(r4_nan_mult2)

View File

@ -10,11 +10,11 @@ module real_tests
real(4), parameter :: r4_pmax = 3.4028235E38
real(4), parameter :: r4_nmax = -3.4028235E38
!WARN: warning: invalid argument on division
!WARN: warning: invalid argument on division [-Wfolding-exception]
real(4), parameter :: r4_nan = 0._4/0._4
!WARN: warning: division by zero
!WARN: warning: division by zero [-Wfolding-exception]
real(4), parameter :: r4_pinf = 1._4/0._4
!WARN: warning: division by zero
!WARN: warning: division by zero [-Wfolding-exception]
real(4), parameter :: r4_ninf = -1._4/0._4
!WARN: warning: argument is out of range [-1., 1.]
@ -37,7 +37,7 @@ module real_tests
TEST_ISNAN(nan_r8_dasin1)
!WARN: warning: complex argument must be different from zero
complex(4), parameter :: c4_clog1 = clog((0., 0.))
!WARN: warning: MOD: P argument is zero
!WARN: warning: MOD: P argument is zero [-Wfolding-avoids-runtime-crash]
real(4), parameter :: nan_r4_mod = mod(3.5, 0.)
TEST_ISNAN(nan_r4_mod)
real(4), parameter :: ok_r4_gamma = gamma(-1.1)
@ -53,17 +53,17 @@ module real_tests
!WARN: warning: 'x' and 'y' arguments must not be both zero
real(4), parameter :: r4_atan2 = atan2(0., 0.)
!WARN: warning: overflow on evaluation of intrinsic function or operation
!WARN: warning: overflow on evaluation of intrinsic function or operation [-Wfolding-exception]
logical, parameter :: test_exp_overflow = exp(256._4).EQ.r4_pinf
contains
subroutine s1(a,j)
!WARN: warning: MOD: P argument is zero
!WARN: warning: MOD: P argument is zero [-Wfolding-avoids-runtime-crash]
print *, mod(a, 0.)
!WARN: warning: MODULO: P argument is zero
!WARN: warning: MODULO: P argument is zero [-Wfolding-avoids-runtime-crash]
print *, modulo(a, 0.)
!WARN: warning: MOD: P argument is zero
!WARN: warning: MOD: P argument is zero [-Wfolding-avoids-runtime-crash]
print *, mod(j, 0.)
!WARN: warning: MODULO: P argument is zero
!WARN: warning: MODULO: P argument is zero [-Wfolding-avoids-runtime-crash]
print *, modulo(j, 0.)
end
end module
@ -86,13 +86,13 @@ module specific_extremums
! specified for f18 (converting the result).
integer(8), parameter :: max_i32_8 = 2_8**31-1
integer, parameter :: expected_min0 = int(min(max_i32_8, 2_8*max_i32_8), 4)
!WARN: portability: Argument types do not match specific intrinsic 'min0' requirements; using 'min' generic instead and converting the result to INTEGER(4) if needed
!WARN: portability: Argument types do not match specific intrinsic 'min0' requirements; using 'min' generic instead and converting the result to INTEGER(4) if needed [-Wuse-generic-intrinsic-when-specific-doesnt-match]
integer, parameter :: result_min0 = min0(max_i32_8, 2_8*max_i32_8)
! result_min0 would be -2 if arguments were converted to default integer.
logical, parameter :: test_min0 = expected_min0 .EQ. result_min0
real, parameter :: expected_amax0 = real(max(max_i32_8, 2_8*max_i32_8), 4)
!WARN: portability: Argument types do not match specific intrinsic 'amax0' requirements; using 'max' generic instead and converting the result to REAL(4) if needed
!WARN: portability: Argument types do not match specific intrinsic 'amax0' requirements; using 'max' generic instead and converting the result to REAL(4) if needed [-Wuse-generic-intrinsic-when-specific-doesnt-match]
real, parameter :: result_amax0 = amax0(max_i32_8, 2_8*max_i32_8)
! result_amax0 would be 2.1474836E+09 if arguments were converted to default integer first.
logical, parameter :: test_amax0 = expected_amax0 .EQ. result_amax0

Binary file not shown.

View File

@ -7,12 +7,12 @@ module m
integer, pointer :: int_pointer
integer, allocatable :: int_allocatable
logical, parameter :: test_Assoc1 = .not.(associated(null()))
!WARN: portability: POINTER= argument of ASSOCIATED() is required by some other compilers to be a valid left-hand side of a pointer assignment statement
!WARN: portability: POINTER= argument of ASSOCIATED() is required by some other compilers to be a valid left-hand side of a pointer assignment statement [-Wportability]
!WARN: because: 'NULL()' is a null pointer
logical, parameter :: test_Assoc2 = .not.(associated(null(), null()))
logical, parameter :: test_Assoc3 = .not.(associated(null(int_pointer)))
logical, parameter :: test_Alloc1 = .not.(allocated(null(int_allocatable)))
!WARN: portability: POINTER= argument of ASSOCIATED() is required by some other compilers to be a valid left-hand side of a pointer assignment statement
!WARN: portability: POINTER= argument of ASSOCIATED() is required by some other compilers to be a valid left-hand side of a pointer assignment statement [-Wportability]
!WARN: because: 'NULL()' is a null pointer
logical, parameter :: test_Assoc5 = .not. associated(null(), null(int_pointer))

View File

@ -4,9 +4,9 @@ module m1
logical, parameter :: results(*) = isnan([ &
0., &
-0., &
!WARN: warning: division by zero
!WARN: warning: division by zero [-Wfolding-exception]
1./0., &
!WARN: warning: invalid argument on division
!WARN: warning: invalid argument on division [-Wfolding-exception]
0./0., &
real(z'7ff80001',kind=4), &
real(z'fff80001',kind=4), &

View File

@ -15,7 +15,7 @@ module m
! -0 (sqrt is -0)
real(8), parameter :: n08 = z'8000000000000000'
real(8), parameter :: sqrt_n08 = sqrt(n08)
!WARN: warning: division by zero
!WARN: warning: division by zero [-Wfolding-exception]
real(8), parameter :: inf_n08 = 1.0_8 / sqrt_n08, inf_n08z = z'fff0000000000000'
logical, parameter :: test_n08 = inf_n08 == inf_n08z
! min normal

View File

@ -74,7 +74,7 @@ subroutine openacc_clause_validity
! Exit branches out of parallel construct, attached to an OpenACC parallel construct.
thisblk: BLOCK
fortname: if (.true.) then
!PORTABILITY: The construct name 'name1' should be distinct at the subprogram level
!PORTABILITY: The construct name 'name1' should be distinct at the subprogram level [-Wbenign-name-clash]
name1: do k = 1, N
!$acc parallel
!ERROR: EXIT to construct 'fortname' outside of PARALLEL construct is not allowed

View File

@ -132,7 +132,7 @@ program openacc_data_validity
!ERROR: At least one of COPYOUT, DELETE, DETACH clause must appear on the EXIT DATA directive
!$acc exit data
!PORTABILITY: At least one of ATTACH, COPY, COPYIN, COPYOUT, CREATE, DEFAULT, DEVICEPTR, NO_CREATE, PRESENT clause should appear on the DATA directive
!PORTABILITY: At least one of ATTACH, COPY, COPYIN, COPYOUT, CREATE, DEFAULT, DEVICEPTR, NO_CREATE, PRESENT clause should appear on the DATA directive [-Wportability]
!$acc data
!$acc end data

View File

@ -14,7 +14,7 @@ module openacc_declare_validity
!$acc declare create(aa, bb)
!WARNING: 'aa' in the CREATE clause is already present in the same clause in this module
!WARNING: 'aa' in the CREATE clause is already present in the same clause in this module [-Wopen-acc-usage]
!$acc declare create(aa)
!$acc declare link(ab)

View File

@ -84,15 +84,15 @@ program openacc_serial_validity
!$acc serial wait(wait1) wait(wait2)
!$acc end serial
!PORTABILITY: NUM_GANGS clause is not allowed on the SERIAL directive and will be ignored
!PORTABILITY: NUM_GANGS clause is not allowed on the SERIAL directive and will be ignored [-Wportability]
!$acc serial num_gangs(8)
!$acc end serial
!PORTABILITY: NUM_WORKERS clause is not allowed on the SERIAL directive and will be ignored
!PORTABILITY: NUM_WORKERS clause is not allowed on the SERIAL directive and will be ignored [-Wportability]
!$acc serial num_workers(8)
!$acc end serial
!PORTABILITY: VECTOR_LENGTH clause is not allowed on the SERIAL directive and will be ignored
!PORTABILITY: VECTOR_LENGTH clause is not allowed on the SERIAL directive and will be ignored [-Wportability]
!$acc serial vector_length(128)
!$acc end serial

View File

@ -13,7 +13,7 @@ program allocate_align_tree
z = 3
!ERROR: The alignment value should be a constant positive integer
!$omp allocate(j) align(xx)
!WARNING: OpenMP directive ALLOCATE has been deprecated, please use ALLOCATORS instead.
!WARNING: OpenMP directive ALLOCATE has been deprecated, please use ALLOCATORS instead. [-Wopen-mp-usage]
!ERROR: The alignment value should be a constant positive integer
!$omp allocate(xarray) align(-32) allocator(omp_large_cap_mem_alloc)
allocate(j(z), xarray(t))

View File

@ -19,7 +19,7 @@ use omp_lib
!$omp allocate(y)
print *, a
!WARNING: OpenMP directive ALLOCATE has been deprecated, please use ALLOCATORS instead.
!WARNING: OpenMP directive ALLOCATE has been deprecated, please use ALLOCATORS instead. [-Wopen-mp-usage]
!ERROR: List items must be declared in the same scoping unit in which the ALLOCATE directive appears
!$omp allocate(x) allocator(omp_default_mem_alloc)
allocate ( x(a), darray(a, b) )

View File

@ -483,14 +483,14 @@ use omp_lib
! 2.13.1 master
!$omp parallel
!WARNING: OpenMP directive MASTER has been deprecated, please use MASKED instead.
!WARNING: OpenMP directive MASTER has been deprecated, please use MASKED instead. [-Wopen-mp-usage]
!$omp master
a=3.14
!$omp end master
!$omp end parallel
!$omp parallel
!WARNING: OpenMP directive MASTER has been deprecated, please use MASKED instead.
!WARNING: OpenMP directive MASTER has been deprecated, please use MASKED instead. [-Wopen-mp-usage]
!ERROR: NUM_THREADS clause is not allowed on the MASTER directive
!$omp master num_threads(4)
a=3.14

View File

@ -10,7 +10,7 @@
subroutine firstprivate()
class(*), allocatable, save :: x
!PORTABILITY: If a polymorphic variable with allocatable attribute 'x' is in FIRSTPRIVATE clause, the behavior is unspecified
!PORTABILITY: If a polymorphic variable with allocatable attribute 'x' is in FIRSTPRIVATE clause, the behavior is unspecified [-Wportability]
!$omp parallel firstprivate(x)
call sub()
!$omp end parallel
@ -20,7 +20,7 @@ end
subroutine lastprivate()
class(*), allocatable, save :: x
!PORTABILITY: If a polymorphic variable with allocatable attribute 'x' is in LASTPRIVATE clause, the behavior is unspecified
!PORTABILITY: If a polymorphic variable with allocatable attribute 'x' is in LASTPRIVATE clause, the behavior is unspecified [-Wportability]
!$omp do lastprivate(x)
do i = 1, 10
call sub()
@ -33,7 +33,7 @@ subroutine copyin()
class(*), allocatable, save :: x
!$omp threadprivate(x)
!PORTABILITY: If a polymorphic variable with allocatable attribute 'x' is in COPYIN clause, the behavior is unspecified
!PORTABILITY: If a polymorphic variable with allocatable attribute 'x' is in COPYIN clause, the behavior is unspecified [-Wportability]
!$omp parallel copyin(x)
call sub()
!$omp end parallel
@ -46,7 +46,7 @@ subroutine copyprivate()
!$omp single
call sub()
!PORTABILITY: If a polymorphic variable with allocatable attribute 'x' is in COPYPRIVATE clause, the behavior is unspecified
!PORTABILITY: If a polymorphic variable with allocatable attribute 'x' is in COPYPRIVATE clause, the behavior is unspecified [-Wportability]
!$omp end single copyprivate(x)
end

View File

@ -56,10 +56,10 @@ module m2
contains
subroutine foo
!$omp declare target
!WARNING: The entity with PARAMETER attribute is used in a DECLARE TARGET directive
!WARNING: The entity with PARAMETER attribute is used in a DECLARE TARGET directive
!WARNING: The entity with PARAMETER attribute is used in a DECLARE TARGET directive [-Wopen-mp-usage]
!WARNING: The entity with PARAMETER attribute is used in a DECLARE TARGET directive [-Wopen-mp-usage]
!$omp declare target (foo, N, M)
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
!ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly
!ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly
!ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly
@ -68,7 +68,7 @@ contains
!ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly
!ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly
!$omp declare target enter(Q, S) link(R)
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
!ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly
!ERROR: MAP clause is not allowed on the DECLARE TARGET directive
!$omp declare target to(Q) map(from:Q)

View File

@ -51,84 +51,84 @@ module declare_target01
!ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
!$omp declare target (y%KIND)
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
!$omp declare target to (my_var)
!$omp declare target enter (my_var)
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
!$omp declare target to (my_var) device_type(host)
!$omp declare target enter (my_var) device_type(host)
!ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
!$omp declare target to (my_var%t_i)
!ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive
!$omp declare target enter (my_var%t_i)
!ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
!$omp declare target to (my_var%t_arr)
!ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive
!$omp declare target enter (my_var%t_arr)
!ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
!$omp declare target to (my_var%kind_param)
!ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
!$omp declare target enter (my_var%kind_param)
!ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
!$omp declare target to (my_var%len_param)
!ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
!$omp declare target enter (my_var%len_param)
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
!$omp declare target to (arr)
!$omp declare target enter (arr)
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
!$omp declare target to (arr) device_type(nohost)
!$omp declare target enter (arr) device_type(nohost)
!ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
!$omp declare target to (arr(1))
!ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive
!$omp declare target enter (arr(1))
!ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
!$omp declare target to (arr(1:2))
!ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive
!$omp declare target enter (arr(1:2))
!ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
!$omp declare target to (x%KIND)
!ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
!$omp declare target enter (x%KIND)
!ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
!$omp declare target to (w%LEN)
!ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
!$omp declare target enter (w%LEN)
!ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
!$omp declare target to (y%KIND)
!ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive

View File

@ -16,17 +16,17 @@ program declare_target02
!ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
!$omp declare target (a1)
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
!$omp declare target to (arr1_to)
!$omp declare target enter (arr1_to)
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
!$omp declare target to (blk1_to)
!$omp declare target enter (blk1_to)
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
!ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
!$omp declare target to (a1_to)
@ -44,7 +44,7 @@ program declare_target02
!ERROR: A variable in a DECLARE TARGET directive cannot appear in an EQUIVALENCE statement
!$omp declare target (eq_a)
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
!ERROR: A variable in a DECLARE TARGET directive cannot appear in an EQUIVALENCE statement
!$omp declare target to (eq_a)
@ -57,7 +57,7 @@ program declare_target02
!ERROR: A variable in a DECLARE TARGET directive cannot appear in an EQUIVALENCE statement
!$omp declare target (eq_c)
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
!ERROR: A variable in a DECLARE TARGET directive cannot appear in an EQUIVALENCE statement
!$omp declare target to (eq_c)
@ -87,26 +87,26 @@ contains
!ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
!$omp declare target (a3)
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
!ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly
!$omp declare target to (arr2_to)
!ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly
!$omp declare target enter (arr2_to)
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
!$omp declare target to (arr3_to)
!$omp declare target enter (arr3_to)
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
!ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
!$omp declare target to (a2_to)
!ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
!$omp declare target enter (a2_to)
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
!ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
!$omp declare target to (a3_to)
@ -137,16 +137,16 @@ module mod4
!ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
!$omp declare target (a4)
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
!$omp declare target to (arr4_to)
!$omp declare target enter (arr4_to)
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
!$omp declare target to (blk4_to)
!$omp declare target enter (blk4_to)
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
!ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
!$omp declare target to (a4_to)
@ -174,21 +174,21 @@ subroutine func5()
!ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
!$omp declare target (a5)
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
!ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly
!$omp declare target to (arr5_to)
!ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly
!$omp declare target enter (arr5_to)
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
!ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly
!$omp declare target to (blk5_to)
!ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly
!$omp declare target enter (blk5_to)
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
!ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
!$omp declare target to (a5_to)

View File

@ -16,7 +16,7 @@ program main
!ERROR: The module name or main program name cannot be in a DECLARE TARGET directive
!$omp declare target (mod1)
!PORTABILITY: Name 'main' declared in a main program should not have the same name as the main program
!PORTABILITY: Name 'main' declared in a main program should not have the same name as the main program [-Wbenign-name-clash]
!ERROR: The module name or main program name cannot be in a DECLARE TARGET directive
!$omp declare target (main)
end

View File

@ -12,7 +12,7 @@ module test_0
!ERROR: No explicit type declared for 'no_implicit_materialization_2'
!$omp declare target link(no_implicit_materialization_2)
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
!ERROR: No explicit type declared for 'no_implicit_materialization_3'
!$omp declare target to(no_implicit_materialization_3)

View File

@ -4,7 +4,7 @@
subroutine test_master()
integer :: c = 1
!WARNING: OpenMP directive MASTER has been deprecated, please use MASKED instead.
!WARNING: OpenMP directive MASTER has been deprecated, please use MASKED instead. [-Wopen-mp-usage]
!$omp master
c = c + 1
!$omp end master
@ -12,7 +12,7 @@ end subroutine
subroutine test_parallel_master
integer :: c = 2
!WARNING: OpenMP directive PARALLEL MASTER has been deprecated, please use PARALLEL MASKED instead.
!WARNING: OpenMP directive PARALLEL MASTER has been deprecated, please use PARALLEL MASKED instead. [-Wopen-mp-usage]
!$omp parallel master
c = c + 2
!$omp end parallel master
@ -20,7 +20,7 @@ end subroutine
subroutine test_master_taskloop_simd()
integer :: i, j = 1
!WARNING: OpenMP directive MASTER TASKLOOP SIMD has been deprecated, please use MASKED TASKLOOP SIMD instead.
!WARNING: OpenMP directive MASTER TASKLOOP SIMD has been deprecated, please use MASKED TASKLOOP SIMD instead. [-Wopen-mp-usage]
!$omp master taskloop simd
do i=1,10
j = j + 1
@ -30,7 +30,7 @@ end subroutine
subroutine test_master_taskloop
integer :: i, j = 1
!WARNING: OpenMP directive MASTER TASKLOOP has been deprecated, please use MASKED TASKLOOP instead.
!WARNING: OpenMP directive MASTER TASKLOOP has been deprecated, please use MASKED TASKLOOP instead. [-Wopen-mp-usage]
!$omp master taskloop
do i=1,10
j = j + 1
@ -40,7 +40,7 @@ end subroutine
subroutine test_parallel_master_taskloop_simd
integer :: i, j = 1
!WARNING: OpenMP directive PARALLEL MASTER TASKLOOP SIMD has been deprecated, please use PARALLEL_MASKED TASKLOOP SIMD instead.
!WARNING: OpenMP directive PARALLEL MASTER TASKLOOP SIMD has been deprecated, please use PARALLEL_MASKED TASKLOOP SIMD instead. [-Wopen-mp-usage]
!$omp parallel master taskloop simd
do i=1,10
j = j + 1
@ -50,7 +50,7 @@ end subroutine
subroutine test_parallel_master_taskloop
integer :: i, j = 1
!WARNING: OpenMP directive PARALLEL MASTER TASKLOOP has been deprecated, please use PARALLEL MASKED TASKLOOP instead.
!WARNING: OpenMP directive PARALLEL MASTER TASKLOOP has been deprecated, please use PARALLEL MASKED TASKLOOP instead. [-Wopen-mp-usage]
!$omp parallel master taskloop
do i=1,10
j = j + 1

View File

@ -10,7 +10,7 @@ program main
real, allocatable :: B(:)
!$omp target
!PORTABILITY: If TARGET UPDATE directive is nested inside TARGET region, the behaviour is unspecified
!PORTABILITY: If TARGET UPDATE directive is nested inside TARGET region, the behaviour is unspecified [-Wopen-mp-usage]
!$omp target update from(arrayA) to(arrayB)
do i = 1, 512
arrayA(i) = arrayB(i)
@ -20,7 +20,7 @@ program main
!$omp parallel
!$omp target
!$omp parallel
!PORTABILITY: If TARGET UPDATE directive is nested inside TARGET region, the behaviour is unspecified
!PORTABILITY: If TARGET UPDATE directive is nested inside TARGET region, the behaviour is unspecified [-Wopen-mp-usage]
!$omp target update from(arrayA) to(arrayB)
do i = 1, 512
arrayA(i) = arrayB(i)
@ -30,7 +30,7 @@ program main
!$omp end parallel
!$omp target
!PORTABILITY: If TARGET DATA directive is nested inside TARGET region, the behaviour is unspecified
!PORTABILITY: If TARGET DATA directive is nested inside TARGET region, the behaviour is unspecified [-Wopen-mp-usage]
!$omp target data map(to: a)
do i = 1, N
a = 3.14
@ -40,12 +40,12 @@ program main
allocate(B(N))
!$omp target
!PORTABILITY: If TARGET ENTER DATA directive is nested inside TARGET region, the behaviour is unspecified
!PORTABILITY: If TARGET ENTER DATA directive is nested inside TARGET region, the behaviour is unspecified [-Wopen-mp-usage]
!$omp target enter data map(alloc:B)
!$omp end target
!$omp target
!PORTABILITY: If TARGET EXIT DATA directive is nested inside TARGET region, the behaviour is unspecified
!PORTABILITY: If TARGET EXIT DATA directive is nested inside TARGET region, the behaviour is unspecified [-Wopen-mp-usage]
!$omp target exit data map(delete:B)
!$omp end target
deallocate(B)
@ -53,7 +53,7 @@ program main
n1 = 10
n2 = 10
!$omp target teams map(to:a)
!PORTABILITY: If TARGET DATA directive is nested inside TARGET region, the behaviour is unspecified
!PORTABILITY: If TARGET DATA directive is nested inside TARGET region, the behaviour is unspecified [-Wopen-mp-usage]
!ERROR: Only `DISTRIBUTE`, `PARALLEL`, or `LOOP` regions are allowed to be strictly nested inside `TEAMS` region.
!$omp target data map(n1,n2)
do i=1, n1
@ -65,7 +65,7 @@ program main
!$omp end target teams
!$omp target teams map(to:a) map(from:n1,n2)
!PORTABILITY: If TARGET TEAMS DISTRIBUTE PARALLEL DO directive is nested inside TARGET region, the behaviour is unspecified
!PORTABILITY: If TARGET TEAMS DISTRIBUTE PARALLEL DO directive is nested inside TARGET region, the behaviour is unspecified [-Wopen-mp-usage]
!ERROR: Only `DISTRIBUTE`, `PARALLEL`, or `LOOP` regions are allowed to be strictly nested inside `TEAMS` region.
!$omp target teams distribute parallel do
do i=1, n1

View File

@ -6,7 +6,7 @@
subroutine f
integer, save :: x
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
!$omp declare target to(x) device_type(nohost)
!$omp declare target enter(x) device_type(nohost)
end subroutine f

View File

@ -5,7 +5,7 @@
! device constructs, such as declare target with 'to' clause and no device_type.
subroutine f
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
!$omp declare target to(f)
!$omp declare target enter(f)
end subroutine f

View File

@ -39,7 +39,7 @@ subroutine omp_single
!$omp single private(j) copyprivate(j)
print *, "omp single", j
!ERROR: COPYPRIVATE variable 'j' may not appear on a PRIVATE or FIRSTPRIVATE clause on a SINGLE construct
!WARNING: The COPYPRIVATE clause with 'j' is already used on the SINGLE directive
!WARNING: The COPYPRIVATE clause with 'j' is already used on the SINGLE directive [-Wopen-mp-usage]
!$omp end single copyprivate(j)
!$omp single nowait

View File

@ -52,20 +52,20 @@ program single
!ERROR: NOWAIT clause must not be used with COPYPRIVATE clause on the SINGLE directive
!$omp single copyprivate(x) nowait
print *, x
!WARNING: The COPYPRIVATE clause with 'x' is already used on the SINGLE directive
!WARNING: The COPYPRIVATE clause with 'x' is already used on the SINGLE directive [-Wopen-mp-usage]
!ERROR: At most one NOWAIT clause can appear on the SINGLE directive
!$omp end single copyprivate(x) nowait
!$omp single copyprivate(x)
print *, x
!WARNING: The COPYPRIVATE clause with 'x' is already used on the SINGLE directive
!WARNING: The COPYPRIVATE clause with 'x' is already used on the SINGLE directive [-Wopen-mp-usage]
!ERROR: NOWAIT clause must not be used with COPYPRIVATE clause on the SINGLE directive
!$omp end single copyprivate(x) nowait
!ERROR: NOWAIT clause must not be used with COPYPRIVATE clause on the SINGLE directive
!$omp single copyprivate(x, y) nowait
print *, x
!WARNING: The COPYPRIVATE clause with 'x' is already used on the SINGLE directive
!WARNING: The COPYPRIVATE clause with 'x' is already used on the SINGLE directive [-Wopen-mp-usage]
!ERROR: 'z' appears in more than one COPYPRIVATE clause on the END SINGLE directive
!ERROR: At most one NOWAIT clause can appear on the SINGLE directive
!$omp end single copyprivate(x, z) copyprivate(z) nowait
@ -73,9 +73,9 @@ program single
!ERROR: NOWAIT clause must not be used with COPYPRIVATE clause on the SINGLE directive
!$omp single copyprivate(x) nowait copyprivate(y) copyprivate(z)
print *, x
!WARNING: The COPYPRIVATE clause with 'x' is already used on the SINGLE directive
!WARNING: The COPYPRIVATE clause with 'y' is already used on the SINGLE directive
!WARNING: The COPYPRIVATE clause with 'z' is already used on the SINGLE directive
!WARNING: The COPYPRIVATE clause with 'x' is already used on the SINGLE directive [-Wopen-mp-usage]
!WARNING: The COPYPRIVATE clause with 'y' is already used on the SINGLE directive [-Wopen-mp-usage]
!WARNING: The COPYPRIVATE clause with 'z' is already used on the SINGLE directive [-Wopen-mp-usage]
!ERROR: At most one NOWAIT clause can appear on the SINGLE directive
!$omp end single copyprivate(x, y, z) nowait
end program

View File

@ -39,19 +39,19 @@ subroutine bar(b1, b2, b3)
type(c_ptr), pointer :: b2
type(c_ptr), value :: b3
!WARNING: Variable 'c' in IS_DEVICE_PTR clause must be a dummy argument. This semantic check is deprecated from OpenMP 5.2 and later.
!WARNING: Variable 'c' in IS_DEVICE_PTR clause must be a dummy argument. This semantic check is deprecated from OpenMP 5.2 and later. [-Wopen-mp-usage]
!$omp target is_device_ptr(c)
y = y + 1
!$omp end target
!WARNING: Variable 'b1' in IS_DEVICE_PTR clause must be a dummy argument that does not have the ALLOCATABLE, POINTER or VALUE attribute. This semantic check is deprecated from OpenMP 5.2 and later.
!WARNING: Variable 'b1' in IS_DEVICE_PTR clause must be a dummy argument that does not have the ALLOCATABLE, POINTER or VALUE attribute. This semantic check is deprecated from OpenMP 5.2 and later. [-Wopen-mp-usage]
!$omp target is_device_ptr(b1)
y = y + 1
!$omp end target
!WARNING: Variable 'b2' in IS_DEVICE_PTR clause must be a dummy argument that does not have the ALLOCATABLE, POINTER or VALUE attribute. This semantic check is deprecated from OpenMP 5.2 and later.
!WARNING: Variable 'b2' in IS_DEVICE_PTR clause must be a dummy argument that does not have the ALLOCATABLE, POINTER or VALUE attribute. This semantic check is deprecated from OpenMP 5.2 and later. [-Wopen-mp-usage]
!$omp target is_device_ptr(b2)
y = y + 1
!$omp end target
!WARNING: Variable 'b3' in IS_DEVICE_PTR clause must be a dummy argument that does not have the ALLOCATABLE, POINTER or VALUE attribute. This semantic check is deprecated from OpenMP 5.2 and later.
!WARNING: Variable 'b3' in IS_DEVICE_PTR clause must be a dummy argument that does not have the ALLOCATABLE, POINTER or VALUE attribute. This semantic check is deprecated from OpenMP 5.2 and later. [-Wopen-mp-usage]
!$omp target is_device_ptr(b3)
y = y + 1
!$omp end target

View File

@ -13,7 +13,7 @@ program main
!ERROR: The module name or main program name cannot be in a THREADPRIVATE directive
!$omp threadprivate(mod1)
!PORTABILITY: Name 'main' declared in a main program should not have the same name as the main program
!PORTABILITY: Name 'main' declared in a main program should not have the same name as the main program [-Wbenign-name-clash]
!ERROR: The module name or main program name cannot be in a THREADPRIVATE directive
!$omp threadprivate(main)

View File

@ -27,7 +27,7 @@ subroutine omp_target_data
a = arrayB
!$omp end target data
!WARNING: Use of non-C_PTR type 'a' in USE_DEVICE_PTR is deprecated, use USE_DEVICE_ADDR instead
!WARNING: Use of non-C_PTR type 'a' in USE_DEVICE_PTR is deprecated, use USE_DEVICE_ADDR instead [-Wopen-mp-usage]
!$omp target data map(tofrom: a) use_device_ptr(a)
a = 2
!$omp end target data

View File

@ -85,9 +85,9 @@ subroutine C946(param_ca_4_assumed, param_ta_4_assumed, param_ca_4_deferred)
allocate(deferredChar, source="abcd")
allocate(deferredChar, mold=deferredChar)
!PORTABILITY: Character length of allocatable object in ALLOCATE should be the same as the SOURCE or MOLD
!PORTABILITY: Character length of allocatable object in ALLOCATE should be the same as the SOURCE or MOLD [-Wallocate-to-other-length]
allocate(char2, source="a")
!PORTABILITY: Character length of allocatable object in ALLOCATE should be the same as the SOURCE or MOLD
!PORTABILITY: Character length of allocatable object in ALLOCATE should be the same as the SOURCE or MOLD [-Wallocate-to-other-length]
allocate(char2, source="abc")
allocate(char2, mold=deferredChar)

View File

@ -113,7 +113,7 @@ program main
!ERROR: Actual procedure argument has interface incompatible with dummy argument 's=': incompatible dummy argument #1: incompatible dummy data object shapes
call s8c(s7)
call s8c(s8)
!WARNING: Actual procedure argument has possible interface incompatibility with dummy argument 's=': possibly incompatible dummy argument #1: distinct dummy data object shapes
!WARNING: Actual procedure argument has possible interface incompatibility with dummy argument 's=': possibly incompatible dummy argument #1: distinct dummy data object shapes [-Wproc-dummy-arg-shapes]
call s8c(s8b)
call s9c(s9)
call s9c(s9b)
@ -154,7 +154,7 @@ program main
!ERROR: Procedure pointer 'ps7' associated with incompatible procedure designator 's8': incompatible dummy argument #1: incompatible dummy data object shapes
ps7 => s8
ps8 => s8
!WARNING: pointer 'ps8' and s8b may not be completely compatible procedures: possibly incompatible dummy argument #1: distinct dummy data object shapes
!WARNING: pointer 'ps8' and s8b may not be completely compatible procedures: possibly incompatible dummy argument #1: distinct dummy data object shapes [-Wproc-dummy-arg-shapes]
ps8 => s8b
!ERROR: Procedure pointer 'ps8' associated with incompatible procedure designator 's6': incompatible dummy argument #1: incompatible dummy data object shapes
ps8 => s6

View File

@ -85,7 +85,7 @@ contains
real, pointer, volatile :: q
p => x
!ERROR: Pointer must be VOLATILE when target is a VOLATILE coarray
!ERROR: VOLATILE target associated with non-VOLATILE pointer
!ERROR: VOLATILE target associated with non-VOLATILE pointer [-Wnon-volatile-pointer-to-volatile]
p => y
!ERROR: Pointer may not be VOLATILE when target is a non-VOLATILE coarray
q => x
@ -175,7 +175,7 @@ contains
real, volatile, target :: x
real, pointer :: p
real, pointer, volatile :: q
!ERROR: VOLATILE target associated with non-VOLATILE pointer
!ERROR: VOLATILE target associated with non-VOLATILE pointer [-Wnon-volatile-pointer-to-volatile]
p => x
q => x
end
@ -188,11 +188,11 @@ contains
real, pointer, volatile :: q1
type(t2), pointer, volatile :: q2
type(t3), pointer, volatile :: q3
!ERROR: VOLATILE target associated with non-VOLATILE pointer
!ERROR: VOLATILE target associated with non-VOLATILE pointer [-Wnon-volatile-pointer-to-volatile]
p1 => y%t3Field%t2Field
!ERROR: VOLATILE target associated with non-VOLATILE pointer
!ERROR: VOLATILE target associated with non-VOLATILE pointer [-Wnon-volatile-pointer-to-volatile]
p2 => y%t3Field
!ERROR: VOLATILE target associated with non-VOLATILE pointer
!ERROR: VOLATILE target associated with non-VOLATILE pointer [-Wnon-volatile-pointer-to-volatile]
p3 => y
!OK:
q1 => y%t3Field%t2Field
@ -200,9 +200,9 @@ contains
q2 => y%t3Field
!OK:
q3 => y
!ERROR: VOLATILE target associated with non-VOLATILE pointer
!ERROR: VOLATILE target associated with non-VOLATILE pointer [-Wnon-volatile-pointer-to-volatile]
p3%t3FieldPtr => y%t3Field
!ERROR: VOLATILE target associated with non-VOLATILE pointer
!ERROR: VOLATILE target associated with non-VOLATILE pointer [-Wnon-volatile-pointer-to-volatile]
p3%t3FieldPtr%t2FieldPtr => y%t3Field%t2Field
!OK
q3%t3FieldPtr => y%t3Field

View File

@ -49,9 +49,9 @@ program test
realToRealProcPtr => noInterfaceExternal ! ok
intToRealProcPtr => noInterfaceExternal !ok
call sub1(noInterfaceExternal) ! ok
!WARNING: Actual procedure argument has an implicit interface which is not known to be compatible with dummy argument 'p=' which has an explicit interface
!WARNING: Actual procedure argument has an implicit interface which is not known to be compatible with dummy argument 'p=' which has an explicit interface [-Wimplicit-interface-actual]
call sub2(noInterfaceExternal)
!WARNING: Actual procedure argument has an implicit interface which is not known to be compatible with dummy argument 'p=' which has an explicit interface
!WARNING: Actual procedure argument has an implicit interface which is not known to be compatible with dummy argument 'p=' which has an explicit interface [-Wimplicit-interface-actual]
call sub3(noInterfaceExternal)
!ERROR: Procedure pointer 'nointerfaceprocptr' with implicit interface may not be associated with procedure designator 'userelemental' with explicit interface that cannot be called via an implicit interface

View File

@ -13,7 +13,7 @@ module m1
function iptr(n)
integer, intent(in), target :: n
integer, pointer :: iptr
!WARNING: Pointer target is not a definable variable
!WARNING: Pointer target is not a definable variable [-Wpointer-to-undefinable]
!BECAUSE: 'n' is an INTENT(IN) dummy argument
iptr => n
end function

View File

@ -123,15 +123,15 @@ subroutine assoc()
lVar = associated(null(intAllocVar))
lVar = associated(null()) !OK
lVar = associated(null(intPointerVar1)) !OK
!PORTABILITY: POINTER= argument of ASSOCIATED() is required by some other compilers to be a valid left-hand side of a pointer assignment statement
!PORTABILITY: POINTER= argument of ASSOCIATED() is required by some other compilers to be a valid left-hand side of a pointer assignment statement [-Wportability]
!BECAUSE: 'NULL()' is a null pointer
lVar = associated(null(), null()) !OK
lVar = associated(intPointerVar1, null(intPointerVar2)) !OK
lVar = associated(intPointerVar1, null()) !OK
!PORTABILITY: POINTER= argument of ASSOCIATED() is required by some other compilers to be a valid left-hand side of a pointer assignment statement
!PORTABILITY: POINTER= argument of ASSOCIATED() is required by some other compilers to be a valid left-hand side of a pointer assignment statement [-Wportability]
!BECAUSE: 'NULL()' is a null pointer
lVar = associated(null(), null(intPointerVar1)) !OK
!PORTABILITY: POINTER= argument of ASSOCIATED() is required by some other compilers to be a pointer
!PORTABILITY: POINTER= argument of ASSOCIATED() is required by some other compilers to be a pointer [-Wportability]
lVar = associated(null(intPointerVar1), null()) !OK
!ERROR: POINTER= argument of ASSOCIATED() must be a pointer
lVar = associated(intVar)
@ -180,18 +180,18 @@ subroutine assoc()
! Functions (other than NULL) returning pointers
lVar = associated(objPtrFunc(targetIntVar1)) ! ok
!PORTABILITY: POINTER= argument of ASSOCIATED() is required by some other compilers to be a pointer
!PORTABILITY: POINTER= argument of ASSOCIATED() is required by some other compilers to be a pointer [-Wportability]
lVar = associated(objPtrFunc(targetIntVar1), targetIntVar1) ! ok
!PORTABILITY: POINTER= argument of ASSOCIATED() is required by some other compilers to be a pointer
!PORTABILITY: POINTER= argument of ASSOCIATED() is required by some other compilers to be a pointer [-Wportability]
lVar = associated(objPtrFunc(targetIntVar1), objPtrFunc(targetIntVar1)) ! ok
lVar = associated(procPtrFunc()) ! ok
lVar = associated(procPtrFunc(), intFunc) ! ok
lVar = associated(procPtrFunc(), procPtrFunc()) ! ok
!ERROR: POINTER= argument 'objptrfunc(targetintvar1)' is an object pointer but the TARGET= argument 'intfunc' is not a variable
!PORTABILITY: POINTER= argument of ASSOCIATED() is required by some other compilers to be a pointer
!PORTABILITY: POINTER= argument of ASSOCIATED() is required by some other compilers to be a pointer [-Wportability]
lVar = associated(objPtrFunc(targetIntVar1), intFunc)
!ERROR: POINTER= argument 'objptrfunc(targetintvar1)' is an object pointer but the TARGET= argument 'procptrfunc()' is not a variable
!PORTABILITY: POINTER= argument of ASSOCIATED() is required by some other compilers to be a pointer
!PORTABILITY: POINTER= argument of ASSOCIATED() is required by some other compilers to be a pointer [-Wportability]
lVar = associated(objPtrFunc(targetIntVar1), procPtrFunc())
!ERROR: POINTER= argument 'procptrfunc()' is a procedure pointer but the TARGET= argument 'objptrfunc(targetintvar1)' is not a procedure or procedure pointer
lVar = associated(procPtrFunc(), objPtrFunc(targetIntVar1))

View File

@ -19,8 +19,8 @@ module m
!ERROR: Only variable and named common block can be in BIND statement
bind(c) :: sub
!PORTABILITY: Global name 'm' conflicts with a module
!PORTABILITY: Name 'm' declared in a module should not have the same name as the module
!PORTABILITY: Global name 'm' conflicts with a module [-Wbenign-name-clash]
!PORTABILITY: Name 'm' declared in a module should not have the same name as the module [-Wbenign-name-clash]
bind(c) :: m ! no error for implicit type variable
type my_type

View File

@ -37,7 +37,7 @@ subroutine sub(x, y)
procedure(proc), bind(c) :: y
!WARNING: Attribute 'BIND(C)' cannot be used more than once
!WARNING: Attribute 'BIND(C)' cannot be used more than once [-Wredundant-attribute]
!ERROR: A procedure pointer may not have a BIND attribute with a name
procedure(proc), bind(c, name="pc8"), bind(c), pointer :: pc8

View File

@ -40,7 +40,7 @@ program main
procedure, nopass :: b => s
end type
! WARNING: A derived type with the BIND attribute should not be empty
! WARNING: A derived type with the BIND attribute should not be empty [-Wempty-bind-c-derived-type]
type, bind(c) :: t5
end type
@ -71,7 +71,7 @@ program main
end type
type, bind(c) :: t10
!WARNING: A CHARACTER component of an interoperable type should have length 1
!WARNING: A CHARACTER component of an interoperable type should have length 1 [-Wbind-c-char-length]
character(len=2) x
end type
type, bind(c) :: t11
@ -79,7 +79,7 @@ program main
character(kind=2) x
end type
type, bind(c) :: t12
!PORTABILITY: A LOGICAL component of an interoperable type should have the interoperable KIND=C_BOOL
!PORTABILITY: A LOGICAL component of an interoperable type should have the interoperable KIND=C_BOOL [-Wlogical-vs-c-bool]
logical(kind=8) x
end type
type, bind(c) :: t13

View File

@ -8,7 +8,7 @@ module m
real, allocatable, bind(c) :: x3(:)
contains
subroutine s1(x) bind(c)
!PORTABILITY: A BIND(C) LOGICAL dummy argument should have the interoperable KIND=C_BOOL
!PORTABILITY: A BIND(C) LOGICAL dummy argument should have the interoperable KIND=C_BOOL [-Wlogical-vs-c-bool]
logical(2), intent(in), value :: x
end
subroutine s2(x) bind(c)

View File

@ -5,8 +5,8 @@ subroutine interop(ptr,ashape,arank,eshape,asize) bind(c)
real, pointer, contiguous :: ptr(:)
real, contiguous :: ashape(:) ! ok
real, contiguous :: arank(..) ! ok
!PORTABILITY: CONTIGUOUS entity 'eshape' should be an array pointer, assumed-shape, or assumed-rank
!PORTABILITY: CONTIGUOUS entity 'eshape' should be an array pointer, assumed-shape, or assumed-rank [-Wredundant-contiguous]
real, contiguous :: eshape(10)
!PORTABILITY: CONTIGUOUS entity 'asize' should be an array pointer, assumed-shape, or assumed-rank
!PORTABILITY: CONTIGUOUS entity 'asize' should be an array pointer, assumed-shape, or assumed-rank [-Wredundant-contiguous]
real, contiguous :: asize(*)
end

View File

@ -4,7 +4,7 @@ module m
end type
contains
subroutine sub(x) bind(c)
!PORTABILITY: The derived type of this interoperable object should be BIND(C)
!PORTABILITY: The derived type of this interoperable object should be BIND(C) [-Wportability]
type(a), pointer, intent(in) :: x
end
end

View File

@ -4,7 +4,7 @@
module m
!ERROR: An ABSTRACT derived type must be extensible
!PORTABILITY: A derived type with the BIND attribute should not be empty
!PORTABILITY: A derived type with the BIND attribute should not be empty [-Wempty-bind-c-derived-type]
type, abstract, bind(c) :: badAbstract1
end type
!ERROR: An ABSTRACT derived type must be extensible
@ -45,7 +45,7 @@ module m
end type
type, extends(intermediate) :: concrete2 ! ensure no false missing binding error
end type
!WARNING: A derived type with the BIND attribute should not be empty
!WARNING: A derived type with the BIND attribute should not be empty [-Wempty-bind-c-derived-type]
type, bind(c) :: inextensible1
end type
!ERROR: The parent type is not extensible
@ -226,7 +226,7 @@ module m8 ! C1529 - warning only
end subroutine
subroutine test
type(t) a(2)
!PORTABILITY: Base of NOPASS type-bound procedure reference should be scalar
!PORTABILITY: Base of NOPASS type-bound procedure reference should be scalar [-Wnopass-scalar-base]
call a%tbp
!ERROR: Base of procedure component reference must be scalar
call a%pp

View File

@ -15,9 +15,9 @@ program test
use m
procedure(sub), pointer :: p
type(t) x
!PORTABILITY: Procedure binding 'sub' used as target of a pointer assignment
!PORTABILITY: Procedure binding 'sub' used as target of a pointer assignment [-Wbinding-as-procedure]
p => x%sub
!PORTABILITY: Procedure binding 'sub' passed as an actual argument
!PORTABILITY: Procedure binding 'sub' passed as an actual argument [-Wbinding-as-procedure]
call sub2(x%sub)
contains
subroutine sub2(s)

View File

@ -7,7 +7,7 @@ block data foo
!ERROR: An initialized variable in BLOCK DATA must be in a COMMON block
integer :: notInCommon = 1
integer :: uninitialized ! ok
!PORTABILITY: Procedure pointer 'q' should not have an ELEMENTAL intrinsic as its interface
!PORTABILITY: Procedure pointer 'q' should not have an ELEMENTAL intrinsic as its interface [-Wportability]
!ERROR: 'q' may not appear in a BLOCK DATA subprogram
procedure(sin), pointer :: q => cos
!ERROR: 'p' may not be a procedure as it is in a COMMON block

View File

@ -56,7 +56,7 @@ subroutine bozchecks
res = CMPLX (realpart, img, 4)
res = CMPLX (B"0101", B"1111", 4)
!WARNING: underflow on REAL(8) to REAL(4) conversion
!WARNING: underflow on REAL(8) to REAL(4) conversion [-Wfolding-exception]
dbl = DBLE(B"1111")
dbl = DBLE(realpart)

View File

@ -33,9 +33,9 @@ program p
use m
type(foo) x
x = foo(); print *, x ! ok, not ambiguous
!PORTABILITY: Reference to generic function 'foo' (resolving to specific 'bar0') is ambiguous with a structure constructor of the same name
!PORTABILITY: Reference to generic function 'foo' (resolving to specific 'bar0') is ambiguous with a structure constructor of the same name [-Wambiguous-structure-constructor]
x = foo(2); print *, x ! ambigous
!PORTABILITY: Reference to generic function 'foo' (resolving to specific 'bar2') is ambiguous with a structure constructor of the same name
!PORTABILITY: Reference to generic function 'foo' (resolving to specific 'bar2') is ambiguous with a structure constructor of the same name [-Wambiguous-structure-constructor]
x = foo(3.); print *, x ! ambiguous due to data conversion
x = foo(.true.); print *, x ! ok, not ambigous
end

View File

@ -46,12 +46,12 @@ program test
call c_f_pointer(scalarC, multiDimIntF, shape=[1_8])
!ERROR: SHAPE= argument to C_F_POINTER() must be a rank-one array.
call c_f_pointer(scalarC, multiDimIntF, shape=rankTwoArray)
!WARNING: FPTR= argument to C_F_POINTER() should not be unlimited polymorphic
!WARNING: FPTR= argument to C_F_POINTER() should not be unlimited polymorphic [-Winteroperability]
call c_f_pointer(scalarC, unlimited)
!PORTABILITY: FPTR= argument to C_F_POINTER() should not have a derived type that is not BIND(C)
!PORTABILITY: FPTR= argument to C_F_POINTER() should not have a derived type that is not BIND(C) [-Wportability]
call c_f_pointer(scalarC, notBindC)
!WARNING: FPTR= argument to C_F_POINTER() should not have the non-interoperable character length CHARACTER(KIND=1,LEN=2_8)
!WARNING: FPTR= argument to C_F_POINTER() should not have the non-interoperable character length CHARACTER(KIND=1,LEN=2_8) [-Wcharacter-interoperability]
call c_f_pointer(scalarC, c2ptr)
!WARNING: FPTR= argument to C_F_POINTER() should not have the non-interoperable intrinsic type or kind CHARACTER(KIND=4,LEN=1_8)
!WARNING: FPTR= argument to C_F_POINTER() should not have the non-interoperable intrinsic type or kind CHARACTER(KIND=4,LEN=1_8) [-Winteroperability]
call c_f_pointer(scalarC, unicodePtr)
end program

View File

@ -14,7 +14,7 @@ module m
type(c_ptr) cp
type(c_funptr) cfp
real notATarget
!PORTABILITY: Procedure pointer 'pptr' should not have an ELEMENTAL intrinsic as its interface
!PORTABILITY: Procedure pointer 'pptr' should not have an ELEMENTAL intrinsic as its interface [-Wportability]
procedure(sin), pointer :: pptr
real, target :: arr(3)
type(hasLen(1)), target :: clen
@ -41,9 +41,9 @@ module m
cp = c_loc(nclen)
!ERROR: C_LOC() argument may not be zero-length character
cp = c_loc(ch(2:1))
!WARNING: C_LOC() argument has non-interoperable character length
!WARNING: C_LOC() argument has non-interoperable character length [-Wcharacter-interoperability]
cp = c_loc(ch)
!WARNING: C_LOC() argument has non-interoperable intrinsic type or kind
!WARNING: C_LOC() argument has non-interoperable intrinsic type or kind [-Winteroperability]
cp = c_loc(unicode)
cp = c_loc(ch(1:1)) ! ok
cp = c_loc(deferred) ! ok

View File

@ -119,16 +119,16 @@ function f14(n) result(res)
end function
subroutine s01(f1, f2, fp1, fp2, fp3)
!PORTABILITY: A dummy procedure pointer should not have assumed-length CHARACTER(*) result type
!PORTABILITY: A dummy procedure pointer should not have assumed-length CHARACTER(*) result type [-Wportability]
character*(*) :: f1, f3, fp1
external :: f1, f3
pointer :: fp1, fp3
!PORTABILITY: A dummy procedure pointer should not have assumed-length CHARACTER(*) result type
!PORTABILITY: A dummy procedure pointer should not have assumed-length CHARACTER(*) result type [-Wportability]
procedure(character*(*)), pointer :: fp2
interface
character*(*) function f2()
end function
!PORTABILITY: A dummy procedure pointer should not have assumed-length CHARACTER(*) result type
!PORTABILITY: A dummy procedure pointer should not have assumed-length CHARACTER(*) result type [-Wportability]
character*(*) function fp3()
end function
!ERROR: A function interface may not declare an assumed-length CHARACTER(*) result

View File

@ -8,7 +8,7 @@ subroutine s01(elem, subr)
real, intent(in), value :: x
end function
subroutine subr(dummy)
!PORTABILITY: A dummy procedure should not have an ELEMENTAL intrinsic as its interface
!PORTABILITY: A dummy procedure should not have an ELEMENTAL intrinsic as its interface [-Wportability]
procedure(sin) :: dummy
end subroutine
subroutine badsubr(dummy)
@ -17,11 +17,11 @@ subroutine s01(elem, subr)
procedure(elem) :: dummy
end subroutine
subroutine optionalsubr(dummy)
!PORTABILITY: A dummy procedure should not have an ELEMENTAL intrinsic as its interface
!PORTABILITY: A dummy procedure should not have an ELEMENTAL intrinsic as its interface [-Wportability]
procedure(sin), optional :: dummy
end subroutine
subroutine ptrsubr(dummy)
!PORTABILITY: A dummy procedure should not have an ELEMENTAL intrinsic as its interface
!PORTABILITY: A dummy procedure should not have an ELEMENTAL intrinsic as its interface [-Wportability]
procedure(sin), pointer, intent(in) :: dummy
end subroutine
end interface

View File

@ -163,9 +163,9 @@ module m01
type(pdtWithDefault(3)) :: defaultVar3
type(pdtWithDefault(4)) :: defaultVar4
character :: ch1
!ERROR: Actual argument variable length '1' is less than expected length '2'
!ERROR: Actual argument variable length '1' is less than expected length '2' [-Wshort-character-actual]
call ch2(ch1)
!WARNING: Actual argument expression length '0' is less than expected length '2'
!WARNING: Actual argument expression length '0' is less than expected length '2' [-Wshort-character-actual]
call ch2("")
call pdtdefault(vardefault)
!ERROR: Actual argument type 'pdt(n=3_4)' is not compatible with dummy argument type 'pdt'
@ -300,10 +300,10 @@ module m01
!ERROR: Actual argument associated with INTENT(IN OUT) dummy argument 'x=' is not definable
!BECAUSE: Variable 'a(int(j,kind=8))' has a vector subscript
call intentinout_arr(a(j))
!WARNING: Actual argument associated with ASYNCHRONOUS dummy argument 'x=' is not definable
!WARNING: Actual argument associated with ASYNCHRONOUS dummy argument 'x=' is not definable [-Wundefinable-asynchronous-or-volatile-actual]
!BECAUSE: Variable 'a(int(j,kind=8))' has a vector subscript
call asynchronous_arr(a(j))
!WARNING: Actual argument associated with VOLATILE dummy argument 'x=' is not definable
!WARNING: Actual argument associated with VOLATILE dummy argument 'x=' is not definable [-Wundefinable-asynchronous-or-volatile-actual]
!BECAUSE: Variable 'a(int(j,kind=8))' has a vector subscript
call volatile_arr(a(j))
end subroutine
@ -386,9 +386,9 @@ module m01
call contiguous(a) ! ok
call pointer(a) ! ok
call pointer(b) ! ok
!ERROR: VOLATILE target associated with non-VOLATILE pointer
!ERROR: VOLATILE target associated with non-VOLATILE pointer [-Wnon-volatile-pointer-to-volatile]
call pointer(c) ! ok
!ERROR: VOLATILE target associated with non-VOLATILE pointer
!ERROR: VOLATILE target associated with non-VOLATILE pointer [-Wnon-volatile-pointer-to-volatile]
call pointer(d) ! ok
call valueassumedsize(a) ! ok
call valueassumedsize(b) ! ok

View File

@ -73,9 +73,9 @@ module m
call sma(ma) ! ok
call spp(pp) ! ok
call spa(pa) ! ok
!PORTABILITY: If a POINTER or ALLOCATABLE actual argument is polymorphic, the corresponding dummy argument should also be so
!PORTABILITY: If a POINTER or ALLOCATABLE actual argument is polymorphic, the corresponding dummy argument should also be so [-Wpolymorphic-actual-allocatable-or-pointer-to-monomorphic-dummy]
call smp(pp)
!PORTABILITY: If a POINTER or ALLOCATABLE actual argument is polymorphic, the corresponding dummy argument should also be so
!PORTABILITY: If a POINTER or ALLOCATABLE actual argument is polymorphic, the corresponding dummy argument should also be so [-Wpolymorphic-actual-allocatable-or-pointer-to-monomorphic-dummy]
call sma(pa)
!ERROR: If a POINTER or ALLOCATABLE dummy or actual argument is polymorphic, both must be so
call spp(mp)

View File

@ -19,17 +19,17 @@ module m
end subroutine
subroutine test
!PORTABILITY: CONTIGUOUS entity 'a01' should be an array pointer, assumed-shape, or assumed-rank
!PORTABILITY: CONTIGUOUS entity 'a01' should be an array pointer, assumed-shape, or assumed-rank [-Wredundant-contiguous]
real, pointer, contiguous :: a01 ! C830
real, pointer :: a02(:)
real, target :: a03(10)
real :: a04(10) ! not TARGET
!PORTABILITY: CONTIGUOUS entity 'scalar' should be an array pointer, assumed-shape, or assumed-rank
!PORTABILITY: CONTIGUOUS entity 'scalar' should be an array pointer, assumed-shape, or assumed-rank [-Wredundant-contiguous]
real, contiguous :: scalar
call s01(a03) ! ok
!ERROR: CONTIGUOUS pointer dummy argument may not be associated with non-CONTIGUOUS pointer actual argument
call s01(a02)
!WARNING: Target of CONTIGUOUS pointer association is not known to be contiguous
!WARNING: Target of CONTIGUOUS pointer association is not known to be contiguous [-Wpointer-to-possible-noncontiguous]
call s01(a02(:))
!ERROR: CONTIGUOUS pointer may not be associated with a discontiguous target
call s01(a03(::2))

View File

@ -37,7 +37,7 @@ module m
end subroutine
subroutine selemental1(p)
!PORTABILITY: A dummy procedure should not have an ELEMENTAL intrinsic as its interface
!PORTABILITY: A dummy procedure should not have an ELEMENTAL intrinsic as its interface [-Wportability]
procedure(cos) :: p ! ok
end subroutine

View File

@ -62,7 +62,7 @@ module m
real, pointer :: a ! ok
end function
pure real function f04(a) ! C1583
!WARNING: non-POINTER dummy argument of pure function should be INTENT(IN) or VALUE
!WARNING: non-POINTER dummy argument of pure function should be INTENT(IN) or VALUE [-Wrelaxed-pure-dummy]
real, intent(out) :: a
end function
pure real function f04a(a)

View File

@ -9,7 +9,7 @@ module m
!ERROR: VALUE attribute may apply only to a dummy data object
subroutine C863(notData,assumedSize,coarray,coarrayComponent,assumedRank,assumedLen)
external :: notData
!WARNING: Only a dummy argument should have an INTENT, VALUE, or OPTIONAL attribute
!WARNING: Only a dummy argument should have an INTENT, VALUE, or OPTIONAL attribute [-Wignore-irrelevant-attributes]
real, value :: notADummy
value :: notData
!ERROR: VALUE attribute may not apply to an assumed-size array
@ -20,7 +20,7 @@ module m
type(hasCoarray), value :: coarrayComponent
!ERROR: VALUE attribute may not apply to an assumed-rank array
real, value :: assumedRank(..)
!PORTABILITY: VALUE attribute on assumed-length CHARACTER may not be portable
!PORTABILITY: VALUE attribute on assumed-length CHARACTER may not be portable [-Wportability]
character(*), value :: assumedLen
end subroutine
subroutine C864(allocatable, inout, out, pointer, volatile)

View File

@ -38,7 +38,7 @@ subroutine test()
!ERROR: References to the procedure 'bar' require an explicit interface
!BECAUSE: a dummy procedure is optional or a pointer
!WARNING: If the procedure's interface were explicit, this reference would be in error
!WARNING: If the procedure's interface were explicit, this reference would be in error [-Wknown-bad-implicit-interface]
!BECAUSE: Actual argument associated with procedure pointer dummy argument 'a_pointer=' is not a procedure pointer
call bar(sin)

View File

@ -4,9 +4,9 @@ program test
real, allocatable :: a
!ERROR: NULL() actual argument 'NULL()' may not be associated with allocatable dummy argument dummy argument 'a=' that is INTENT(OUT) or INTENT(IN OUT)
call foo0(null())
!WARNING: NULL() actual argument 'NULL()' should not be associated with allocatable dummy argument dummy argument 'a=' without INTENT(IN)
!WARNING: NULL() actual argument 'NULL()' should not be associated with allocatable dummy argument dummy argument 'a=' without INTENT(IN) [-Wnull-actual-for-default-intent-allocatable]
call foo1(null())
!PORTABILITY: Allocatable dummy argument 'a=' is associated with NULL()
!PORTABILITY: Allocatable dummy argument 'a=' is associated with NULL() [-Wnull-actual-for-allocatable]
call foo2(null())
call foo3(null()) ! ok
!ERROR: Actual argument associated with INTENT(IN OUT) dummy argument 'a=' is not definable

View File

@ -23,49 +23,49 @@ module m
end subroutine vol_dum_int_arr
subroutine test_all_subprograms()
!WARNING: Actual argument associated with VOLATILE dummy argument 'my_int=' is not definable
!WARNING: Actual argument associated with VOLATILE dummy argument 'my_int=' is not definable [-Wundefinable-asynchronous-or-volatile-actual]
!BECAUSE: '6_4' is not a variable or pointer
call vol_dum_int(6)
!WARNING: Actual argument associated with VOLATILE dummy argument 'my_int=' is not definable
!WARNING: Actual argument associated with VOLATILE dummy argument 'my_int=' is not definable [-Wundefinable-asynchronous-or-volatile-actual]
!BECAUSE: '18_4' is not a variable or pointer
call vol_dum_int(6+12)
!WARNING: Actual argument associated with VOLATILE dummy argument 'my_int=' is not definable
!WARNING: Actual argument associated with VOLATILE dummy argument 'my_int=' is not definable [-Wundefinable-asynchronous-or-volatile-actual]
!BECAUSE: '72_4' is not a variable or pointer
call vol_dum_int(6*12)
!WARNING: Actual argument associated with VOLATILE dummy argument 'my_int=' is not definable
!WARNING: Actual argument associated with VOLATILE dummy argument 'my_int=' is not definable [-Wundefinable-asynchronous-or-volatile-actual]
!BECAUSE: '-3_4' is not a variable or pointer
call vol_dum_int(-6/2)
!WARNING: Actual argument associated with VOLATILE dummy argument 'my_real=' is not definable
!WARNING: Actual argument associated with VOLATILE dummy argument 'my_real=' is not definable [-Wundefinable-asynchronous-or-volatile-actual]
!BECAUSE: '3.1415927410125732421875_4' is not a variable or pointer
call vol_dum_real(3.141592653)
!WARNING: Actual argument associated with VOLATILE dummy argument 'my_real=' is not definable
!WARNING: Actual argument associated with VOLATILE dummy argument 'my_real=' is not definable [-Wundefinable-asynchronous-or-volatile-actual]
!BECAUSE: '3.1415927410125732421875_4' is not a variable or pointer
call vol_dum_real(3.141592653 + (-10.6e-11))
!WARNING: Actual argument associated with VOLATILE dummy argument 'my_real=' is not definable
!WARNING: Actual argument associated with VOLATILE dummy argument 'my_real=' is not definable [-Wundefinable-asynchronous-or-volatile-actual]
!BECAUSE: '3.3300884272335906644002534449100494384765625e-10_4' is not a variable or pointer
call vol_dum_real(3.141592653 * 10.6e-11)
!WARNING: Actual argument associated with VOLATILE dummy argument 'my_real=' is not definable
!WARNING: Actual argument associated with VOLATILE dummy argument 'my_real=' is not definable [-Wundefinable-asynchronous-or-volatile-actual]
!BECAUSE: '-2.9637666816e10_4' is not a variable or pointer
call vol_dum_real(3.141592653 / (-10.6e-11))
!WARNING: Actual argument associated with VOLATILE dummy argument 'my_complex=' is not definable
!WARNING: Actual argument associated with VOLATILE dummy argument 'my_complex=' is not definable [-Wundefinable-asynchronous-or-volatile-actual]
!BECAUSE: '(1._4,3.2000000476837158203125_4)' is not a variable or pointer
call vol_dum_complex((1., 3.2))
!WARNING: Actual argument associated with VOLATILE dummy argument 'my_complex=' is not definable
!WARNING: Actual argument associated with VOLATILE dummy argument 'my_complex=' is not definable [-Wundefinable-asynchronous-or-volatile-actual]
!BECAUSE: '(-1._4,6.340000152587890625_4)' is not a variable or pointer
call vol_dum_complex((1., 3.2) + (-2., 3.14))
!WARNING: Actual argument associated with VOLATILE dummy argument 'my_complex=' is not definable
!WARNING: Actual argument associated with VOLATILE dummy argument 'my_complex=' is not definable [-Wundefinable-asynchronous-or-volatile-actual]
!BECAUSE: '(-1.2048000335693359375e1_4,-3.2599999904632568359375_4)' is not a variable or pointer
call vol_dum_complex((1., 3.2) * (-2., 3.14))
!WARNING: Actual argument associated with VOLATILE dummy argument 'my_complex=' is not definable
!WARNING: Actual argument associated with VOLATILE dummy argument 'my_complex=' is not definable [-Wundefinable-asynchronous-or-volatile-actual]
!BECAUSE: '(5.80680549144744873046875e-1_4,-6.8833148479461669921875e-1_4)' is not a variable or pointer
call vol_dum_complex((1., 3.2) / (-2., 3.14))
!WARNING: Actual argument associated with VOLATILE dummy argument 'my_int_arr=' is not definable
!WARNING: Actual argument associated with VOLATILE dummy argument 'my_int_arr=' is not definable [-Wundefinable-asynchronous-or-volatile-actual]
!BECAUSE: '[INTEGER(4)::1_4,2_4,3_4,4_4]' is not a variable or pointer
call vol_dum_int_arr((/ 1, 2, 3, 4 /))
!WARNING: Actual argument associated with VOLATILE dummy argument 'my_int_arr=' is not definable
!WARNING: Actual argument associated with VOLATILE dummy argument 'my_int_arr=' is not definable [-Wundefinable-asynchronous-or-volatile-actual]
!BECAUSE: 'reshape([INTEGER(4)::1_4,2_4,3_4,4_4],shape=[2,2])' is not a variable or pointer
call vol_dum_int_arr(reshape((/ 1, 2, 3, 4 /), (/ 2, 2/)))
!WARNING: Actual argument associated with VOLATILE dummy argument 'my_int_arr=' is not definable
!WARNING: Actual argument associated with VOLATILE dummy argument 'my_int_arr=' is not definable [-Wundefinable-asynchronous-or-volatile-actual]
!BECAUSE: '[INTEGER(4)::1_4,2_4,3_4,4_4]' is not a variable or pointer
call vol_dum_int_arr((/ 1, 2, 3, 4 /))
end subroutine test_all_subprograms

View File

@ -4,7 +4,7 @@
module m
contains
subroutine subr(parg)
!PORTABILITY: A dummy procedure pointer should not have assumed-length CHARACTER(*) result type
!PORTABILITY: A dummy procedure pointer should not have assumed-length CHARACTER(*) result type [-Wportability]
procedure(character(*)), pointer :: parg
!ERROR: An assumed (*) type parameter may be used only for a (non-statement function) dummy argument, associate name, character named constant, or external function result
procedure(character(*)), pointer :: plocal
@ -14,7 +14,7 @@
end subroutine
subroutine subr_1(parg_1)
!PORTABILITY: A dummy procedure pointer should not have assumed-length CHARACTER(*) result type
!PORTABILITY: A dummy procedure pointer should not have assumed-length CHARACTER(*) result type [-Wportability]
procedure(character(*)), pointer :: parg_1
print *, parg_1()
end subroutine

View File

@ -29,7 +29,7 @@ program test
character(4) long, longarr(1)
character(4), allocatable :: longalloc
character(4), pointer :: longptr
!WARNING: Actual argument variable length '2' is less than expected length '3'
!WARNING: Actual argument variable length '2' is less than expected length '3' [-Wshort-character-actual]
call s1(short)
!ERROR: Actual argument array has fewer characters (2) than dummy argument 'x=' array (3)
call s2(shortarr)

View File

@ -11,11 +11,11 @@ program test
real, target :: a(1)
real :: b(1)
call foo(a) ! ok
!WARNING: Any pointer associated with TARGET dummy argument 'a=' during this call must not be used afterwards, as 'b' is not a target
!WARNING: Any pointer associated with TARGET dummy argument 'a=' during this call must not be used afterwards, as 'b' is not a target [-Wnon-target-passed-to-target]
call foo(b)
!WARNING: Any pointer associated with TARGET dummy argument 'a=' during this call will not be associated with the value of '(a)' afterwards
!WARNING: Any pointer associated with TARGET dummy argument 'a=' during this call will not be associated with the value of '(a)' afterwards [-Wnon-target-passed-to-target]
call foo((a))
!WARNING: Any pointer associated with TARGET dummy argument 'a=' during this call will not be associated with the value of 'a([INTEGER(8)::1_8])' afterwards
!WARNING: Any pointer associated with TARGET dummy argument 'a=' during this call will not be associated with the value of 'a([INTEGER(8)::1_8])' afterwards [-Wnon-target-passed-to-target]
call foo(a([1]))
!ERROR: Scalar actual argument may not be associated with assumed-shape dummy argument 'a='
call foo(a(1))

View File

@ -5,14 +5,14 @@ subroutine s1
end
subroutine s2
!WARNING: Reference to the procedure 'ext' has an implicit interface that is distinct from another reference: distinct numbers of dummy arguments
!WARNING: Reference to the procedure 'ext' has an implicit interface that is distinct from another reference: distinct numbers of dummy arguments [-Wincompatible-implicit-interfaces]
call ext(1.)
call myerror('abcd') ! don't warn about distinct lengths
end
subroutine s3
interface
!WARNING: The global subprogram 'ext' is not compatible with its local procedure declaration (incompatible procedure attributes: ImplicitInterface)
!WARNING: The global subprogram 'ext' is not compatible with its local procedure declaration (incompatible procedure attributes: ImplicitInterface) [-Wexternal-interface-mismatch]
subroutine ext(n)
integer n
end

View File

@ -15,7 +15,7 @@ module m
call intentInUnlimited(scalar)
!ERROR: Actual argument associated with POINTER dummy argument 'x=' must also be POINTER unless INTENT(IN)
call intentInOutUnlimited(scalar)
!PORTABILITY: If a POINTER or ALLOCATABLE dummy or actual argument is unlimited polymorphic, both should be so
!PORTABILITY: If a POINTER or ALLOCATABLE dummy or actual argument is unlimited polymorphic, both should be so [-Wrelaxed-intent-in-checking]
call intentInUnlimited(arrayptr)
!ERROR: If a POINTER or ALLOCATABLE dummy or actual argument is unlimited polymorphic, both must be so
call intentInOutUnlimited(arrayptr)

View File

@ -28,15 +28,15 @@ end
module m1
interface
!WARNING: The global subprogram 'constlen' is not compatible with its local procedure declaration (incompatible dummy argument #1: incompatible dummy data object types: CHARACTER(KIND=1,LEN=1_8) vs CHARACTER(KIND=1,LEN=2_8))
!WARNING: The global subprogram 'constlen' is not compatible with its local procedure declaration (incompatible dummy argument #1: incompatible dummy data object types: CHARACTER(KIND=1,LEN=1_8) vs CHARACTER(KIND=1,LEN=2_8)) [-Wexternal-interface-mismatch]
subroutine constLen(s)
character(len=2) s
end
!WARNING: The global subprogram 'assumedlen' is not compatible with its local procedure declaration (incompatible dummy argument #1: assumed-length character vs explicit-length character)
!WARNING: The global subprogram 'assumedlen' is not compatible with its local procedure declaration (incompatible dummy argument #1: assumed-length character vs explicit-length character) [-Wexternal-interface-mismatch]
subroutine assumedLen(s)
character(len=2) s
end
!WARNING: The global subprogram 'exprlen' is not compatible with its local procedure declaration (incompatible dummy argument #1: constant-length vs non-constant-length character dummy arguments)
!WARNING: The global subprogram 'exprlen' is not compatible with its local procedure declaration (incompatible dummy argument #1: constant-length vs non-constant-length character dummy arguments) [-Wexternal-interface-mismatch]
subroutine exprLen(s)
character(len=2) s
end
@ -45,11 +45,11 @@ end
module m2
interface
!WARNING: The global subprogram 'constlen' is not compatible with its local procedure declaration (incompatible dummy argument #1: assumed-length character vs explicit-length character)
!WARNING: The global subprogram 'constlen' is not compatible with its local procedure declaration (incompatible dummy argument #1: assumed-length character vs explicit-length character) [-Wexternal-interface-mismatch]
subroutine constLen(s)
character(len=*) s
end
!WARNING: The global subprogram 'exprlen' is not compatible with its local procedure declaration (incompatible dummy argument #1: assumed-length character vs explicit-length character)
!WARNING: The global subprogram 'exprlen' is not compatible with its local procedure declaration (incompatible dummy argument #1: assumed-length character vs explicit-length character) [-Wexternal-interface-mismatch]
subroutine exprLen(s)
character(len=*) s
end
@ -58,12 +58,12 @@ end
module m3
interface
!WARNING: The global subprogram 'constlen' is not compatible with its local procedure declaration (incompatible dummy argument #1: constant-length vs non-constant-length character dummy arguments)
!WARNING: The global subprogram 'constlen' is not compatible with its local procedure declaration (incompatible dummy argument #1: constant-length vs non-constant-length character dummy arguments) [-Wexternal-interface-mismatch]
subroutine constLen(s)
common n
character(len=n) s
end
!WARNING: The global subprogram 'assumedlen' is not compatible with its local procedure declaration (incompatible dummy argument #1: assumed-length character vs explicit-length character)
!WARNING: The global subprogram 'assumedlen' is not compatible with its local procedure declaration (incompatible dummy argument #1: assumed-length character vs explicit-length character) [-Wexternal-interface-mismatch]
subroutine assumedLen(s)
common n
character(len=n) s

View File

@ -516,9 +516,9 @@ module char
!ERROR: Actual argument associated with coarray dummy argument 'a=' must be a coarray
call coarray0(matrix11(1,1))
!WARNING: Actual argument variable length '1' is less than expected length '2'
!WARNING: Actual argument variable length '1' is less than expected length '2' [-Wshort-character-actual]
call scalar(scalar0(1:1))
!WARNING: Actual argument expression length '1' is less than expected length '2'
!WARNING: Actual argument expression length '1' is less than expected length '2' [-Wshort-character-actual]
call scalar('a')
end
end

View File

@ -5,7 +5,7 @@ module m
class(*), intent(in) :: x
end
subroutine test
!PORTABILITY: passing Hollerith to unlimited polymorphic as if it were CHARACTER
!PORTABILITY: passing Hollerith to unlimited polymorphic as if it were CHARACTER [-Whollerith-polymorphic]
call unlimited(6HHERMAN)
call unlimited('abc') ! ok
end

View File

@ -22,17 +22,17 @@ module m
type(hasAlloc), intent(out) :: b(..)
type(hasInit), intent(out) :: c(..)
type(hasFinal), intent(out) :: d(..)
!PORTABILITY: Assumed-rank actual argument should not be associated with INTENT(OUT) assumed-rank dummy argument
!PORTABILITY: Assumed-rank actual argument should not be associated with INTENT(OUT) assumed-rank dummy argument [-Wportability]
!ERROR: Assumed-rank actual argument may not be associated with INTENT(OUT) assumed-rank dummy argument requiring finalization, destruction, or initialization
!ERROR: Assumed-rank actual argument may not be associated with INTENT(OUT) assumed-rank dummy argument requiring finalization, destruction, or initialization
!ERROR: Assumed-rank actual argument may not be associated with INTENT(OUT) assumed-rank dummy argument requiring finalization, destruction, or initialization
call typeOutAssumedRank(a, b, c, d)
!PORTABILITY: Assumed-rank actual argument should not be associated with INTENT(OUT) assumed-rank dummy argument
!PORTABILITY: Assumed-rank actual argument should not be associated with INTENT(OUT) assumed-rank dummy argument [-Wportability]
!ERROR: Assumed-rank actual argument may not be associated with INTENT(OUT) assumed-rank dummy argument requiring finalization, destruction, or initialization
!ERROR: Assumed-rank actual argument may not be associated with INTENT(OUT) assumed-rank dummy argument requiring finalization, destruction, or initialization
!ERROR: Assumed-rank actual argument may not be associated with INTENT(OUT) assumed-rank dummy argument requiring finalization, destruction, or initialization
call classOutAssumedRank(a, b, c, d)
!PORTABILITY: Assumed-rank actual argument should not be associated with INTENT(OUT) assumed-rank dummy argument
!PORTABILITY: Assumed-rank actual argument should not be associated with INTENT(OUT) assumed-rank dummy argument [-Wportability]
!ERROR: Assumed-rank actual argument may not be associated with INTENT(OUT) assumed-rank dummy argument requiring finalization, destruction, or initialization
!ERROR: Assumed-rank actual argument may not be associated with INTENT(OUT) assumed-rank dummy argument requiring finalization, destruction, or initialization
!ERROR: Assumed-rank actual argument may not be associated with INTENT(OUT) assumed-rank dummy argument requiring finalization, destruction, or initialization
@ -95,17 +95,17 @@ module m
type(hasAlloc) b(*)
type(hasInit) c(*)
type(hasFinal) d(*)
!PORTABILITY: Assumed-size actual argument should not be associated with INTENT(OUT) assumed-rank dummy argument
!PORTABILITY: Assumed-size actual argument should not be associated with INTENT(OUT) assumed-rank dummy argument [-Wportability]
!ERROR: Assumed-size actual argument may not be associated with INTENT(OUT) assumed-rank dummy argument requiring finalization, destruction, or initialization
!ERROR: Assumed-size actual argument may not be associated with INTENT(OUT) assumed-rank dummy argument requiring finalization, destruction, or initialization
!ERROR: Assumed-size actual argument may not be associated with INTENT(OUT) assumed-rank dummy argument requiring finalization, destruction, or initialization
call typeOutAssumedRank(a,b,c,d)
!PORTABILITY: Assumed-size actual argument should not be associated with INTENT(OUT) assumed-rank dummy argument
!PORTABILITY: Assumed-size actual argument should not be associated with INTENT(OUT) assumed-rank dummy argument [-Wportability]
!ERROR: Assumed-size actual argument may not be associated with INTENT(OUT) assumed-rank dummy argument requiring finalization, destruction, or initialization
!ERROR: Assumed-size actual argument may not be associated with INTENT(OUT) assumed-rank dummy argument requiring finalization, destruction, or initialization
!ERROR: Assumed-size actual argument may not be associated with INTENT(OUT) assumed-rank dummy argument requiring finalization, destruction, or initialization
call classOutAssumedRank(a,b,c,d)
!PORTABILITY: Assumed-size actual argument should not be associated with INTENT(OUT) assumed-rank dummy argument
!PORTABILITY: Assumed-size actual argument should not be associated with INTENT(OUT) assumed-rank dummy argument [-Wportability]
!ERROR: Assumed-size actual argument may not be associated with INTENT(OUT) assumed-rank dummy argument requiring finalization, destruction, or initialization
!ERROR: Assumed-size actual argument may not be associated with INTENT(OUT) assumed-rank dummy argument requiring finalization, destruction, or initialization
!ERROR: Assumed-size actual argument may not be associated with INTENT(OUT) assumed-rank dummy argument requiring finalization, destruction, or initialization

View File

@ -5,11 +5,11 @@ subroutine from(a, b, c, d)
call to(a)
call to(a(1)) ! ok
call to(b) ! ok, passed via temp
!WARNING: Reference to the procedure 'to' has an implicit interface that is distinct from another reference: incompatible dummy argument #1: incompatible dummy data object shapes
!WARNING: Reference to the procedure 'to' has an implicit interface that is distinct from another reference: incompatible dummy argument #1: incompatible dummy data object shapes [-Wincompatible-implicit-interfaces]
call to(b(1))
!WARNING: Reference to the procedure 'to' has an implicit interface that is distinct from another reference: incompatible dummy argument #1: incompatible dummy data object shapes
!WARNING: Reference to the procedure 'to' has an implicit interface that is distinct from another reference: incompatible dummy argument #1: incompatible dummy data object shapes [-Wincompatible-implicit-interfaces]
call to(c)
!WARNING: Reference to the procedure 'to' has an implicit interface that is distinct from another reference: incompatible dummy argument #1: incompatible dummy data object shapes
!WARNING: Reference to the procedure 'to' has an implicit interface that is distinct from another reference: incompatible dummy argument #1: incompatible dummy data object shapes [-Wincompatible-implicit-interfaces]
call to(1.)
call to([1., 2.]) ! ok
call to(d) ! ok

View File

@ -2,10 +2,10 @@
subroutine assumedshape(normal, contig)
real normal(:)
real, contiguous :: contig(:)
!WARNING: If the procedure's interface were explicit, this reference would be in error
!WARNING: If the procedure's interface were explicit, this reference would be in error [-Wknown-bad-implicit-interface]
!BECAUSE: Element of assumed-shape array may not be associated with a dummy argument 'assumedsize=' array
call seqAssociate(normal(1))
!PORTABILITY: Element of contiguous assumed-shape array is accepted for storage sequence association
!PORTABILITY: Element of contiguous assumed-shape array is accepted for storage sequence association [-Wcontiguous-ok-for-seq-association]
call seqAssociate(contig(1))
end
subroutine seqAssociate(assumedSize)

View File

@ -129,7 +129,7 @@ program selectCaseProg
end select
select case (grade2)
!WARNING: CASE has lower bound greater than upper bound
!WARNING: CASE has lower bound greater than upper bound [-Wempty-case]
case (51:50)
case (100:)
case (:30)
@ -183,13 +183,13 @@ subroutine test_overflow
integer :: j
select case(1_1)
case (127)
!WARNING: CASE value (128_4) overflows type (INTEGER(1)) of SELECT CASE expression
!WARNING: CASE value (128_4) overflows type (INTEGER(1)) of SELECT CASE expression [-Wcase-overflow]
case (128)
!WARNING: CASE value (129_4) overflows type (INTEGER(1)) of SELECT CASE expression
!WARNING: CASE value (130_4) overflows type (INTEGER(1)) of SELECT CASE expression
!WARNING: CASE value (129_4) overflows type (INTEGER(1)) of SELECT CASE expression [-Wcase-overflow]
!WARNING: CASE value (130_4) overflows type (INTEGER(1)) of SELECT CASE expression [-Wcase-overflow]
case (129:130)
!WARNING: CASE value (-130_4) overflows type (INTEGER(1)) of SELECT CASE expression
!WARNING: CASE value (-129_4) overflows type (INTEGER(1)) of SELECT CASE expression
!WARNING: CASE value (-130_4) overflows type (INTEGER(1)) of SELECT CASE expression [-Wcase-overflow]
!WARNING: CASE value (-129_4) overflows type (INTEGER(1)) of SELECT CASE expression [-Wcase-overflow]
case (-130:-129)
case (-128)
!ERROR: Must be a scalar value, but is a rank-1 array

View File

@ -7,7 +7,7 @@ subroutine init_1
common x, y
common /a/ xa, ya
common /b/ xb, yb
!WARNING: Blank COMMON object 'x' in a DATA statement is not standard
!WARNING: Blank COMMON object 'x' in a DATA statement is not standard [-Wdata-stmt-extensions]
data x /42./, xa /42./, yb/42./
end subroutine
@ -18,7 +18,7 @@ subroutine init_conflict
common /a/ xa, ya
common /b/ xb, yb
equivalence (yb, yb_eq)
!WARNING: Blank COMMON object 'x' in a DATA statement is not standard
!WARNING: Blank COMMON object 'x' in a DATA statement is not standard [-Wdata-stmt-extensions]
!ERROR: Multiple initialization of COMMON block /b/
data x /66./, xa /66./, yb_eq /66./
end subroutine

View File

@ -5,30 +5,30 @@ module m0
end
module m
use m0
!WARNING: Use-associated 'p1' already has 'CONTIGUOUS' attribute
!WARNING: Use-associated 'p1' already has 'CONTIGUOUS' attribute [-Wredundant-attribute]
contiguous p1
!ERROR: Cannot change CONTIGUOUS attribute on use-associated 'p2'
contiguous p2
!PORTABILITY: CONTIGUOUS entity 'x' should be an array pointer, assumed-shape, or assumed-rank
!PORTABILITY: CONTIGUOUS entity 'x' should be an array pointer, assumed-shape, or assumed-rank [-Wredundant-contiguous]
real, contiguous :: x
!PORTABILITY: CONTIGUOUS entity 'scalar' should be an array pointer, assumed-shape, or assumed-rank
!PORTABILITY: CONTIGUOUS entity 'scalar' should be an array pointer, assumed-shape, or assumed-rank [-Wredundant-contiguous]
real, contiguous, pointer :: scalar
!PORTABILITY: CONTIGUOUS entity 'allocatable' should be an array pointer, assumed-shape, or assumed-rank
!PORTABILITY: CONTIGUOUS entity 'allocatable' should be an array pointer, assumed-shape, or assumed-rank [-Wredundant-contiguous]
real, contiguous, allocatable :: allocatable
contains
!PORTABILITY: CONTIGUOUS entity 'func' should be an array pointer, assumed-shape, or assumed-rank
!PORTABILITY: CONTIGUOUS entity 'func' should be an array pointer, assumed-shape, or assumed-rank [-Wredundant-contiguous]
function func(ashape,arank) result(r)
real, contiguous :: ashape(:) ! ok
real, contiguous :: arank(..) ! ok
!PORTABILITY: CONTIGUOUS entity 'r' should be an array pointer, assumed-shape, or assumed-rank
!PORTABILITY: CONTIGUOUS entity 'r' should be an array pointer, assumed-shape, or assumed-rank [-Wredundant-contiguous]
real :: r(10)
!PORTABILITY: CONTIGUOUS entity 'r2' should be an array pointer, assumed-shape, or assumed-rank
!PORTABILITY: CONTIGUOUS entity 'r2' should be an array pointer, assumed-shape, or assumed-rank [-Wredundant-contiguous]
real :: r2(10)
contiguous func
contiguous r
contiguous e
contiguous r2
!PORTABILITY: CONTIGUOUS entity 'e' should be an array pointer, assumed-shape, or assumed-rank
!PORTABILITY: CONTIGUOUS entity 'e' should be an array pointer, assumed-shape, or assumed-rank [-Wredundant-contiguous]
entry e() result(r2)
r2 = 0
end

View File

@ -2,15 +2,15 @@
! Test conflicting CUDA subprogram attributes
module m1
contains
!WARNING: ATTRIBUTES(Host) appears more than once
!WARNING: ATTRIBUTES(Host) appears more than once [-Wredundant-attribute]
attributes(host,host) subroutine ok1; end
!WARNING: ATTRIBUTES(Host) appears more than once
!WARNING: ATTRIBUTES(Host) appears more than once [-Wredundant-attribute]
attributes(host) attributes(host) subroutine ok2; end
attributes(host,device) subroutine ok3; end
attributes(device,host) subroutine ok4; end
!WARNING: ATTRIBUTES(Host) appears more than once
!WARNING: ATTRIBUTES(Host) appears more than once [-Wredundant-attribute]
attributes(host,device,host) subroutine ok5; end
!WARNING: ATTRIBUTES(Device) appears more than once
!WARNING: ATTRIBUTES(Device) appears more than once [-Wredundant-attribute]
attributes(device,host,device) subroutine ok6; end
!ERROR: ATTRIBUTES(Global) conflicts with earlier ATTRIBUTES(Host)
attributes(host,global) subroutine conflict1; end

View File

@ -38,14 +38,14 @@ module m
!ERROR: Object 'mmp' with ATTRIBUTES(MANAGED) must also be allocatable, automatic, explicit shape, or a dummy argument
real, managed, pointer :: mmp(:)
real, managed, target :: mmt
!WARNING: Object 'mp' with ATTRIBUTES(PINNED) should also be allocatable
!WARNING: Object 'mp' with ATTRIBUTES(PINNED) should also be allocatable [-Wcuda-usage]
real, pinned :: mp
!WARNING: Object 'mpi' with ATTRIBUTES(PINNED) should also be allocatable
!WARNING: Object 'mpi' with ATTRIBUTES(PINNED) should also be allocatable [-Wcuda-usage]
real, pinned :: mpi = 1.
real, pinned, allocatable :: mpl ! ok
!ERROR: Object 'mpp' with ATTRIBUTES(PINNED) may not be a pointer
!ERROR: Object 'mpp' with ATTRIBUTES(PINNED) may not be a pointer [-Wcuda-usage]
real, pinned, pointer :: mpp
!WARNING: Object 'mpt' with ATTRIBUTES(PINNED) should also be allocatable
!WARNING: Object 'mpt' with ATTRIBUTES(PINNED) should also be allocatable [-Wcuda-usage]
real, pinned, target :: mpt ! ok
!ERROR: ATTRIBUTES(TEXTURE) is obsolete and no longer supported
real, texture, pointer :: mt
@ -67,7 +67,7 @@ module m
integer, intent(in) :: n
real, device :: da(*) ! ok
real, managed :: ma(n) ! ok
!WARNING: Pointer 'dp' may not be associated in a device subprogram
!WARNING: Pointer 'dp' may not be associated in a device subprogram [-Wcuda-usage]
real, device, pointer :: dp
real, constant :: rc ! ok
real, shared :: rs ! ok

View File

@ -4,9 +4,9 @@ module m
contains
attributes(device) subroutine devsubr(n)
integer, intent(in) :: n
!WARNING: 'x1' should not have the SAVE attribute or initialization in a device subprogram
!WARNING: 'x1' should not have the SAVE attribute or initialization in a device subprogram [-Wcuda-usage]
real, save :: x1
!WARNING: 'x2' should not have the SAVE attribute or initialization in a device subprogram
!WARNING: 'x2' should not have the SAVE attribute or initialization in a device subprogram [-Wcuda-usage]
real :: x2 = 1.
!ERROR: Device subprogram 'devsubr' cannot call itself
if (n > 0) call devsubr(n-1)

View File

@ -15,7 +15,7 @@ module m
print*,'from device'
print '(f10.5)', (x(ivar), ivar = 1, 10)
write(*,*), "Hello world from device!"
!WARNING: I/O statement might not be supported on device
!WARNING: I/O statement might not be supported on device [-Wcuda-usage]
write(12,'(10F4.1)'), x
end
attributes(global) subroutine devsub3(n)

View File

@ -41,7 +41,7 @@ subroutine s1
data rp/rfunc/
procedure(rfunc), pointer :: rpp
real, target :: rt
!WARNING: Procedure pointer 'rpp' in a DATA statement is not standard
!WARNING: Procedure pointer 'rpp' in a DATA statement is not standard [-Wdata-stmt-extensions]
!ERROR: Data object 'rt' may not be used to initialize 'rpp', which is a procedure pointer
data rpp/rt/
!ERROR: Initializer for 'rt' must not be a pointer
@ -49,7 +49,7 @@ subroutine s1
!ERROR: Initializer for 'rt' must not be a procedure
data rt/rfunc/
integer :: jx, jy
!WARNING: DATA statement value initializes 'jx' of type 'INTEGER(4)' with CHARACTER
!WARNING: DATA statement value initializes 'jx' of type 'INTEGER(4)' with CHARACTER [-Wdata-stmt-extensions]
data jx/'abc'/
!ERROR: DATA statement value could not be converted to the type 'INTEGER(4)' of the object 'jx'
data jx/t1()/

View File

@ -1,8 +1,8 @@
! RUN: %python %S/test_errors.py %s %flang_fc1
character(4) a, b, c, d, e, f
!WARNING: DATA statement value '"abcde"' for 'a' has the wrong length
!WARNING: DATA statement value '"abcde"' for 'a' has the wrong length [-Wdata-length]
data a(1:4)/'abcde'/
!WARNING: DATA statement value '"abc"' for 'b' has the wrong length
!WARNING: DATA statement value '"abc"' for 'b' has the wrong length [-Wdata-length]
data b(1:4)/'abc'/
data c/'abcde'/ ! not a substring, conforms
data d/'abc'/ ! not a substring, conforms

View File

@ -20,7 +20,7 @@ module ext4
end
block data ext3
!PORTABILITY: Global name 'ext4' conflicts with a module
!PORTABILITY: Global name 'ext4' conflicts with a module [-Wbenign-name-clash]
common /ext4/ x
end

View File

@ -27,7 +27,7 @@ module m
!ERROR: 'x1' may not be a local variable in a pure subprogram
!BECAUSE: 'x1' has an impure FINAL procedure 'final'
type(t1) x1
!WARNING: 'x1a' of derived type 't1' does not have a FINAL subroutine for its rank (1)
!WARNING: 'x1a' of derived type 't1' does not have a FINAL subroutine for its rank (1) [-Wfinal]
type(t1), allocatable :: x1a(:)
type(t1), parameter :: namedConst = t1() ! ok
!ERROR: 'x2' may not be a local variable in a pure subprogram

View File

@ -11,8 +11,8 @@ program main
real a, b
integer, parameter :: ak = kind(a)
integer, parameter :: br = rank(b)
!WARNING: 'a' appeared earlier as a scalar actual argument to a specification function
!WARNING: 'a' appeared earlier as a scalar actual argument to a specification function [-Wprevious-scalar-use]
dimension a(1)
!WARNING: 'b' appeared earlier as a scalar actual argument to a specification function
!WARNING: 'b' appeared earlier as a scalar actual argument to a specification function [-Wprevious-scalar-use]
dimension b(1)
end

View File

@ -19,7 +19,7 @@ module m2
use m1
type, extends(absBase) :: ext
contains
!WARNING: Override of PRIVATE DEFERRED 'deferredtbp' should appear in its module
!WARNING: Override of PRIVATE DEFERRED 'deferredtbp' should appear in its module [-Winaccessible-deferred-override]
procedure :: deferredTbp => implTbp
end type
contains

View File

@ -36,9 +36,9 @@ program test
x1(:) = [t1()] ! ok
x2(:) = [t2()] ! ok
x3(:) = [t3()] ! ok
!PORTABILITY: Variable 'x1([INTEGER(8)::1_8])' has a vector subscript and will be finalized by non-elemental subroutine 'f1'
!PORTABILITY: Variable 'x1([INTEGER(8)::1_8])' has a vector subscript and will be finalized by non-elemental subroutine 'f1' [-Wvector-subscript-finalization]
x1([1]) = [t1()]
!PORTABILITY: Variable 'x2([INTEGER(8)::1_8])' has a vector subscript and will be finalized by non-elemental subroutine 'f2'
!PORTABILITY: Variable 'x2([INTEGER(8)::1_8])' has a vector subscript and will be finalized by non-elemental subroutine 'f2' [-Wvector-subscript-finalization]
x2([1]) = [t2()]
x3([1]) = [t3()] ! ok
end

View File

@ -16,21 +16,21 @@ module m
function f1(a,d)
real, intent(in) :: a(:)
integer, optional, intent(in) :: d
!PORTABILITY: The actual argument for DIM= is optional, pointer, or allocatable, and it is assumed to be present and equal to 1 at execution time
!PORTABILITY: The actual argument for DIM= is optional, pointer, or allocatable, and it is assumed to be present and equal to 1 at execution time [-Woptional-must-be-present]
f1 = sum(a,dim=d)
!PORTABILITY: The actual argument for DIM= is optional, pointer, or allocatable, and it is assumed to be present and equal to 1 at execution time
!PORTABILITY: The actual argument for DIM= is optional, pointer, or allocatable, and it is assumed to be present and equal to 1 at execution time [-Woptional-must-be-present]
f1 = norm2(a,dim=d)
end function
function f2(a,d)
real, intent(in) :: a(:)
integer, pointer, intent(in) :: d
!PORTABILITY: The actual argument for DIM= is optional, pointer, or allocatable, and it is assumed to be present and equal to 1 at execution time
!PORTABILITY: The actual argument for DIM= is optional, pointer, or allocatable, and it is assumed to be present and equal to 1 at execution time [-Woptional-must-be-present]
f2 = sum(a,dim=d)
end function
function f3(a,d)
real, intent(in) :: a(:)
integer, allocatable, intent(in) :: d
!PORTABILITY: The actual argument for DIM= is optional, pointer, or allocatable, and it is assumed to be present and equal to 1 at execution time
!PORTABILITY: The actual argument for DIM= is optional, pointer, or allocatable, and it is assumed to be present and equal to 1 at execution time [-Woptional-must-be-present]
f3 = sum(a,dim=d)
end function
function f10a(a)
@ -49,23 +49,23 @@ module m
real, intent(in) :: a(:,:)
integer, optional, intent(in) :: d
real, allocatable :: f11(:)
!WARNING: The actual argument for DIM= is optional, pointer, or allocatable, and may not be absent during execution; parenthesize to silence this warning
!WARNING: The actual argument for DIM= is optional, pointer, or allocatable, and may not be absent during execution; parenthesize to silence this warning [-Woptional-must-be-present]
f11 = sum(a,dim=d)
!WARNING: The actual argument for DIM= is optional, pointer, or allocatable, and may not be absent during execution; parenthesize to silence this warning
!WARNING: The actual argument for DIM= is optional, pointer, or allocatable, and may not be absent during execution; parenthesize to silence this warning [-Woptional-must-be-present]
f11 = norm2(a,dim=d)
end function
function f12(a,d)
real, intent(in) :: a(:,:)
integer, pointer, intent(in) :: d
real, allocatable :: f12(:)
!WARNING: The actual argument for DIM= is optional, pointer, or allocatable, and may not be absent during execution; parenthesize to silence this warning
!WARNING: The actual argument for DIM= is optional, pointer, or allocatable, and may not be absent during execution; parenthesize to silence this warning [-Woptional-must-be-present]
f12 = sum(a,dim=d)
end function
function f13(a,d)
real, intent(in) :: a(:,:)
integer, allocatable, intent(in) :: d
real, allocatable :: f13(:)
!WARNING: The actual argument for DIM= is optional, pointer, or allocatable, and may not be absent during execution; parenthesize to silence this warning
!WARNING: The actual argument for DIM= is optional, pointer, or allocatable, and may not be absent during execution; parenthesize to silence this warning [-Woptional-must-be-present]
f13 = sum(a,dim=d)
end function
end module

View File

@ -23,12 +23,12 @@ SUBROUTINE s1()
INTEGER, PARAMETER :: constInt = 0
! Warn on this one for backwards compatibility
!WARNING: DO step expression should not be zero
!WARNING: DO step expression should not be zero [-Wzero-do-step]
DO 10 I = 1, 10, 0
10 CONTINUE
! Warn on this one for backwards compatibility
!WARNING: DO step expression should not be zero
!WARNING: DO step expression should not be zero [-Wzero-do-step]
DO 20 I = 1, 10, 5 - 5
20 CONTINUE

View File

@ -50,13 +50,13 @@ PROGRAM do_issue_458
END DO
! REAL DO variable
!PORTABILITY: DO controls should be INTEGER
!PORTABILITY: DO controls should be INTEGER [-Wreal-do-controls]
DO rvar = 1, 10, 3
PRINT *, "rvar is: ", rvar
END DO
! DOUBLE PRECISISON DO variable
!PORTABILITY: DO controls should be INTEGER
!PORTABILITY: DO controls should be INTEGER [-Wreal-do-controls]
DO dvar = 1, 10, 3
PRINT *, "dvar is: ", dvar
END DO
@ -69,14 +69,14 @@ PROGRAM do_issue_458
! Pointer to REAL DO variable
ALLOCATE(prvar)
!PORTABILITY: DO controls should be INTEGER
!PORTABILITY: DO controls should be INTEGER [-Wreal-do-controls]
DO prvar = 1, 10, 3
PRINT *, "prvar is: ", prvar
END DO
! Pointer to DOUBLE PRECISION DO variable
ALLOCATE(pdvar)
!PORTABILITY: DO controls should be INTEGER
!PORTABILITY: DO controls should be INTEGER [-Wreal-do-controls]
DO pdvar = 1, 10, 3
PRINT *, "pdvar is: ", pdvar
END DO
@ -148,26 +148,26 @@ PROGRAM do_issue_458
END DO
! Shared association REAL DO variable
!PORTABILITY: DO controls should be INTEGER
!PORTABILITY: DO controls should be INTEGER [-Wreal-do-controls]
DO realvarshare = 1, 10, 3
PRINT *, "ivar is: ", ivar
END DO
! Shared association DOUBLE PRECISION DO variable
!PORTABILITY: DO controls should be INTEGER
!PORTABILITY: DO controls should be INTEGER [-Wreal-do-controls]
DO dpvarshare = 1, 10, 3
PRINT *, "ivar is: ", ivar
END DO
! Initial expressions
! REAL initial expression
!PORTABILITY: DO controls should be INTEGER
!PORTABILITY: DO controls should be INTEGER [-Wreal-do-controls]
DO ivar = rvar, 10, 3
PRINT *, "ivar is: ", ivar
END DO
! DOUBLE PRECISION initial expression
!PORTABILITY: DO controls should be INTEGER
!PORTABILITY: DO controls should be INTEGER [-Wreal-do-controls]
DO ivar = dvar, 10, 3
PRINT *, "ivar is: ", ivar
END DO
@ -178,13 +178,13 @@ PROGRAM do_issue_458
END DO
! Pointer to REAL initial expression
!PORTABILITY: DO controls should be INTEGER
!PORTABILITY: DO controls should be INTEGER [-Wreal-do-controls]
DO ivar = prvar, 10, 3
PRINT *, "ivar is: ", ivar
END DO
! Pointer to DOUBLE PRECISION initial expression
!PORTABILITY: DO controls should be INTEGER
!PORTABILITY: DO controls should be INTEGER [-Wreal-do-controls]
DO ivar = pdvar, 10, 3
PRINT *, "ivar is: ", ivar
END DO
@ -221,13 +221,13 @@ PROGRAM do_issue_458
! Final expression
! REAL final expression
!PORTABILITY: DO controls should be INTEGER
!PORTABILITY: DO controls should be INTEGER [-Wreal-do-controls]
DO ivar = 1, rvar, 3
PRINT *, "ivar is: ", ivar
END DO
! DOUBLE PRECISION final expression
!PORTABILITY: DO controls should be INTEGER
!PORTABILITY: DO controls should be INTEGER [-Wreal-do-controls]
DO ivar = 1, dvar, 3
PRINT *, "ivar is: ", ivar
END DO
@ -238,13 +238,13 @@ PROGRAM do_issue_458
END DO
! Pointer to REAL final expression
!PORTABILITY: DO controls should be INTEGER
!PORTABILITY: DO controls should be INTEGER [-Wreal-do-controls]
DO ivar = 1, prvar, 3
PRINT *, "ivar is: ", ivar
END DO
! Pointer to DOUBLE PRECISION final expression
!PORTABILITY: DO controls should be INTEGER
!PORTABILITY: DO controls should be INTEGER [-Wreal-do-controls]
DO ivar = pdvar, 10, 3
PRINT *, "ivar is: ", ivar
END DO
@ -263,13 +263,13 @@ PROGRAM do_issue_458
! Step expression
! REAL step expression
!PORTABILITY: DO controls should be INTEGER
!PORTABILITY: DO controls should be INTEGER [-Wreal-do-controls]
DO ivar = 1, 10, rvar
PRINT *, "ivar is: ", ivar
END DO
! DOUBLE PRECISION step expression
!PORTABILITY: DO controls should be INTEGER
!PORTABILITY: DO controls should be INTEGER [-Wreal-do-controls]
DO ivar = 1, 10, dvar
PRINT *, "ivar is: ", ivar
END DO
@ -280,13 +280,13 @@ PROGRAM do_issue_458
END DO
! Pointer to REAL step expression
!PORTABILITY: DO controls should be INTEGER
!PORTABILITY: DO controls should be INTEGER [-Wreal-do-controls]
DO ivar = 1, 10, prvar
PRINT *, "ivar is: ", ivar
END DO
! Pointer to DOUBLE PRECISION step expression
!PORTABILITY: DO controls should be INTEGER
!PORTABILITY: DO controls should be INTEGER [-Wreal-do-controls]
DO ivar = 1, 10, pdvar
PRINT *, "ivar is: ", ivar
END DO

View File

@ -316,7 +316,7 @@ subroutine s9()
! Technically non-conformant (F'2023 19.4 p8)
do concurrent (ivar = 1:10)
print *, "hello"
!PORTABILITY: Index variable 'ivar' should not also be an index in an enclosing FORALL or DO CONCURRENT
!PORTABILITY: Index variable 'ivar' should not also be an index in an enclosing FORALL or DO CONCURRENT [-Wodd-index-variable-restrictions]
do concurrent (ivar = 1:10)
print *, "hello"
end do
@ -392,7 +392,7 @@ subroutine s12()
call intentInOutSub(jvar, ivar)
do ivar = 1,10
!WARNING: Possible redefinition of DO variable 'ivar'
!WARNING: Possible redefinition of DO variable 'ivar' [-Windex-var-redefinition]
call intentInOutSub(jvar, ivar)
end do
@ -437,7 +437,7 @@ subroutine s13()
end do
do ivar = 1, 10
!WARNING: Possible redefinition of DO variable 'ivar'
!WARNING: Possible redefinition of DO variable 'ivar' [-Windex-var-redefinition]
jvar = intentInOutFunc(ivar)
end do

View File

@ -1,16 +1,16 @@
! RUN: %python %S/test_errors.py %s %flang_fc1 -Werror -pedantic
!PORTABILITY: nonstandard usage: generalized COMPLEX constructor
!PORTABILITY: Real part of complex constructor is not scalar
!PORTABILITY: nonstandard usage: generalized COMPLEX constructor [-Wcomplex-constructor]
!PORTABILITY: Real part of complex constructor is not scalar [-Wcomplex-constructor]
complex, parameter :: z1(*) = ([1.,2.], 3.)
!PORTABILITY: nonstandard usage: generalized COMPLEX constructor
!PORTABILITY: Imaginary part of complex constructor is not scalar
!PORTABILITY: nonstandard usage: generalized COMPLEX constructor [-Wcomplex-constructor]
!PORTABILITY: Imaginary part of complex constructor is not scalar [-Wcomplex-constructor]
complex, parameter :: z2(*) = (4., [5.,6.])
real, parameter :: aa(*) = [7.,8.]
!PORTABILITY: Real part of complex literal constant is not scalar
!PORTABILITY: Real part of complex literal constant is not scalar [-Wcomplex-constructor]
complex, parameter :: z3(*) = (aa, 9.)
!PORTABILITY: Imaginary part of complex literal constant is not scalar
!PORTABILITY: Imaginary part of complex literal constant is not scalar [-Wcomplex-constructor]
complex, parameter :: z4(*) = (10., aa)
!We need a nonzero exit status to make test_errors.py look at messages :-(
!WARNING: division by zero
!WARNING: division by zero [-Wfolding-exception]
real, parameter :: xxx = 1./0.
end

View File

@ -43,6 +43,6 @@ subroutine subr(da)
print *, empty(1:0,1) ! ok
print *, empty(:,1) ! ok
print *, empty(i:j,k) ! ok
!WARNING: Empty array dimension 1 should not be subscripted as an element or non-empty array section
!WARNING: Empty array dimension 1 should not be subscripted as an element or non-empty array section [-Wsubscripted-empty-array]
print *, empty(i,1)
end

View File

@ -20,7 +20,7 @@ program test
type(pdt(1)) x1(1)
type(pdt(2)) x2(1)
type(pdt(3)) x3(1)
!PORTABILITY: Variable 'x1([INTEGER(8)::1_8])' has a vector subscript and will be finalized by non-elemental subroutine 'finalarr'
!PORTABILITY: Variable 'x1([INTEGER(8)::1_8])' has a vector subscript and will be finalized by non-elemental subroutine 'finalarr' [-Wvector-subscript-finalization]
x1([1]) = pdt(1)()
x2([1]) = pdt(2)() ! ok, doesn't match either
x3([1]) = pdt(3)() ! ok, calls finalElem

Some files were not shown because too many files have changed in this diff Show More