Fix/f alaska warnings - #19
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Resolves 40 of the 41 compile warnings in
f_alaska.f:type_conversion(29) andtab_character(11). No numerical change.type_conversionwarnings are all one pattern — aREAL*8coefficient or intermediate being narrowed on assignment to aREAL*4variable — spread across three of the four routines (SHP_AK 11,COR_AK 1,VAR_AK 17;FDBT_AKis entirely single precision and warns only for its unused dummy). The narrowing is intended, and the code says so at line 162 (These outcomes are SINGLE precision), so it is now handled explicitly withREAL(). As inf_other.fthere are noDATAliteral fixes:F,SUBFandVare all genuinelyREAL*8, so noDATAstatement in this file warns at all.f_west.f(Fix: f west warnings #14) —SHP_AKand theSHP_W*routines share that logit block verbatim, so most of this diff is a mechanical replay of an accepted change.SHP_AKlines 113–114 andVAR_AKline 393 are the trap in this batch, and they are worth a reviewer's attention.DMEDIAN,DFORMandDRATIOare declaredREAL*4here butREAL*8in both sibling files (f_west.f:33,171,321,f_other.f:184,521) — which is exactly why the identical statements atf_west.f:74-75andf_other.f:301-302,634-635produce no warning. Widening the declarations to match is arguably the correct fix, but it would change every downstreamU1–U9value, so these are wrapped and the divergence is recorded as a latent defect instead.f_other.f:876had: its double precision comes solely from the1.0d0literal inside an arithmetic expression, not from aDATAinitializer, so demoting it to1.0e0would evaluate the subtraction in single precision and could move results. Wrapped; literal untouched.tab_characterwas 11 leading hard tabs (lines 102–104, 107, 109–111, 233, 234, 368, 369), each replaced with exactly 6 spaces. gfortran's fixed-form extension already advances a column-1 tab to column 7, so every effective column is unchanged — a provable whitespace no-op. None of these lines carried atype_conversionwarning, so the two edit sets do not interact.Repo total 1,984 → 1,944; Tier A 240 → 211; no new warnings.
f_alaska.fdrops 41 → 1, the remainder being the unusedsetoptdummy inFDBT_AK, which cannot be dropped becausesf_shp.f:28dispatches it through the same signature as the otherFDBT_*bark routines. Documented inwarnings_progress.mdrather than suppressed.Five latent defects found while working in the file are recorded in the Reported to upstream separately table rather than fixed, since each would move numbers or change dispatch. The significant one is that
SHP_AKpatches its implicitly-SAVEdFarray in place (lines 107–111) and never restores it, so the firstGEOSUB=='01'spruce/hemlock call corrupts the coefficients for the life of the process. Measured on the pre-fix library, a singleA01F32W098call moves a subsequentA00F32W098from 107.5 to 113.3 cuft (+5.4%) and 450 to 510 bdft (+13.3%), with two product fields collapsing to zero. It is currently unreachable through the shipped tables — the onlyA01equations areA01BRUW202,A01DEMW000,A01DVEW094,A01DVEW375andA01DVEW747, none of which satisfyVOLEQ(4:4)=='F'— so it is a latent landmine rather than a live bug, andf_ingy.f:280-300solves the same problem correctly with a rebuilt scratch column. A fix is planned as Batch 1d, deliberately kept out of this PR so the no-op claim here stays clean.Testing
None of the 57 existing goldens reached this file — every one is region 2, 3, 4, 6 or 9, and Alaska dispatch needs
VOLEQ(1:1)=='A'withVOLEQ(4:4)=='F'and a species in{042, 242, 098, 260, 263, 264}. So 18 new cases were added and committed before any source edit: 12vollib_rcovering all fourSHP_AKcoefficient sets and all sixFDBT_AKspecies branches across both the 2-point and 3-point entry paths, plus 6getvoleq_r.The
vollib_rcases useA00F32W*/A02F32W*rather than hand-built strings, because those are the equationsR10_EQNactually returns — so the 6getvoleq_rcases assert the routing instead of it being asserted by hand. Doing that surfaced a gap worth flagging on review:tests/test_getvoleq.pyonly ever asserted one hardcoded case name, so the new lookups would have been recorded intocases.jsonand then never checked. It is now parametrized over everygetvoleq_rcase, which also brings a pre-existing case under assertion for the first time.Coverage was measured rather than assumed. A gcov build confirms the 18 cases execute all 29 edited lines. Only one of them is conditional — line 168, under
IF (U5 .le. 7.0d0)withR5=1.0in theelse— and it records 16 executions against 24 for its neighbours, so both branches are genuinely exercised rather than the line merely being reached.Bit-exactness was checked the same way as #17: pre- and post-edit
libnvel.soloaded side by side and called with identical inputs over 3,300 cases (all 12 reachable Alaska equations crossed with a dbh / height / merch-top / stump / upper-stem grid, including an upper-stem point below breast height), with all 15vol[]components anderrflagcompared byte for byte. Every case matched. The sweep is smaller than the 12,960 of Batch 1b simply because Alaska has 12 reachable equations tof_other.f's 18; what makes the number meaningful is the harness check — perturbingF(10,1)in its 6th decimal produced 539 mismatches, and they fell exactly in the two species-042 equations, which is the precise blast radius for that coefficient.pytest 86/86, warnings rebaselined, lint clean.