Skip to content

Commit f4a754b

Browse files
committed
document show_descriptor intrinsic
1 parent 685e3a1 commit f4a754b

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

flang/docs/Intrinsics.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1379,3 +1379,45 @@ This is prefixed by `STRING`, a colon and a space.
13791379
- **Standard:** GNU extension
13801380
- **Class:** subroutine
13811381
- **Syntax:** `CALL PERROR(STRING)`
1382+
1383+
### Non-Standard Intrinsics: SHOW_DESCRIPTOR
1384+
1385+
#### Description
1386+
`SHOW_DESCRIPTOR(VAR)` prints (on the C stderr stream) a contents of a descriptor for the variable VAR,
1387+
which can be of any type and rank, including scalars.
1388+
Requires use of flang_debug module.
1389+
1390+
Here is an example of its output:
1391+
```
1392+
Descriptor @ 0x7ffe506fc368:
1393+
base_addr 0x55944caef0f0
1394+
elem_len 4
1395+
version 20240719
1396+
rank 1
1397+
type 9 "INTEGER(kind=4)"
1398+
attribute 2 (allocatable)
1399+
extra 0
1400+
addendum 0
1401+
alloc_idx 0
1402+
dim[0] lower_bound 1
1403+
extent 5
1404+
sm 4
1405+
```
1406+
1407+
#### Usage and Info
1408+
- **Standard:** flang extension
1409+
- **Class:** subroutine
1410+
- **Syntax:** `CALL show_descriptor(VAR)`
1411+
1412+
#### Example
1413+
```Fortran
1414+
subroutine test
1415+
use flang_debug
1416+
implicit none
1417+
character(len=9) :: c = 'Hey buddy'
1418+
integer :: a(5)
1419+
call show_descriptor(c)
1420+
call show_descriptor(c(1:3))
1421+
call show_descriptor(a)
1422+
end subroutine test
1423+
```

0 commit comments

Comments
 (0)