LL function causes compiler warning
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-12-18 7:54 AM
Hi!
The LL library causes a compiler warning (dereferencing type-punned pointer; see below).
Can I ignore this warning?
-Thomas
/STM32Cube_FW_F3_V1.9.0/Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_ll_crc.h:355:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
__STATIC_INLINE void LL_CRC_FeedData16(CRC_TypeDef *CRCx, uint16_t InData){ *(uint16_t __IO *)(&CRCx->DR) = (uint16_t) InData;}Solved! Go to Solution.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-12-18 8:14 AM
>>
Can I ignore this warning?
The code explicitly describes to the compile what it wants done. The register has suitable alignment to allow the action. Providing the compiler does what it is told you can ignore the warning.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-12-18 8:14 AM
>>
Can I ignore this warning?
The code explicitly describes to the compile what it wants done. The register has suitable alignment to allow the action. Providing the compiler does what it is told you can ignore the warning.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-12-19 4:19 AM
warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
Whenever you get a warning like this from GCC, note that the bit in the square brackets at the end is the option which enables this particular warning - in this case, -Wstrict-aliasing
So you can put this into google[1] to get the description of what this warning is actually detecting:
https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
You might also choose to disable this particular warning ...
[1] Note: When googling, you will either have to omit the leading hyphen, or put the whole thing in double quotes
(this is because google takes a leading hyphen to mean, 'exclude this term')A complex system designed from scratch never works and cannot be patched up to make it work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-02-28 12:53 AM
Hello,
This issue solved with simplification of current definition UNUSED() macro in stm32xxxx_hal_def.h
#define UNUSED(x) ((void)(x))
with
#define UNUSED(X) (void)X /* To avoid gcc/g++ warnings */
This update will be applied for all STM32Cube families to avoid gcc/g++ warnings.
Best Regards,
Imen
Thanks
Imen
