You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
When getting the address of a memory pool buffer directly as a CFE_SB_BufferD_t * type, it may trigger an alias warning in certain compilers/configurations.
Example when using -O3 -fstrict-aliasing -Wstrict-aliasing=2 on GCC 10.3:
cfe/modules/sb/fsw/src/cfe_sb_buf.c: In function ‘CFE_SB_GetBufferFromPool’:
cfe/modules/sb/fsw/src/cfe_sb_buf.c:115:54: error: dereferencing type-punned pointer might break strict-aliasing rules [-Werror=strict-aliasing]
115 | stat1 = CFE_ES_GetPoolBuf((CFE_ES_MemPoolBuf_t *)&bd, CFE_SB_Global.Mem.PoolHdl, AllocSize);
| ^~~
cfe/modules/sb/fsw/src/cfe_sb_buf.c: In function ‘CFE_SB_GetDestinationBlk’:
cfe/modules/sb/fsw/src/cfe_sb_buf.c:221:53: error: dereferencing type-punned pointer might break strict-aliasing rules [-Werror=strict-aliasing]
221 | Stat = CFE_ES_GetPoolBuf((CFE_ES_MemPoolBuf_t *)&Dest, CFE_SB_Global.Mem.PoolHdl, sizeof(CFE_SB_DestinationD_t));
| ^~~~~
Describe the solution you'd like
Should build clean
Additional context
Using a local CFE_ES_MemPoolBuf_t intermediate value should avoid this.
Requester Info
Joseph Hickey, Vantage Systems, Inc.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
When getting the address of a memory pool buffer directly as a
CFE_SB_BufferD_t *
type, it may trigger an alias warning in certain compilers/configurations.Example when using
-O3 -fstrict-aliasing -Wstrict-aliasing=2
on GCC 10.3:Describe the solution you'd like
Should build clean
Additional context
Using a local
CFE_ES_MemPoolBuf_t
intermediate value should avoid this.Requester Info
Joseph Hickey, Vantage Systems, Inc.
The text was updated successfully, but these errors were encountered: