Closed calint closed 4 months ago
Are you sure using the same version? The Arduino IDE 2.3.2 tells nothing about which Arduino core and compiler version used. It is highly not the case since the used toolchains for ArduinoIDE and Platformio are the same when using the same core.
I looked at the verbose build output in Arduino and it seems to be the same compiler version and patch.
I am starting to think that the optimizer removes it due to some assumption that is false. It might be a bug.
I would open an issue in this repo https://github.com/espressif/crosstool-NG It is not a Platformio issue at all.
Ok. Thanks.
The solution is compiler flag "-flifetime-dse=1"
The compiler assumes something falsely so technically it is a bug.
I am a novice at reporting issues, forgive me if I am not precise.
The compiler generates code resulting in a bug which is solved by placing an
asm("nop")
between two lines of code. Below is the generated code for the version without thenop
exhibiting the reproducible bug and the version generated with thenop
which fixes the issue. The comments in the code contain further explanation.Tested on 2 different ESP32s with same result: ESP32-D0WD-V3 revision 3.1 and ESP32-S3 revision 0.2 OS: Ubuntu 24.04 LTS
Note that in Arduino IDE 2.3.2 the bug does not happen.
version with re-producible bug
It seems that the buggy version does not generate anything for
inst->alloc_ptr = alloc_ptr_;
. Does the compiler falsely assume that it is irrelevant?version with bug fixed by a
nop
:The source of the class containing the code:
Kind regards