Skip to content

STM32H7xx - dereferencing type-punned pointers #11600

@JanneKiiskila

Description

@JanneKiiskila

Description

STM32H7xx drivers stm32h7xx_hal_i2s.c and stm32h7xx_hal_spi.c have multiple compilers warnings on type-punned pointers.

Using current tip of master of mbed-os; 1319843 (origin/master, origin/HEAD, master) Merge pull request #11590 from morser499/pr/udb-sdio-init

GCC ARM v8

Any compilation will do (since mbed cli insists on compiling absolutely everything), I'm using a very short serial test.

#include "mbed.h"

int main() {
    printf("test\n");
    NVIC_SystemReset();
}

This provides the following warnings:

Compile [ 88.8%]: stm32h7xx_hal_i2s.c
[Warning] stm32h7xx_hal_i2s.c@823,9: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
[Warning] stm32h7xx_hal_i2s.c@932,43: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
[Warning] stm32h7xx_hal_i2s.c@1710,5: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
[Warning] stm32h7xx_hal_i2s.c@1766,39: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
Compile [ 93.2%]: stm32h7xx_hal_spi.c
[Warning] stm32h7xx_hal_spi.c@885,13: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
[Warning] stm32h7xx_hal_spi.c@924,13: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
[Warning] stm32h7xx_hal_spi.c@1099,47: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
[Warning] stm32h7xx_hal_spi.c@1139,47: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
[Warning] stm32h7xx_hal_spi.c@1330,13: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
[Warning] stm32h7xx_hal_spi.c@1349,47: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
[Warning] stm32h7xx_hal_spi.c@1388,13: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
[Warning] stm32h7xx_hal_spi.c@1414,47: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
[Warning] stm32h7xx_hal_spi.c@2786,49: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
[Warning] stm32h7xx_hal_spi.c@3434,39: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
[Warning] stm32h7xx_hal_spi.c@3544,5: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
[ ] Question
[ ] Enhancement
[x] Bug

Attn: @ARMmbed/team-st-mcd

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions