Files
clang-p2996/flang/test/Semantics/free.f90
David Truby 78ccffc053 [flang] Add MALLOC and FREE intrinsics for Cray pointers (#110018)
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.
2024-09-30 22:40:16 +01:00

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