Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uninitialized variable in unit tests #38

Closed
2 tasks done
jphickey opened this issue Jan 16, 2023 · 0 comments · Fixed by #39
Closed
2 tasks done

Uninitialized variable in unit tests #38

jphickey opened this issue Jan 16, 2023 · 0 comments · Fixed by #39
Assignees
Milestone

Comments

@jphickey
Copy link
Contributor

Checklist (Please check before submitting)

  • I reviewed the Contributing Guide.
  • I performed a cursory search to see if the bug report is relevant, not redundant, nor in conflict with other tickets.

Describe the bug
Compiling the latest HK app with the latest GCC version (12.x) produces a warning about uninitialized variable in the unit test:

[ 93%] Building C object apps/hk/unit-test/CMakeFiles/coverage-hk-hk_app-testrunner.dir/hk_app_tests.c.o
/home/joe/code/cfecfs/github/apps/hk/unit-test/hk_app_tests.c: In function ‘Test_HK_HousekeepingCmd’:
/home/joe/code/cfecfs/github/apps/hk/unit-test/hk_app_tests.c:1235:5: error: ‘DummyMsg’ may be used uninitialized [-Werror=maybe-uninitialized]
 1235 |     HK_HousekeepingCmd(&DummyMsg);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/joe/code/cfecfs/github/apps/hk/unit-test/hk_app_tests.c:24:
/home/joe/code/cfecfs/github/apps/hk/unit-test/../fsw/src/hk_app.h:181:6: note: by argument 1 of type ‘const CFE_MSG_CommandHeader_t *’ {aka ‘const struct CFE_MSG_CommandHeader *’} to ‘HK_HousekeepingCmd’ declared here
  181 | void HK_HousekeepingCmd(const CFE_MSG_CommandHeader_t *Msg);
      |      ^~~~~~~~~~~~~~~~~~

To Reproduce
Add HK to latest CFS bundle, build using default config.

Expected behavior
Should build cleanly

System observed on:
Debian (Latest version, with GCC 12.2)

Reporter Info
Joseph Hickey, Vantage Systems, Inc.

@jphickey jphickey added the bug label Jan 16, 2023
@jphickey jphickey self-assigned this Jan 16, 2023
jphickey added a commit to jphickey/HK that referenced this issue Jan 16, 2023
dzbaker added a commit that referenced this issue Jan 19, 2023
Fix #38, correct uninitialized variable in UT
@dmknutsen dmknutsen added this to the Equuleus milestone May 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants