Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler error in driver/can.c if optimized for performance (IDFGH-1945) #4143

Closed
zinke-ct-video opened this issue Oct 2, 2019 · 3 comments
Assignees

Comments

@zinke-ct-video
Copy link

Hello,

the latest IDF (4.1) won't compile anymore, if I select compiler optimization = performance and assertions = disabled.
If I select compiler optimization = size then everything is fine.

The mentioned error is below:

C:/Users/user258/esp/esp-idf/components/driver/can.c: In function 'can_intr_handler_main':
C:/Users/user258/esp/esp-idf/components/driver/can.c:281:9: error: '((unsigned char*)&frame..)[0]' may be used uninitialized in this function [-Werror=maybe-uninitialized]
if (frame->self_reception) {
^~~~~
cc1.exe: some warnings being treated as errors

This issue is also very similar to #3591

Thanks for any help!

@github-actions github-actions bot changed the title Compiler error in driver/can.c if optimized for performance Compiler error in driver/can.c if optimized for performance (IDFGH-1945) Oct 2, 2019
@zinke-ct-video
Copy link
Author

I found a temporary solution If somebody needs an immediate fix: Add the line
"-Wno-error=maybe-uninitialized" after line 106 in esp-idf/tools/cmake/build.cmake

@Alvin1Zhang
Copy link
Collaborator

@zinke-ct-video Thanks for reporting the issue. Would you please help provide more details as suggested in the issue template? Information like elf, sdk configuration, backtrace, log outputs, commit ID, hardware and etc. would help us debug further. Thanks.

@zinke-ct-video
Copy link
Author

Here are some more information:
esp-idf version is v4.1-dev-474-g2e6398aff
My sdkconfig can be found here.

And here are the full command line prints:

C:\Users\user258\esp\projects\webserver-poe-switch>idf.py build
Executing action: all (aliases: build)
Running ninja in directory c:\users\user258\esp\projects\webserver-poe-switch\build
Executing "ninja all"...
[0/1] Re-running CMake...
-- mconf-idf version mconf-v4.6.0.0-idf-20190628-win32
-- Project version: 0.2.5
-- Building ESP-IDF components for target esp32
-- Could NOT find Perl (missing: PERL_EXECUTABLE)
-- Adding linker script C:/Users/user258/esp/projects/webserver-poe-switch/build/esp-idf/esp32/esp32_out.ld
-- Adding linker script C:/Users/user258/esp/esp-idf/components/esp32/ld/esp32.project.ld.in
-- Adding linker script C:/Users/user258/esp/esp-idf/components/esp32/ld/esp32.peripherals.ld
-- Adding linker script C:/Users/user258/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.ld
-- Adding linker script C:/Users/user258/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.libgcc.ld
-- Adding linker script C:/Users/user258/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.syscalls.ld
-- Adding linker script C:/Users/user258/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.newlib-data.ld
-- Adding linker script C:/Users/user258/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.newlib-funcs.ld
-- Components: app_trace app_update asio bootloader bootloader_support bt cbor coap console cxx driver efuse esp-tls esp32 esp_adc_cal esp_common esp_eth esp_event esp_gdbstub esp_http_client esp_http_server esp_https_ota esp_https_server esp_local_ctrl esp_ringbuf esp_rom esp_websocket_client esp_wifi espcoredump esptool_py expat fatfs freemodbus freertos heap idf_test jsmn json libsodium log lwip main mbedtls mdns minimal-ip-stack mqtt newlib nghttp nvs_flash openssl partition_table protobuf-c protocomm pthread reader-writer-lock sdmmc soc spi_flash spiffs tcp_transport tcpip_adapter ulp unity vfs wear_levelling wifi_provisioning wpa_supplicant xtensa
-- Component paths: C:/Users/user258/esp/esp-idf/components/app_trace C:/Users/user258/esp/esp-idf/components/app_update C:/Users/user258/esp/esp-idf/components/asio C:/Users/user258/esp/esp-idf/components/bootloader C:/Users/user258/esp/esp-idf/components/bootloader_support C:/Users/user258/esp/esp-idf/components/bt C:/Users/user258/esp/esp-idf/components/cbor C:/Users/user258/esp/esp-idf/components/coap C:/Users/user258/esp/esp-idf/components/console C:/Users/user258/esp/esp-idf/components/cxx C:/Users/user258/esp/esp-idf/components/driver C:/Users/user258/esp/esp-idf/components/efuse C:/Users/user258/esp/esp-idf/components/esp-tls C:/Users/user258/esp/esp-idf/components/esp32 C:/Users/user258/esp/esp-idf/components/esp_adc_cal C:/Users/user258/esp/esp-idf/components/esp_common C:/Users/user258/esp/esp-idf/components/esp_eth C:/Users/user258/esp/esp-idf/components/esp_event C:/Users/user258/esp/esp-idf/components/esp_gdbstub C:/Users/user258/esp/esp-idf/components/esp_http_client C:/Users/user258/esp/esp-idf/components/esp_http_server C:/Users/user258/esp/esp-idf/components/esp_https_ota C:/Users/user258/esp/esp-idf/components/esp_https_server C:/Users/user258/esp/esp-idf/components/esp_local_ctrl C:/Users/user258/esp/esp-idf/components/esp_ringbuf C:/Users/user258/esp/esp-idf/components/esp_rom C:/Users/user258/esp/esp-idf/components/esp_websocket_client C:/Users/user258/esp/esp-idf/components/esp_wifi C:/Users/user258/esp/esp-idf/components/espcoredump C:/Users/user258/esp/esp-idf/components/esptool_py C:/Users/user258/esp/esp-idf/components/expat C:/Users/user258/esp/esp-idf/components/fatfs C:/Users/user258/esp/esp-idf/components/freemodbus C:/Users/user258/esp/esp-idf/components/freertos C:/Users/user258/esp/esp-idf/components/heap C:/Users/user258/esp/esp-idf/components/idf_test C:/Users/user258/esp/esp-idf/components/jsmn C:/Users/user258/esp/esp-idf/components/json C:/Users/user258/esp/esp-idf/components/libsodium C:/Users/user258/esp/esp-idf/components/log C:/Users/user258/esp/esp-idf/components/lwip C:/Users/user258/esp/projects/webserver-poe-switch/main C:/Users/user258/esp/esp-idf/components/mbedtls C:/Users/user258/esp/esp-idf/components/mdns C:/Users/user258/esp/projects/webserver-poe-switch/components/minimal-ip-stack C:/Users/user258/esp/esp-idf/components/mqtt C:/Users/user258/esp/esp-idf/components/newlib C:/Users/user258/esp/esp-idf/components/nghttp C:/Users/user258/esp/esp-idf/components/nvs_flash C:/Users/user258/esp/esp-idf/components/openssl C:/Users/user258/esp/esp-idf/components/partition_table C:/Users/user258/esp/esp-idf/components/protobuf-c C:/Users/user258/esp/esp-idf/components/protocomm C:/Users/user258/esp/esp-idf/components/pthread C:/Users/user258/esp/projects/webserver-poe-switch/components/reader-writer-lock C:/Users/user258/esp/esp-idf/components/sdmmc C:/Users/user258/esp/esp-idf/components/soc C:/Users/user258/esp/esp-idf/components/spi_flash C:/Users/user258/esp/esp-idf/components/spiffs C:/Users/user258/esp/esp-idf/components/tcp_transport C:/Users/user258/esp/esp-idf/components/tcpip_adapter C:/Users/user258/esp/esp-idf/components/ulp C:/Users/user258/esp/esp-idf/components/unity C:/Users/user258/esp/esp-idf/components/vfs C:/Users/user258/esp/esp-idf/components/wear_levelling C:/Users/user258/esp/esp-idf/components/wifi_provisioning C:/Users/user258/esp/esp-idf/components/wpa_supplicant C:/Users/user258/esp/esp-idf/components/xtensa
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/user258/esp/projects/webserver-poe-switch/build
[7/815] Building C object esp-idf/driver/CMakeFiles/__idf_driver.dir/can.c.obj
FAILED: esp-idf/driver/CMakeFiles/__idf_driver.dir/can.c.obj
C:\Users\user258.espressif\tools\xtensa-esp32-elf\esp32-2019r1-8.2.0\xtensa-esp32-elf\bin\xtensa-esp32-elf-gcc.exe -Iconfig -IC:/Users/user258/esp/esp-idf/components/driver/include -IC:/Users/user258/esp/esp-idf/components/driver/include/driver -IC:/Users/user258/esp/esp-idf/components/newlib/platform_include -IC:/Users/user258/esp/esp-idf/components/freertos/include -IC:/Users/user258/esp/esp-idf/components/heap/include -IC:/Users/user258/esp/esp-idf/components/log/include -IC:/Users/user258/esp/esp-idf/components/soc/esp32/include -IC:/Users/user258/esp/esp-idf/components/soc/include -IC:/Users/user258/esp/esp-idf/components/esp_rom/include -IC:/Users/user258/esp/esp-idf/components/esp_common/include -IC:/Users/user258/esp/esp-idf/components/xtensa/include -IC:/Users/user258/esp/esp-idf/components/xtensa/esp32/include -IC:/Users/user258/esp/esp-idf/components/esp32/include -IC:/Users/user258/esp/esp-idf/components/esp_ringbuf/include -IC:/Users/user258/esp/esp-idf/components/esp_event/include -IC:/Users/user258/esp/esp-idf/components/tcpip_adapter/include -IC:/Users/user258/esp/esp-idf/components/lwip/include/apps -IC:/Users/user258/esp/esp-idf/components/lwip/include/apps/sntp -IC:/Users/user258/esp/esp-idf/components/lwip/lwip/src/include -IC:/Users/user258/esp/esp-idf/components/lwip/port/esp32/include -IC:/Users/user258/esp/esp-idf/components/lwip/port/esp32/include/arch -IC:/Users/user258/esp/esp-idf/components/vfs/include -IC:/Users/user258/esp/esp-idf/components/esp_wifi/include -IC:/Users/user258/esp/esp-idf/components/esp_wifi/esp32/include -IC:/Users/user258/esp/esp-idf/components/esp_eth/include -IC:/Users/user258/esp/esp-idf/components/efuse/include -IC:/Users/user258/esp/esp-idf/components/efuse/esp32/include -IC:/Users/user258/esp/esp-idf/components/app_trace/include -mlongcalls -Wno-frame-address -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -nostdlib -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-but-set-variable -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wextra -Wno-unused-parameter -Wno-sign-compare -ggdb -O2 -std=gnu99 -Wno-old-style-declaration -D_GNU_SOURCE -DIDF_VER="v4.1-dev-474-g2e6398aff-dirty" -DGCC_NOT_5_2_0 -DESP_PLATFORM -DNDEBUG -MD -MT esp-idf/driver/CMakeFiles/__idf_driver.dir/can.c.obj -MF esp-idf\driver\CMakeFiles__idf_driver.dir\can.c.obj.d -o esp-idf/driver/CMakeFiles/__idf_driver.dir/can.c.obj -c C:/Users/user258/esp/esp-idf/components/driver/can.c
C:/Users/user258/esp/esp-idf/components/driver/can.c: In function 'can_intr_handler_main':
C:/Users/user258/esp/esp-idf/components/driver/can.c:281:9: error: '((unsigned char)&frame..)[0]' may be used uninitialized in this function [-Werror=maybe-uninitialized]
if (frame->self_reception) {
^~~~~
cc1.exe: some warnings being treated as errors
*
[12/815] Building C object esp-idf/driver/CMakeFiles/__idf_driver.dir/sdio_slave.c.obj
C:/Users/user258/esp/esp-idf/components/driver/sdio_slave.c: In function 'sdio_ringbuf_return_from_isr':
C:/Users/user258/esp/esp-idf/components/driver/sdio_slave.c:325:23: warning: unused variable 'ret' [-Wunused-variable]
portBASE_TYPE ret = xSemaphoreGiveFromISR(buf->remain_cnt, yield);
^~~
C:/Users/user258/esp/esp-idf/components/driver/sdio_slave.c: In function 'sdio_ringbuf_return':
C:/Users/user258/esp/esp-idf/components/driver/sdio_slave.c:338:23: warning: unused variable 'ret' [-Wunused-variable]
portBASE_TYPE ret = xSemaphoreGive(buf->remain_cnt);
^~~
C:/Users/user258/esp/esp-idf/components/driver/sdio_slave.c: In function 'init_ringbuf':
C:/Users/user258/esp/esp-idf/components/driver/sdio_slave.c:425:15: warning: variable 'rcv_res' set but not used [-Wunused-but-set-variable]
esp_err_t rcv_res;
^~~~~~~
C:/Users/user258/esp/esp-idf/components/driver/sdio_slave.c: In function 'sdio_slave_deinit':
C:/Users/user258/esp/esp-idf/components/driver/sdio_slave.c:597:15: warning: unused variable 'ret' [-Wunused-variable]
esp_err_t ret = esp_intr_free(context.intr_handle);
^~~
C:/Users/user258/esp/esp-idf/components/driver/sdio_slave.c: In function 'send_isr_eof':
C:/Users/user258/esp/esp-idf/components/driver/sdio_slave.c:829:19: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
portBASE_TYPE ret = pdTRUE;
^~~
[16/815] Performing build step for 'bootloader'
[0/1] Re-running CMake...
-- mconf-idf version mconf-v4.6.0.0-idf-20190628-win32
-- Project version: v4.1-dev-474-g2e6398aff-dirty
-- Building ESP-IDF components for target esp32
-- Adding linker script C:/Users/user258/esp/esp-idf/components/esp32/ld/esp32.peripherals.ld
-- Adding linker script C:/Users/user258/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.ld
-- Adding linker script C:/Users/user258/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.newlib-funcs.ld
-- Adding linker script C:/Users/user258/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.libgcc.ld
-- Adding linker script C:/Users/user258/esp/esp-idf/components/bootloader/subproject/main/esp32.bootloader.ld
-- Adding linker script C:/Users/user258/esp/esp-idf/components/bootloader/subproject/main/esp32.bootloader.rom.ld
-- Components: bootloader bootloader_support efuse esp32 esp_common esp_rom esptool_py log main micro-ecc partition_table soc spi_flash xtensa
-- Component paths: C:/Users/user258/esp/esp-idf/components/bootloader C:/Users/user258/esp/esp-idf/components/bootloader_support C:/Users/user258/esp/esp-idf/components/efuse C:/Users/user258/esp/esp-idf/components/esp32 C:/Users/user258/esp/esp-idf/components/esp_common C:/Users/user258/esp/esp-idf/components/esp_rom C:/Users/user258/esp/esp-idf/components/esptool_py C:/Users/user258/esp/esp-idf/components/log C:/Users/user258/esp/esp-idf/components/bootloader/subproject/main C:/Users/user258/esp/esp-idf/components/bootloader/subproject/components/micro-ecc C:/Users/user258/esp/esp-idf/components/partition_table C:/Users/user258/esp/esp-idf/components/soc C:/Users/user258/esp/esp-idf/components/spi_flash C:/Users/user258/esp/esp-idf/components/xtensa
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/user258/esp/projects/webserver-poe-switch/build/bootloader
ninja: no work to do.
ninja: build stopped: subcommand failed.
ninja failed with exit code 1

Do you need any other info?

@igrr igrr closed this as completed in 6e423d5 Oct 25, 2019
igrr added a commit that referenced this issue Oct 27, 2019
When CONFIG_FREERTOS_ASSERT_DISABLE is set, the function calls wrapped
inside the assertion macros would be removed from the code.

Closes #4143
espressif-bot pushed a commit that referenced this issue Nov 19, 2019
When CONFIG_FREERTOS_ASSERT_DISABLE is set, the function calls wrapped
inside the assertion macros would be removed from the code.

Closes #4143
espressif-bot pushed a commit that referenced this issue Dec 10, 2019
When CONFIG_FREERTOS_ASSERT_DISABLE is set, the function calls wrapped
inside the assertion macros would be removed from the code.

Closes #4143
0xFEEDC0DE64 pushed a commit to 0xFEEDC0DE64/esp-idf that referenced this issue May 5, 2021
This is in line with the
[arduino platform specification](https://arduino.github.io/arduino-cli/platform-specification/#recipes-for-extraction-of-executable-files-and-other-binary-data)
specifying that the file extension after recipe.objcopy is arbitrary and
that the AVR platform uses `eep` & `hex`, while the esp32 platform seems
to have file extensions `partition.bin` & `bin`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants