If the macro configTICK_TYPE_WIDTH_IN_BITS set to TICK_TYPE_WIDTH_64_BITS, the compiler will show warning like this:
myProject/FreeRTOS-Kernel/portable/MemMang/heap_4.c: In function 'vPortGetHeapStats':
myProject/FreeRTOS-Kernel/portable/GCC/ARM_CM4F/portmacro.h:74:40: warning: conversion from 'long long unsigned int' to 'size_t' {aka 'unsigned int'} changes value from '18446744073709551615' to '4294967295' [-Woverflow]
74 | #define portMAX_DELAY ( TickType_t ) 0xffffffffffffffffULL
| ^
myProject/FreeRTOS-Kernel/portable/MemMang/heap_4.c:575:50: note: in expansion of macro 'portMAX_DELAY'
575 | size_t xBlocks = 0, xMaxSize = 0, xMinSize = portMAX_DELAY; /* portMAX_DELAY used as a portable way of getting the maximum value. */
| ^~~~~~~~~~~~~
Target device is STM32F407IGHx, Compiler is arm-none-eabi-gcc 14.2.1
FreeRTOS-Kernel version is the same as main branch on github (commit hash is e9440d4079894e0d6c52ce80e4c79fc072743d9d)
I have learned the comment after the local variable xMinSize. In this project, the
overflowed value just right equals to UINT32_MAX and the width of size_t is 32. However, if we set configTICK_TYPE_WIDTH_IN_BITS to TICK_TYPE_WIDTH_16_BITS, then the value of portMAX_DELAY is UINT16_MAX, it’s not the maximum value of size_t type variable.
To fix it, I suggest to change it into:
size_t xBlocks = 0, xMaxSize = 0, xMinSize = SIZE_MAX; /* in stdint.h */
or
size_t xBlocks = 0, xMaxSize = 0, xMinSize = ( ( size_t ) -1 );
If this suggestion could works, I can create a new PR on github.