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

[Bug?] 最適化オプションで-O2が指定されている場合に、コンパイルに失敗する #656

Open
knight-ryu12 opened this issue Dec 10, 2024 · 2 comments

Comments

@knight-ryu12
Copy link

Carefully written Issues are more likely to be given priority.
丁寧に記述された報告は優先して対応される可能性が高くなります。

Environment ( 実行環境 )

  • MCU or Board name: [Seeeduino xiao esp32c3]
  • Panel Driver IC: [ssd1306] (N/A?)
  • Bus type: [I2C] (N/A?)
  • LovyanGFX version: [latest master]
  • FrameWork version: [ESP-IDF v5.3.1]
  • Build Environment: [other/esp-idf]
  • Operating System: [Linux]

Problem Description ( 問題の内容 )

LovyanGFXをコンパイルしようとしたときに、Compiler Options->Optimization Levelが-O2だと、コンパイルが通らなくなる。
が、-Og(デフォルト設定)だと、コンパイルが通る。
WARNの設定が問題だとは思われるが、なぜこのエラーが出るのか不明・・・。

Expected Behavior ( 期待される動作 )

コンパイルが通り、正常動作する。

Actual Behavior ( 実際の動作 )

以下のエラーが出る

home/reimu/esp/lovyangfx-test/components/LovyanGFX/src/lgfx/v1/platforms/esp32/Bus_SPI.cpp: In member function 'virtual void lgfx::v1::Bus_SPI::endRead()':
/home/reimu/esp/lovyangfx-test/components/LovyanGFX/src/lgfx/v1/platforms/esp32/Bus_SPI.cpp:847:5: error: array subscript 0 is outside array bounds of 'volatile uint32_t [0]' [-Werror=array-bounds=]
  847 |     *reg(SPI_PIN_REG(_spi_port)) = pin;
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: note: source object is likely at address zero
/home/reimu/esp/lovyangfx-test/components/LovyanGFX/src/lgfx/v1/platforms/esp32/Bus_SPI.cpp: In member function 'virtual void lgfx::v1::Bus_SPI::beginRead()':
/home/reimu/esp/lovyangfx-test/components/LovyanGFX/src/lgfx/v1/platforms/esp32/Bus_SPI.cpp:836:5: error: array subscript 0 is outside array bounds of 'volatile uint32_t [0]' [-Werror=array-bounds=]
  836 |     *reg(SPI_PIN_REG(_spi_port)) = pin;
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: note: source object is likely at address zero
/home/reimu/esp/lovyangfx-test/components/LovyanGFX/src/lgfx/v1/platforms/esp32/Bus_SPI.cpp: In member function 'virtual void lgfx::v1::Bus_SPI::beginTransaction()':
/home/reimu/esp/lovyangfx-test/components/LovyanGFX/src/lgfx/v1/platforms/esp32/Bus_SPI.cpp:234:5: error: array subscript 0 is outside array bounds of 'volatile uint32_t [0]' [-Werror=array-bounds=]
  234 |     *reg(SPI_PIN_REG(spi_port)) = pin;
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: note: source object is likely at address zero
cc1plus: some warnings being treated as errors

Steps to reproduce ( 再現のための前提条件 )

(export.shでPATHを通しておく)

  1. idf.py create-project test00
  2. cd test00
  3. idf.py set-target esp32c3
  4. mkdir components
  5. cd components
  6. git clone https://github.com/lovyan03/lovyangfx
  7. cd ..
  8. idf.py menuconfig
  9. (Optimization Levelを-O2に)
  10. idf.py build

Code to reproduce this issue ( 再現させるためのコード )

Please submit complete source code that can reproduce your problem.
あなたの問題を再現できる完全なソースコードを提示してください。
(空っぽの状態で起きるため、割愛)

@lovyan03
Copy link
Owner

lovyan03 commented Jan 7, 2025

返信が遅くなってすみません。
恐らく対策済みなのでdevelopブランチでご確認いただけますでしょうか…

@knight-ryu12
Copy link
Author

developブランチでも、同様の問題が発生しますね・・・。
-Og (デフォルトの設定)だと起きないので、どうしたものか・・・。

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

2 participants