diff --git a/flang/lib/Semantics/resolve-names.cpp b/flang/lib/Semantics/resolve-names.cpp index aef2898919f3f..6a920cff83b51 100644 --- a/flang/lib/Semantics/resolve-names.cpp +++ b/flang/lib/Semantics/resolve-names.cpp @@ -8958,9 +8958,9 @@ void ResolveNamesVisitor::FinishSpecificationPart( ? currScope().symbol()->detailsIf() : nullptr}) { if (auto attrs{subp->cudaSubprogramAttrs()}) { - if (*attrs != common::CUDASubprogramAttrs::Device || - *attrs != common::CUDASubprogramAttrs::Global || - *attrs != common::CUDASubprogramAttrs::Grid_Global) { + if (*attrs == common::CUDASubprogramAttrs::Device || + *attrs == common::CUDASubprogramAttrs::Global || + *attrs == common::CUDASubprogramAttrs::Grid_Global) { inDeviceSubprogram = true; } } diff --git a/flang/test/Semantics/modfile55.cuf b/flang/test/Semantics/modfile55.cuf index 6c0d152a382a8..90c384cbd55b9 100644 --- a/flang/test/Semantics/modfile55.cuf +++ b/flang/test/Semantics/modfile55.cuf @@ -14,6 +14,10 @@ module m attributes(host,device) real function foo(x) foo = x + 1. end function + attributes(host) subroutine hostsub(a) + integer, intent(out) :: a(14) + a = 99 + end subroutine end !Expect: m.mod @@ -39,4 +43,7 @@ end !real(4)::x !real(4)::foo !end +attributes(host)subroutinehostsub(a) +integer(4),intent(out)::a(1_8:14_8) +end !end