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

Remaining alignment warnings in unit test #679

Closed
jphickey opened this issue May 6, 2020 · 0 comments · Fixed by #712
Closed

Remaining alignment warnings in unit test #679

jphickey opened this issue May 6, 2020 · 0 comments · Fixed by #712
Assignees
Milestone

Comments

@jphickey
Copy link
Contributor

jphickey commented May 6, 2020

Describe the bug
There are a few remaining warnings in the unit test stubs and test cases when compiling on an architecture that has strict alignment requirements.

To Reproduce
Build with ENABLE_UNIT_TESTS=true on a platform that requires strict alignment (e.g. SPARC, MIPS, etc).

Expected behavior
Should compile cleanly

Code snips
Example error (first one to appear in my build):

/home/joe/code/cfecfs/github/cfe/fsw/cfe-core/ut-stubs/ut_es_stubs.c: In function ‘CFE_ES_GetPoolBuf’:
/home/joe/code/cfecfs/github/cfe/fsw/cfe-core/ut-stubs/ut_es_stubs.c:420:23: error: cast increases required alignment of target type [-Werror=cast-align]
             *BufPtr = (uint32 *)PoolPtr;
                       ^
cc1: all warnings being treated as errors

System observed on:
Ubuntu 20.04, cross compiling for MIPS CPU.

Reporter Info
Joseph Hickey, Vantage Systems, Inc.

@jphickey jphickey self-assigned this May 6, 2020
@skliper skliper added this to the 6.8.0 milestone May 7, 2020
jphickey added a commit to jphickey/cFE that referenced this issue May 8, 2020
Resolve remaining alignment warnings in the unit test and stub code.
In es_UT.c test cases were passing a char* as a stack pointer (uint32*)
Memory pool code was also using uint8[] buffer as uint32.
Most casting becomes unnecessary when defined as the correct type.
jphickey added a commit to jphickey/cFE that referenced this issue May 18, 2020
Resolve remaining alignment warnings in the unit test and stub code.
In es_UT.c test cases were passing a char* as a stack pointer (uint32*)
Memory pool code was also using uint8[] buffer as uint32.
Most casting becomes unnecessary when defined as the correct type.
astrogeco added a commit that referenced this issue May 20, 2020
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