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

Compiling gdbstub.c results in 'handle' may be used uninitialized errors with -O2 (IDFGH-8213) #9706

Closed
3 tasks done
gtjoseph opened this issue Sep 2, 2022 · 0 comments
Closed
3 tasks done
Assignees
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally Type: Bug bugs in IDF

Comments

@gtjoseph
Copy link
Contributor

gtjoseph commented Sep 2, 2022

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

IDF version.

v5.1-dev-537-g91e8312f03

Operating System used.

Linux

How did you build your project?

Command line with idf.py

If you are using Windows, please specify command line type.

No response

What is the expected behavior?

Successful compile

What is the actual behavior?

/usr/src/mcu/esp32/esp-idf/components/esp_gdbstub/src/gdbstub.c:862:26: error: 'handle' may be used uninitialized in this function [-Werror=maybe-uninitialized]

Steps to reproduce.

  1. Open any ESP-IDF project/example, etc. I used esp-idf/examples/system/gdbstub
  2. In menuconfig, "Compiler options", set "Optimization Level" to "(Optimize for performance (-O2))"
  3. In menuconfig, set "Panic handler behaviour (GDBStub on panic (or runtime))" If using the gdbstub example, this will already be set.
  4. build

sdkconfig.txt

Build or installation Logs.

[590/867] Building C object esp-idf/esp_gdbstub/CMakeFiles/__idf_esp_gdbstub.dir/src/gdbstub.c.objFAILED: esp-idf/esp_gdbstub/CMakeFiles/__idf_esp_gdbstub.dir/src/gdbstub.c.obj 
/home/gtjoseph/.espressif/tools/xtensa-esp32s3-elf/esp-2022r1-11.2.0/xtensa-esp32s3-elf/bin/xtensa-esp32s3-elf-gcc  -I/usr/src/mcu/esp32/projects/gdbstub/build/config -I/usr/src/mcu/esp32/esp-idf/components/esp_gdbstub/include -I/usr/src/mcu/esp32/esp-idf/components/esp_gdbstub/private_include -I/usr/src/mcu/esp32/esp-idf/components/esp_gdbstub/xtensa -I/usr/src/mcu/esp32/esp-idf/components/esp_gdbstub/esp32s3 -I/usr/src/mcu/esp32/esp-idf/components/newlib/platform_include -I/usr/src/mcu/esp32/esp-idf/components/freertos/FreeRTOS-Kernel/include -I/usr/src/mcu/esp32/esp-idf/components/freertos/esp_additions/include/freertos -I/usr/src/mcu/esp32/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/include -I/usr/src/mcu/esp32/esp-idf/components/freertos/esp_additions/include -I/usr/src/mcu/esp32/esp-idf/components/esp_hw_support/include -I/usr/src/mcu/esp32/esp-idf/components/esp_hw_support/include/soc -I/usr/src/mcu/esp32/esp-idf/components/esp_hw_support/include/soc/esp32s3 -I/usr/src/mcu/esp32/esp-idf/components/esp_hw_support/port/esp32s3/. -I/usr/src/mcu/esp32/esp-idf/components/esp_hw_support/port/esp32s3/private_include -I/usr/src/mcu/esp32/esp-idf/components/heap/include -I/usr/src/mcu/esp32/esp-idf/components/log/include -I/usr/src/mcu/esp32/esp-idf/components/soc/include -I/usr/src/mcu/esp32/esp-idf/components/soc/esp32s3/. -I/usr/src/mcu/esp32/esp-idf/components/soc/esp32s3/include -I/usr/src/mcu/esp32/esp-idf/components/hal/esp32s3/include -I/usr/src/mcu/esp32/esp-idf/components/hal/include -I/usr/src/mcu/esp32/esp-idf/components/hal/platform_port/include -I/usr/src/mcu/esp32/esp-idf/components/esp_rom/include -I/usr/src/mcu/esp32/esp-idf/components/esp_rom/include/esp32s3 -I/usr/src/mcu/esp32/esp-idf/components/esp_rom/esp32s3 -I/usr/src/mcu/esp32/esp-idf/components/esp_common/include -I/usr/src/mcu/esp32/esp-idf/components/esp_system/include -I/usr/src/mcu/esp32/esp-idf/components/esp_system/port/soc -I/usr/src/mcu/esp32/esp-idf/components/esp_system/port/include/private -I/usr/src/mcu/esp32/esp-idf/components/xtensa/include -I/usr/src/mcu/esp32/esp-idf/components/xtensa/esp32s3/include -I/usr/src/mcu/esp32/esp-idf/components/lwip/include -I/usr/src/mcu/esp32/esp-idf/components/lwip/include/apps -I/usr/src/mcu/esp32/esp-idf/components/lwip/include/apps/sntp -I/usr/src/mcu/esp32/esp-idf/components/lwip/lwip/src/include -I/usr/src/mcu/esp32/esp-idf/components/lwip/port/esp32/include -I/usr/src/mcu/esp32/esp-idf/components/lwip/port/esp32/include/arch -mlongcalls  -ffunction-sections -fdata-sections -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wextra -Wno-unused-parameter -Wno-sign-compare -Wno-enum-conversion -gdwarf-4 -ggdb -O2 -fmacro-prefix-map=/usr/src/mcu/esp32/projects/gdbstub=. -fmacro-prefix-map=/usr/src/mcu/esp32/esp-idf=/IDF -fstrict-volatile-bitfields -Wno-error=unused-but-set-variable -fno-jump-tables -fno-tree-switch-conversion -DconfigENABLE_FREERTOS_DEBUG_OCDAWARE=1 -std=gnu17 -Wno-old-style-declaration -D_GNU_SOURCE -DIDF_VER=\"v5.1-dev-537-g91e8312f03-dirty\" -DESP_PLATFORM -D_POSIX_READER_WRITER_LOCKS -MD -MT esp-idf/esp_gdbstub/CMakeFiles/__idf_esp_gdbstub.dir/src/gdbstub.c.obj -MF esp-idf/esp_gdbstub/CMakeFiles/__idf_esp_gdbstub.dir/src/gdbstub.c.obj.d -o esp-idf/esp_gdbstub/CMakeFiles/__idf_esp_gdbstub.dir/src/gdbstub.c.obj -c /usr/src/mcu/esp32/esp-idf/components/esp_gdbstub/src/gdbstub.c
/usr/src/mcu/esp32/esp-idf/components/esp_gdbstub/src/gdbstub.c: In function 'esp_gdbstub_handle_command':
/usr/src/mcu/esp32/esp-idf/components/esp_gdbstub/src/gdbstub.c:862:26: error: 'handle' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  862 |     BaseType_t core_id = xTaskGetAffinity(handle);
      |                          ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/mcu/esp32/esp-idf/components/esp_gdbstub/src/gdbstub.c:860:18: note: 'handle' was declared here
  860 |     TaskHandle_t handle;
      |                  ^~~~~~
/usr/src/mcu/esp32/esp-idf/components/esp_gdbstub/src/gdbstub.c:853:18: error: 'handle' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  853 |         result = eTaskGetState(handle);
      |                  ^~~~~~~~~~~~~~~~~~~~~
/usr/src/mcu/esp32/esp-idf/components/esp_gdbstub/src/gdbstub.c:850:18: note: 'handle' was declared here
  850 |     TaskHandle_t handle;
      |                  ^~~~~~
/usr/src/mcu/esp32/esp-idf/components/esp_gdbstub/src/gdbstub.c: In function 'getActiveTaskNum':
/usr/src/mcu/esp32/esp-idf/components/esp_gdbstub/src/gdbstub.c:853:18: error: 'handle' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  853 |         result = eTaskGetState(handle);
      |                  ^~~~~~~~~~~~~~~~~~~~~
/usr/src/mcu/esp32/esp-idf/components/esp_gdbstub/src/gdbstub.c:850:18: note: 'handle' was declared here
  850 |     TaskHandle_t handle;
      |                  ^~~~~~
cc1: some warnings being treated as errors
[611/867] Building C object esp-idf/http_parser/CMakeFiles/__idf_http_parser.dir/http_parser.c.objninja: build stopped: subcommand failed.
ninja failed with exit code 1, output of the command is in the /usr/src/mcu/esp32/projects/gdbstub/build/log/idf_py_stderr_output_163541 and /usr/src/mcu/esp32/projects/gdbstub/build/log/idf_py_stdout_output_163541


### More Information.

_No response_
@gtjoseph gtjoseph added the Type: Bug bugs in IDF label Sep 2, 2022
@espressif-bot espressif-bot added the Status: Opened Issue is new label Sep 2, 2022
@github-actions github-actions bot changed the title Compiling gdbstub.c results in 'handle' may be used uninitialized errors with -O2 Compiling gdbstub.c results in 'handle' may be used uninitialized errors with -O2 (IDFGH-8213) Sep 2, 2022
@espressif-bot espressif-bot added Status: Reviewing Issue is being reviewed Resolution: NA Issue resolution is unavailable Status: Done Issue is done internally Resolution: Done Issue is done internally and removed Status: Opened Issue is new Status: Reviewing Issue is being reviewed Resolution: NA Issue resolution is unavailable labels Sep 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally Type: Bug bugs in IDF
Projects
None yet
Development

No branches or pull requests

3 participants