Skip to content

Conversation

@klausler
Copy link
Contributor

@klausler klausler commented Dec 2, 2025

A recent patch to descriptor.cpp added some code whose style isn't conforming with the rest of the file (or the runtime). We always use braces around initializations and nested statements, and don't indent "case" lines any more than their "switch". Further, it dumps a rank 0 descriptor as just "scalar", which is fine as an interpretation of the rank but should not entirely replace the rank in the dump output.

A recent patch to descriptor.cpp added some code whose style
isn't conforming with the rest of the file (or the runtime).
We always use braces around initializations and nested statements,
and don't indent "case" lines any more than their "switch".
Further, it dumps a rank 0 descriptor as just "scalar", which is
fine as an interpretation of the rank but should not entirely
replace the rank in the dump output.
@klausler klausler requested a review from valerydmit December 2, 2025 00:16
Copy link
Contributor

@valerydmit valerydmit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Peter for letting me know about flang-rt specific style requirements.

@valerydmit
Copy link
Contributor

Peter, will you mind if I take these changes for a reapply of the original patch?

@klausler
Copy link
Contributor Author

klausler commented Dec 2, 2025

Peter, will you mind if I take these changes for a reapply of the original patch?

Okay by me.

valerydmit added a commit to valerydmit/llvm-project that referenced this pull request Dec 2, 2025
valerydmit added a commit that referenced this pull request Dec 4, 2025
…extension. (#170389)

This is a reapply the original patch (#169137) with the flang-rt unit
test changes limiting it to linux platform only.
Additionally accommodated style changes from Peter Klausler (#170227)
    
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
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants