Skip to content

Uninitialized read into Re_avg on dead viscous lanes (UB; FP-trap hazard in debug builds) #1567

Description

@sbryngelson

Symptom: results-inert today (every consumer is gated on the matching Re_size lane), but the code computes 2/(1/uninitialized) — undefined behavior that can trap in debug/FPE builds.

Mechanism: the unguarded do i = 1, 2 Reynolds-averaging loops (src/simulation/m_riemann_solvers.fpp:480-484, :1965-1968, :2627-2630, :3045-3048 on master) write both lanes of Re_avg_rs*_vf even when Re_size(2)==0, in which case the HLLC fill loop never initializes Re_L(2)/Re_R(2).

Introduced: the unguarded form dates to the 2022 GPU development merge (6def75421, @anandrdbz, pre-PR era), when the lane was garbage-but-defined via dflt_real; it became genuinely uninitialized when #1035 dropped that initialization (2025-11-13). Tagging @anandrdbz for context.

Fix: pending in the Phase-3 refactoring series (stacked on #1556): the extracted Reynolds helper writes a defined 1/sgm_eps into dead lanes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions