Skip to content

Silence -Wmaybe-uninitialized#56

Open
RhysU wants to merge 1 commit intoimb:masterfrom
RhysU:silence_maybe_uninit
Open

Silence -Wmaybe-uninitialized#56
RhysU wants to merge 1 commit intoimb:masterfrom
RhysU:silence_maybe_uninit

Conversation

@RhysU
Copy link
Contributor

@RhysU RhysU commented Jan 16, 2026

Addresses a warning that GCC 15.2.0 emits...

In function ‘fct_nlist__clear’,
    inlined from ‘fct_nlist__final’ at tests/fct.h:751:5,
    inlined from ‘fct_test__del’ at tests/fct.h:956:5,
    inlined from ‘fct_test__del’ at tests/fct.h:950:1,
    inlined from ‘fct_test_new’ at tests/fct.h:991:9:
tests/fct.h:736:41: warning: ‘((fct_nlist_t *)test)[1].used_itm_num’ may be used uninitialized [-Wmaybe-uninitialized]
  736 |         for ( itm_i__=0; itm_i__ != list->used_itm_num; ++itm_i__ )
      |                                     ~~~~^~~~~~~~~~~~~~

...where the fix is to always 0-initialize two members, even when the initialization function bails out early.

Addresses a warning that GCC 15.2.0 emits...

  In function ‘fct_nlist__clear’,
      inlined from ‘fct_nlist__final’ at tests/fct.h:751:5,
      inlined from ‘fct_test__del’ at tests/fct.h:956:5,
      inlined from ‘fct_test__del’ at tests/fct.h:950:1,
      inlined from ‘fct_test_new’ at tests/fct.h:991:9:
  tests/fct.h:736:41: warning: ‘((fct_nlist_t *)test)[1].used_itm_num’ may be used uninitialized [-Wmaybe-uninitialized]
    736 |         for ( itm_i__=0; itm_i__ != list->used_itm_num; ++itm_i__ )
        |                                     ~~~~^~~~~~~~~~~~~~

...where the fix is to always 0-initialize two members,
even when the initialization function bails out early.
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.

1 participant