MALLOC and FREE are extensions provided by gfortran, Intel Fortran and classic flang to allocate memory for Cray pointers. These are used in some legacy codes such as libexodus. All the above compilers accept using MALLOC and FREE with integers as well, despite that this will often signify a bug in user code. We should accept the same as the other compilers for compatibility.
34 lines
726 B
Fortran
34 lines
726 B
Fortran
! RUN: %python %S/test_errors.py %s %flang_fc1 -Werror
|
|
|
|
! Accept free of cray pointer without warning
|
|
subroutine free_cptr()
|
|
integer :: x
|
|
pointer(ptr_x, x)
|
|
call free(ptr_x)
|
|
end subroutine
|
|
|
|
subroutine free_i8()
|
|
integer(kind=1) :: x
|
|
! WARNING: FREE should only be used with Cray pointers
|
|
call free(x)
|
|
end subroutine
|
|
|
|
|
|
subroutine free_i16()
|
|
integer(kind=2) :: x
|
|
! WARNING: FREE should only be used with Cray pointers
|
|
call free(x)
|
|
end subroutine
|
|
|
|
subroutine free_i32()
|
|
integer(kind=4) :: x
|
|
! WARNING: FREE should only be used with Cray pointers
|
|
call free(x)
|
|
end subroutine
|
|
|
|
subroutine free_i64()
|
|
integer(kind=8) :: x
|
|
! WARNING: FREE should only be used with Cray pointers
|
|
call free(x)
|
|
end subroutine
|