Skip to content

Backport upstream Valgrind fixes so its tests build with GCC 15 - #102

Merged
markro49 merged 3 commits into
codespecs:masterfrom
mernst:backport-gcc15-test-fixes
Oct 18, 2026
Merged

markro49 merged 3 commits into
codespecs:masterfrom
mernst:backport-gcc15-test-fixes

Conversation

@mernst

@mernst mernst commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

GCC 15 compiles C as C23 by default, where bool and thread_local are keywords and void (*)() means "takes no arguments". Three of Valgrind's test programs don't compile under C23, so make regtest stops before running any test. Ubuntu 26.04 uses GCC 15; #96's new regtest_ubuntu_26_04 CI job failed this way:

tc17_sembar.c:45:14: error: both 'long' and '_Bool' in declaration specifiers

This backports the three upstream Valgrind commits that fixed them (all in Valgrind 3.25.0), keeping upstream's authorship:

  • 932bf2c02 helgrind/tests/tc17_sembar.c: Remove bool typedef
  • 907b98572 drd/tests/swapcontext.c: Rename typedef struct thread_local to threadlocal
  • 8f6cef269 none/tests/bug234814.c: sa_handler take an int as argument

Each is a one-line change to a test program. The next Valgrind merge (3.27.1) includes them, so they will merge cleanly then.

This PR is based on master and doesn't depend on any other open PR. #96's regtest jobs need it on Ubuntu 26.04.

Testing

GCC 15 isn't available on my machine, so I tested with CI: a branch in my fork that merges this PR into #96 ran both regtest jobs. They built all the test programs and ran 787 tests on Ubuntu 26.04 (GCC 15) and 790 on Rocky Linux 10. No further GCC 15 build errors appeared.

Mark Wielaard added 3 commits October 16, 2026 18:03
Since C23 bool is a keyword. Also bool wasn't actually used.

tc17_sembar.c:45:14: error: both 'long' and '_Bool' in declaration specifiers
   45 | typedef long bool;
      |              ^~~~
tc17_sembar.c:45:1: warning: useless type name in empty declaration
   45 | typedef long bool;
      | ^~~~~~~
…local

Since C23 thread_local is a keyword (thread storage duration).

swapcontext.c:23:16: error: expected '{' before 'thread_local'
   23 | typedef struct thread_local {
      |                ^~~~~~~~~~~~
swapcontext.c:23:16: warning: 'thread_local' is not at beginning of declaration [-Wold-style-declaration]
swapcontext.c:23:16: error: 'thread_local' used with 'typedef'
swapcontext.c:26:3: warning: data definition has no type or storage class
   26 | } thread_local_t;
      |   ^~~~~~~~~~~~~~
GCC15 will turn this warning into an error:

bug234814.c: In function 'main':
bug234814.c:20:18: error: assignment to '__sighandler_t' {aka 'void (*)(int)'} from incompatible pointer type 'void (*)(void)' [-Wincompatible-pointer-types]
   20 |    sa.sa_handler = mysigbus;
      |                  ^
@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: codespecs/fjalar/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 9d41e769-c3a5-449c-8772-af2a87311c8b
📥 Commits

Reviewing files that changed from the base of the PR and between 4263218 and f6dca30.

📒 Files selected for processing: 3
  • valgrind/drd/tests/swapcontext.c
  • valgrind/helgrind/tests/tc17_sembar.c
  • valgrind/none/tests/bug234814.c

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

📝 Walkthrough

Three Valgrind test files have declaration changes. One renames a struct tag, one removes a file-scope typedef, and one adds an int parameter to a function declaration.

Priority: ➖ Normal

Change: Bug fix

Merge Risk: ⚪ Minimal · up to f6dca

This change makes three Valgrind regression test programs compile under GCC 15's C23 defaults. It does not touch production code, and no merge-blocking risk is evident.

Pre-merge checks: Passed 2 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 2 passed
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@mernst

mernst commented Oct 17, 2026

Copy link
Copy Markdown
Member Author

Tested: branch tmp-regtest-gcc15 in my fork merges this PR into #96. Its CI run (https://github.com/mernst/fjalar/actions/runs/38989244873) passed all six jobs, and both regtest jobs now build the test programs and run the tests: 787 tests on Ubuntu 26.04 (GCC 15) and 790 on Rocky Linux 10. Without this PR, make regtest stopped at tc17_sembar.c on Ubuntu 26.04 before running any test. No further GCC 15 build errors appeared.

@mernst

mernst commented Oct 17, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

mernst added a commit to mernst/fjalar that referenced this pull request Oct 17, 2026
- Valgrind plan: build before the baselines, because check-regtest.sh
  needs a built tree; save the build log with pipefail.
- Readelf plan: drop "make clean", which fails in a fresh clone before
  valgrind/Makefile exists; use pipefail so that a failed build stops.
- 3-way merge: require that "git status --porcelain --ignored valgrind"
  prints nothing, because "git add -A -f" adds ignored files.
- Valgrind plan: note that steps 3-6 and 10 still describe patch and
  make git-update until codespecs#99 and codespecs#103 land.
- plan-pre-upgrade.md: codespecs#102 depends on nothing (land it before codespecs#96);
  item 6 is done.
- Readelf plan: record ldd and nm -u output in the baseline, for the
  later comparison.
- Use "land", not "merge", for pull requests.
- Readelf plan: combine the two harvest_* bullets.
- Valgrind plan: say to install gdb and glibc debuginfo before the
  regtest baseline commands, not after them.
- Rewrap long lines.
mernst added a commit to mernst/fjalar that referenced this pull request Oct 17, 2026
…tracked files; run the Kvasir baseline once; note that codespecs#105 contains codespecs#96 and codespecs#96 contains codespecs#102; describe check-regtest.sh's post-test-check log and --report-only
@mernst

mernst commented Oct 17, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@mernst

mernst commented Oct 18, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@mernst

mernst commented Oct 18, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@markro49
markro49 merged commit f57698c into codespecs:master Oct 18, 2026
6 checks passed
@markro49
markro49 deleted the backport-gcc15-test-fixes branch October 18, 2026 23:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants