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

New compile warnings with GCC 11.x #1199

Closed
jphickey opened this issue Jan 6, 2022 · 4 comments · Fixed by #1203
Closed

New compile warnings with GCC 11.x #1199

jphickey opened this issue Jan 6, 2022 · 4 comments · Fixed by #1203
Assignees
Milestone

Comments

@jphickey
Copy link
Contributor

jphickey commented Jan 6, 2022

Describe the bug
The newer versions of GCC report new warnings. These appear to be mostly false alarms, but easy to fix nonetheless.

To Reproduce
Build OSAL using recent GCC

Expected behavior
Should compile without warnings or errors

Code snips

osal/src/unit-test-coverage/vxworks/src/coveragetest-tasks.c: In function ‘Test_OS_TaskDetach_Impl’:
src/unit-test-coverage/vxworks/src/coveragetest-tasks.c:151:28: error: ‘token’ may be used uninitialized [-Werror=maybe-uninitialized]
src/unit-test-coverage/shared/src/coveragetest-clock.c: In function ‘Test_OS_SetLocalTime’:
src/unit-test-coverage/shared/src/coveragetest-clock.c:55:26: error: ‘time_struct’ may be used uninitialized [-Werror=maybe-uninitialized]
osal/src/unit-tests/oscore-test/ut_oscore_task_test.c: In function ‘UT_os_task_getid_by_sysdata_test’:
osal/src/unit-tests/inc/ut_os_support.h:112:28: error: ‘sysdata’ may be used uninitialized [-Werror=maybe-uninitialized]

System observed on:
Ubuntu 21.10, gcc 11.2.0

Reporter Info
Joseph Hickey, Vantage Systems, Inc.

@kurtjd
Copy link
Contributor

kurtjd commented Jan 8, 2022

I wouldn't mind tackling this, however I am having trouble replicating the issue. I'm using the same version of GCC on Pop!_OS, but building OSAL standalone doesn't seem to output any errors. My method of building is the one listed in the OSAL Configuration Guide:

$ mkdir build
$ cd build
$ cmake \
    -DCMAKE_BUILD_TYPE=debug \
    -DENABLE_UNIT_TESTS=true \
    -DOSAL_SYSTEM_BSPTYPE=generic-linux \
    -DOSAL_CONFIG_DEBUG_PERMISSIVE_MODE=true \
     /path/to/osal/source
$ make

I also tried adding -DOSAL_USER_C_FLAGS=-Werror but this didn't seem to provide any error output either.

@skliper
Copy link
Contributor

skliper commented Jan 10, 2022

My guess is these warnings were observed when compiling OSAL from within the bundle context (https://github.com/nasa/cFS). There's additional warnings enabled here (if/when you copy in the sample_defs to the bundle context):
https://github.com/nasa/cFE/blob/c161cf04fe7c5fd2f2a533ac1d7522b31191eab6/cmake/sample_defs/arch_build_custom.cmake#L28-L37

@jphickey
Copy link
Contributor Author

It requires a very recent version of GCC (11+). IIRC Pop OS is based on 20.04 so that's too old.

I actually have fix already, I patched it up so I could build on this system (Ubuntu 21.10), but haven't made a PR yet.

@kurtjd
Copy link
Contributor

kurtjd commented Jan 10, 2022

Oh ok, yeah I have the latest version of GCC but I wasn't building as part of the bundle. Thanks for the clarification!

astrogeco added a commit that referenced this issue Jan 19, 2022
Fix #1199, correct warnings on gcc11

 # Please enter a commit message to explain why this merge is necessary,
@skliper skliper added this to the Draco milestone Mar 25, 2022
jphickey pushed a commit to jphickey/osal that referenced this issue Aug 10, 2022
jphickey pushed a commit to jphickey/osal that referenced this issue Aug 10, 2022
Fix nasa#1199, Add workflow to build cFE documentation
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.

3 participants