You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
s_assign_default_values_to_user_inputs is still a hand-maintained ~200-line assignment list per executable (a shared core was factored in #1552, but the values themselves remain Fortran literals divorced from the registry). This is another manual mirror: a parameter's existence, its Fortran declaration, its namelist binding, and its broadcast are now all generated from toolchain/mfc/params/definitions.py — but its default lives elsewhere, in three places, with nothing keeping new parameters from silently defaulting to whatever the compiler leaves in memory if the author forgets the assignment line.
This was considered during the parameter-pipeline work and deliberately deferred ("registry-driven default VALUES would need per-param default metadata — a separate proposal"). The pipeline is mature now; this is its natural completion.
Proposal
Add a default= field to the registry's parameter definitions (_r(...)), with the existing sentinel conventions (dflt_real, dflt_int, .false., literals) expressible symbolically.
Generate a per-target generated_defaults.fpp include containing the assignments, emitted by the existing generator into the existing include machinery (15 generated files become 18).
Step 1 (mechanical, large-ish): transcribe current defaults from the three s_assign_default_values_to_user_inputs into the registry — scriptable by parsing the existing assignments; the script's output should be reviewed against all three targets since defaults occasionally differ per target (e.g. precision differs between pre and post — per-target overrides need a representation, e.g. default={"pre": 2, "post": "dflt_int"}).
Step 2: generate_defaults_fpp(target) + tests, mirroring generate_bcast_fpp exactly (that generator's structure, residue handling, and equivalence-verification method transfer one-to-one).
Step 3: equivalence gate — the emitted assignment set per target must equal the deleted hand-written set, statement-for-statement (the established seed-pinned multiset comparison), followed by the full golden suite.
Effort: moderate. Risk: low-moderate (the per-target-divergent defaults are the trap; the equivalence check catches them).
Evidence base: #1564 (an allocation-guard/default interaction) and the rank-0-vs-defaults semantics that made #1559 subtle both trace to defaults being hand-scattered.
Motivation
s_assign_default_values_to_user_inputsis still a hand-maintained ~200-line assignment list per executable (a shared core was factored in #1552, but the values themselves remain Fortran literals divorced from the registry). This is another manual mirror: a parameter's existence, its Fortran declaration, its namelist binding, and its broadcast are now all generated fromtoolchain/mfc/params/definitions.py— but its default lives elsewhere, in three places, with nothing keeping new parameters from silently defaulting to whatever the compiler leaves in memory if the author forgets the assignment line.This was considered during the parameter-pipeline work and deliberately deferred ("registry-driven default VALUES would need per-param default metadata — a separate proposal"). The pipeline is mature now; this is its natural completion.
Proposal
default=field to the registry's parameter definitions (_r(...)), with the existing sentinel conventions (dflt_real,dflt_int,.false., literals) expressible symbolically.generated_defaults.fppinclude containing the assignments, emitted by the existing generator into the existing include machinery (15 generated files become 18).Execution sketch
s_assign_default_values_to_user_inputsinto the registry — scriptable by parsing the existing assignments; the script's output should be reviewed against all three targets since defaults occasionally differ per target (e.g.precisiondiffers between pre and post — per-target overrides need a representation, e.g.default={"pre": 2, "post": "dflt_int"}).generate_defaults_fpp(target)+ tests, mirroringgenerate_bcast_fppexactly (that generator's structure, residue handling, and equivalence-verification method transfer one-to-one).Evidence base: #1564 (an allocation-guard/default interaction) and the rank-0-vs-defaults semantics that made #1559 subtle both trace to defaults being hand-scattered.