| 1 | ! audit31 Finding 6: a FUNCTION taking `xs(:)` received a raw |
| 2 | ! element pointer instead of a descriptor because lower_expr_full |
| 3 | ! didn't consult the descriptor_params mask (only the Stmt::Call |
| 4 | ! path did). size(xs) then read zeros out of the raw pointer. |
| 5 | ! Thread descriptor_params as an optional arg through |
| 6 | ! lower_expr_full and emit lower_arg_descriptor for any callee |
| 7 | ! param flagged as descriptor-backed. Task #487. |
| 8 | ! CHECK: 6 |
| 9 | program audit31_func_assumed |
| 10 | implicit none |
| 11 | integer :: data(6), i |
| 12 | do i = 1, 6 |
| 13 | data(i) = i |
| 14 | end do |
| 15 | print *, arr_size(data) |
| 16 | contains |
| 17 | function arr_size(xs) result(r) |
| 18 | integer, intent(in) :: xs(:) |
| 19 | integer :: r |
| 20 | r = size(xs) |
| 21 | end function |
| 22 | end program |
| 23 |