| 1 | ! audit31 Finding 9: `ref%data => pool(slot)(1:length)` used to |
| 2 | ! report the wrong entity — the sema pointer-assignment target |
| 3 | ! check ran extract_base_name, got `ref` (the struct base), and |
| 4 | ! complained that `ref` needed the pointer attribute even though |
| 5 | ! the real target is the `data` pointer component. Skip the |
| 6 | ! base-name attribute check when the target walks into a |
| 7 | ! component (we don't carry per-field attrs in the sema registry |
| 8 | ! today). Task #490. |
| 9 | ! CHECK: ok |
| 10 | module audit31_ptr_substr |
| 11 | implicit none |
| 12 | type :: str_ref |
| 13 | character(len=:), pointer :: data => null() |
| 14 | end type |
| 15 | character(len=64), target :: pool(4) |
| 16 | contains |
| 17 | subroutine intern(ref, slot, length) |
| 18 | type(str_ref), intent(inout) :: ref |
| 19 | integer, intent(in) :: slot, length |
| 20 | ref%data => pool(slot)(1:length) |
| 21 | end subroutine |
| 22 | end module |
| 23 | |
| 24 | program audit31_ptr_substr_driver |
| 25 | use audit31_ptr_substr |
| 26 | implicit none |
| 27 | print *, 'ok' |
| 28 | end program |
| 29 |