diff --git a/cores/esp8266/core_esp8266_main.cpp b/cores/esp8266/core_esp8266_main.cpp index 80d5294cae..f63fe24f52 100644 --- a/cores/esp8266/core_esp8266_main.cpp +++ b/cores/esp8266/core_esp8266_main.cpp @@ -119,9 +119,9 @@ static void loop_task(os_event_t *events) { } static void do_global_ctors(void) { - void (**p)(void); - for(p = &__init_array_start; p != &__init_array_end; ++p) - (*p)(); + void (**p)(void) = &__init_array_end; + while (p != &__init_array_start) + (*--p)(); } extern "C" void __gdb_init() {}