Windows CI: a 1-row netCDF grid is read back with a collapsed y range (test/grdtrend/trend_xy_plot.sh)
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 15/100
Research direction
The bug is in gmtnc_grd_info in src/gmt_nc.c, where the y range of a 1-row grid comes only from actual_range (around lines 774-803). Reproduce with gmt grdmath to make row.grd, then gmt grdinfo -C row.grd, and compare with test/grdtrend/trend_xy_plot.sh. Done means a 1-row grid reads back with y range -0.2/0.2 on the Windows CI build, without the #pragma optimize workaround. The maintainers have not chosen a fix yet, so confirm the approach first.
Written by the indexing model from the issue text.
Description
I asked Claude to look for a solution to the failure of this test in the Windows CI, and this is its analysis. I am posting it to ask what you prefer to do about it.
test/grdtrend/trend_xy_plot.sh fails only in the Windows CI (MSVC 14.51.36231, Visual Studio 2026 image, Release /O2 /Ob2 /DNDEBUG, vcpkg netCDF 4.9.3): grdtrend prints Grid y increment <= 0.0 [data.grd] and crashes. I would like to ask what you prefer for this one, because I could not find the root cause.
What fails. The grid written by grdmath is valid and reads fine on Linux and through GDAL, but on the Windows CI the same call reads a 6x1 grid with y range 0/0:
gmt grdmath -R-1.2/1.2/-0.2/0.2 -I0.4 -r 0.5 X ADD X X MUL ADD X 3 POW ADD = row.grd
gmt grdinfo -C row.grd
- good:
row.grd -1.2 1.2 -0.2 0.2 -0.5 3.5 0.4 0.4 6 1 1 0 - CI:
row.grd -1.2 1.2 0 0 -0.5 3.5 0.4 0 6 0 1 0(y range 0/0, y_inc 0, 0 rows)
It fails when the test runs alone (no -j4), and also outside the test (https://github.com/GenericMappingTools/gmt/actions/runs/38145255398). A 1-column x 6-row grid reads fine, GDAL reads y#actual_range={-0.2,0.2} fine, and the only netcdf.dll copies on PATH are vcpkg's. For a 1-row grid the y range comes only from actual_range (there is no usable y vector), in the y block of gmtnc_grd_info (src/gmt_nc.c, around lines 774-803); the x block has the same structure.
What I tried.
- Any debug print inside
gmtnc_grd_info, even a passive one, makes the failure disappear. #pragma optimize("", off)aroundgmtnc_grd_infoonly, with nothing else changed, makes the test pass (https://github.com/GenericMappingTools/gmt/actions/runs/38176185877).- ASAN and UBSAN builds on Linux find nothing in this path, and I found no undefined behaviour by reading it.
- A
gmt 6.8.0_f6039ecbuild from September on a Windows 10 PC reads the grid correctly, but I don't know its toolset or flags.gmtnc_grd_infois identical to the one in master.
So it looks like an optimizer problem (compiler bug or an undefined behaviour that /O2 exploits), but I could not prove either.
Questions.
- Does anyone with a local MSVC 14.50 or 14.51 build reproduce the
grdinfooutput above? - The 6.7.0 Windows binaries were linked with MSVC 14.50. Does the official 6.7.0 binary read the 1-row grid correctly? If not, users are affected and not only the test.
- How do you prefer to handle it: (a) the
#pragma optimizechange above, guarded by_MSC_VER(I have a 6-line patch ready), (b) mark the test with# GMT_KNOWN_FAILURE_WINDOWS, or (c) something else?
Reviewed with Claude Opus 5.5 (read-only review of the analysis). Written with Claude Sonnet 5.5.
- Dominant language
- C
- Stars
- 997
- Forks
- 420
- Avg merge
- 13h 27m
- Merged PRs (30d)
- 47
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from GenericMappingTools/gmt
-
Add support for SCM 9.0.0 to GMTPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
GenericMappingTools/gmt#9316 · 10 comments · 1 reaction ·
Maintainers usually reply within 1 day
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
GenericMappingTools/gmt#5767 · 15 comments ·
Maintainers usually reply within 1 day
-
discussion
Difficulty 5/5 Over a week Newbie friendliness 35/100
GenericMappingTools/gmt#9343 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 45/100
GenericMappingTools/gmt#9331 · 1 reaction ·
Maintainers usually reply within 1 day
-
histogram: the min/max setting in -T is ignored when -R is setPossibly taken @seisman claimed this 1 day ago. Openbug
Difficulty 3/5 1-2 days Newbie friendliness 55/100
GenericMappingTools/gmt#9330 · 1 reaction ·
Maintainers usually reply within 1 day
All issues in GenericMappingTools/gmt
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Broken links in reference manualPossibly taken @farisbasha claimed this 14 days ago. Opencore:meson
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
mpv-player/mpv#18934 · 3 comments ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
libsndfile/libsndfile#1239 ·