llvm-project/flang/module/flang_debug.f90
Valery Dmitriev e7748e92cd
[flang] implement show_descriptor intrinsic, a non-standard extension (#169137)
show_descriptor intrinsic prints details of a descriptor (extended
Fortran pointer).
It accepts a descriptor for any type and rank, including scalars.
Requires use of flang_debug module.

Example:
program test
  use flang_debug
  implicit none
  integer :: a(4) = (/ 1,3,5,7 /)
  call show_descriptor(a(1:3))
end program test

and its output:
Descriptor @ 0x7ffe01ec6a98:
  base_addr 0x563b7035103c
  elem_len  4
  version   20240719
  rank      1
  type      9 "INTEGER(kind=4)"
  attribute 0
  extra     0
    addendum  0
    alloc_idx 0
  dim[0] lower_bound 1
         extent      3
         sm          4
2025-12-01 13:53:13 -08:00

15 lines
492 B
Fortran

!===-- module/flang_debug.f90 ----------------------------------------------===!
!
! Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
! See https://llvm.org/LICENSE.txt for license information.
! SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
!
!===------------------------------------------------------------------------===!
module flang_debug
use __fortran_builtins, only: &
show_descriptor => __builtin_show_descriptor
end module flang_debug