Skip to content

vunit: Isolate single test run to avoid release mode clobbered warning#89

Merged
Grillo-0 merged 1 commit intodevelopfrom
colbbered
Sep 11, 2025
Merged

vunit: Isolate single test run to avoid release mode clobbered warning#89
Grillo-0 merged 1 commit intodevelopfrom
colbbered

Conversation

@Grillo-0
Copy link
Copy Markdown
Member

@Grillo-0 Grillo-0 commented Sep 11, 2025

When compiling in release mode with gcc the folowing error appears:

../subprojects/vunit/vunit.c:In function ‘__vunit_main’:
../subprojects/vunit/vunit.c:96:16: error: variable ‘num’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Werror=clobbered]
   96 |         size_t num = 0;
      |                ^~~

This happening because the compiler inlines the function get_num_tests() called in function the uses setjmp (__vunit_main()).

To fix that, isolate the procedure inside the loop that runs a single test and has the setjmp.

@Grillo-0 Grillo-0 requested review from JeanJPNM and artP2 September 11, 2025 02:21
@Grillo-0 Grillo-0 self-assigned this Sep 11, 2025
When compiling in release mode with gcc the folowing error appears:

../subprojects/vunit/vunit.c: In function ‘__vunit_main’:
../subprojects/vunit/vunit.c:96:16: error: variable ‘num’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Werror=clobbered]
   96 |         size_t num = 0;
      |                ^~~

This happening because the compiler inlines the function
get_num_tests() called in function the uses setjmp (__vunit_main()).

To fix that, isolate the procedure inside the loop that runs a single
test and has the setjmp.
@Grillo-0 Grillo-0 merged commit 7cdccf1 into develop Sep 11, 2025
2 checks passed
@Grillo-0 Grillo-0 deleted the colbbered branch September 11, 2025 16:01
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