Skip to content

post_process reads offset_x/y/z before first assignment when building output_offsets #1788

Description

@sbryngelson

Found in review of the common-stage-independence refactor.

src/post_process/m_start_up.fpp:942:

output_offsets = (/offset_x, offset_y, offset_z/)
call s_mpi_decompose_computational_domain(..., output_offsets=output_offsets)
offset_x = output_offsets(1)
...

offset_x/y/z are read here before their first assignment (they are assigned in s_mpi_decompose_computational_domain, src/common/m_mpi_common.fpp:462-475, which runs after this line).

On the num_procs == 1 .and. parallel_io early return — and in any non-MPI build — s_apply_decomposition_policies never runs, so the copy-back at 944-946 writes undefined int_bounds_info values back into offset_x/y/z.

Currently masked because those values are re-zeroed later, so there is no observable symptom today. A --debug build with -finit-* would expose it, and it is fragile to any reordering.

Suggested fix: zero output_offsets before the call, or declare the dummy intent(out).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions