GCC 15.2: -Wcast-qual warning - cast discards const qualifier from pointer target type (H5trace.c)

Open Beginner friendly
#6,878 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
73/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
c
Domain
backend

Research direction

Start in src/H5trace.c at line 253 and inspect the cast that GCC 15.2 reports under -Wcast-qual. Check how the pointer is used nearby, then choose a const-correct change or document why the cast is intentional. Rebuild the matio OSS-Fuzz configuration referenced in the issue and confirm the warning is resolved.

Written by the indexing model from the issue text.

Description

From matio OSS-Fuzz build on Ubuntu 26.04 with GCC 15.2 (run 43303909994/job/131482003978).

GCC 15.2 emits a -Wcast-qual warning where a cast explicitly discards a const qualifier from a pointer target type:
src/H5trace.c:253:24: warning: cast discards 'const' qualifier from pointer target type [-Wcast-qual]

Suggested fix: Replace explicit const-cast with a const-correct design (use const-qualified locals instead of discarding const), or add explanatory comments if intentional const-cast is required.

Reference: https://github.com/tbeu/matio/actions/runs/43303909994/job/131482003978

Dominant language
C
Stars
1k
Forks
372
Avg merge
2d 15h
Merged PRs (30d)
57

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from HDFGroup/hdf5

All issues in HDFGroup/hdf5

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.