[flang] Fix some Fortran and use existing messages for errors already caught.

Original-commit: flang-compiler/f18@2d360e78ea
Reviewed-on: https://github.com/flang-compiler/f18/pull/711
This commit is contained in:
peter klausler 2019-09-09 10:43:19 -07:00
parent 9dee00eccc
commit bf6ba0ff18
3 changed files with 11 additions and 10 deletions

View File

@ -163,7 +163,7 @@ public:
// C1139: call to impure procedure
if (name->symbol && !IsPureProcedure(*name->symbol)) {
context_.Say(currentStatementSourcePosition_,
"call to impure subroutine in DO CONCURRENT not allowed"_err_en_US);
"call to impure procedure in DO CONCURRENT not allowed"_err_en_US);
}
if (name->symbol && fromScope(*name->symbol, "ieee_exceptions"s)) {
if (name->source == "ieee_get_flag") {
@ -183,7 +183,7 @@ public:
.v.thing.component};
if (component.symbol && !IsPureProcedure(*component.symbol)) {
context_.Say(currentStatementSourcePosition_,
"call to impure subroutine in DO CONCURRENT not allowed"_err_en_US);
"call to impure procedure in DO CONCURRENT not allowed"_err_en_US);
}
}
}

View File

@ -254,7 +254,7 @@ module m01
end subroutine
subroutine test15() ! C1539
real, pointer :: a(10)
real, pointer :: a(:)
real, asynchronous :: b(10)
real, volatile :: c(10)
real, asynchronous, volatile :: d(10)

View File

@ -16,9 +16,10 @@
module m
type :: t
sequence
real :: a
end type
type(t) :: x
type(t), target :: x
type :: hasPtr
real, pointer :: p
end type
@ -34,9 +35,9 @@ pure function test(ptr, in)
type(t), pointer :: ptr, ptr2
type(t), target, intent(in) :: in
type(t), save :: co[*]
type(t) :: y, z
type(t), target :: y, z
type(hasPtr) :: hp
type(hasPtr) :: alloc
type(hasPtr), allocatable :: alloc
integer :: n
common /block/ y
! ERROR: A PURE subprogram must not define an object in COMMON.
@ -57,11 +58,11 @@ pure function test(ptr, in)
ptr2 => ptr ! C1594(3)
! ERROR: A PURE subprogram must not use an INTENT(IN) dummy argument as the target of pointer assignment.
ptr2 => in ! C1594(3)
! ERROR: A PURE subprogram must not use an object in COMMON as the target of pointer assignment.
! ERROR: Externally visible object 'block' must not be associated with pointer component 'p' in a PURE procedure
n = size([hasPtr(y%a)]) ! C1594(4)
! ERROR: A PURE subprogram must not use a USE-associated object as the target of pointer assignment.
! ERROR: Externally visible object 'x' must not be associated with pointer component 'p' in a PURE procedure
n = size([hasPtr(x%a)]) ! C1594(4)
! ERROR: A PURE function must not use a pointer dummy argument as the target of pointer assignment.
! ERROR: Externally visible object 'ptr' must not be associated with pointer component 'p' in a PURE procedure
n = size([hasPtr(ptr%a)]) ! C1594(4)
! ERROR: A PURE subprogram must not use an INTENT(IN) dummy argument as the target of pointer assignment.
n = size([hasPtr(in%a)]) ! C1594(4)
@ -73,7 +74,7 @@ pure function test(ptr, in)
pure subroutine internal
! ERROR: A PURE subprogram must not define a host-associated object.
z%a = 0.
! ERROR: A PURE subprogram must not use a host-associated object as the target of pointer assignment.
! ERROR: Externally visible object 'z' must not be associated with pointer component 'p' in a PURE procedure
hp = hasPtr(z%a)
end subroutine
end function