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
CC src/vfs_fat.o
/Users/ben/esp/esp-idf/components/fatfs/src/vfs_fat.c: In function 'vfs_fat_readdir':
/Users/ben/esp/esp-idf/components/fatfs/src/vfs_fat.c:546:20: error: 'out_dirent' may be used uninitialized in this function [-Werror=maybe-uninitialized]
struct dirent* out_dirent;
^
cc1: some warnings being treated as errors
make[1]: *** [src/vfs_fat.o] Error 1
make: *** [fatfs-build] Error 2
I have not dug into the issue beyond this. Compiles fine with -O2.
The text was updated successfully, but these errors were encountered:
This probably means that there is a possibility that vfs_fat_readdir_r will return 0 while not initializing out_dirent. The code looks like this:
FRESULT res = f_readdir(&fat_dir->ffdir, &fat_dir->filinfo);
if (res != FR_OK) {
ESP_LOGD(TAG, "%s: fresult=%d", __func__, res);
returnfresult_to_errno(res);
}
Unless I'm missing something, fresult_to_errno can only return 0 if res is FR_OK. On the other hand, the compiler is rarely wrong about such things. Will run this through a static analyzer...
FayeY
changed the title
Compilation fails with -O3 optimization - vfs_fat.c specifically
[TW#13494] Compilation fails with -O3 optimization - vfs_fat.c specifically
Jun 25, 2017
I have not dug into the issue beyond this. Compiles fine with -O2.
The text was updated successfully, but these errors were encountered: