FreeRTOS heap_4.c cast error

Recently I noticed FreeRTOS kernel added CMake support and I tried to add it as well in my project.

set(FREERTOS_PORT "GCC_ARM_CM3" CACHE STRING "" FORCE)
set( FREERTOS_HEAP "4" CACHE STRING "" FORCE)

FetchContent_Declare(freertos_kernel
  GIT_REPOSITORY https://github.com/FreeRTOS/FreeRTOS-Kernel.git
  GIT_TAG        V10.6.1)
FetchContent_MakeAvailable(freertos_kernel)
target_link_libraries(freertos_kernel PUBLIC freertos_config)

But after compilation it gives me the following error:

projectdir/build/_deps/freertos_kernel-src/portable/MemMang/heap_4.c:432:24: error: cast increases required alignment of target type [-Werror=cast-align]

pxFirstFreeBlock = ( BlockLink_t * ) pucAlignedHeap;

I have -Wcast-align in compile option flags.

The error disappears if I remove the option flag.

Should I trust it and suppress the compile flag for the freertos target?

Compiler version

arm-none-eabi-gcc.exe (GNU Arm Embedded Toolchain 10.3-2021.10) 10.3.1 20210824 (release)

Target MCU: Cortex-M4

What version of GCC are you using? Possible for you to share the project that we can use to repro this?

This PR addresses this Fix cast alignment warning in heap_4.c by kar-rahul-aws · Pull Request #771 · FreeRTOS/FreeRTOS-Kernel · GitHub
Can you apply this patch in your project, and see if it fixes your issue.

arm-none-eabi-gcc.exe (GNU Arm Embedded Toolchain 10.3-2021.10) 10.3.1 20210824 (release)