https://sourceware.org/bugzilla/show_bug.cgi?id=23803
Bug ID: 23803 Summary: __init_array_end - __init_array_start < 0 Product: binutils Version: 2.30 Status: UNCONFIRMED Severity: normal Priority: P2 Component: ld Assignee: unassigned at sourceware dot org Reporter: schorsch_76 at gmx dot de Target Milestone: --- The C++ Objects get instantiated from __libc_init_array. On this MCU it is newlib. It initialize the c++ objects like this https://github.com/redox-os/newlib/blob/master/newlib/libc/misc/init.c /* Iterate over all the init routines. */ void __libc_init_array (void) { size_t count; size_t i; count = __preinit_array_end - __preinit_array_start; for (i = 0; i < count; i++) __preinit_array_start[i] (); _init (); count = __init_array_end - __init_array_start; for (i = 0; i < count; i++) __init_array_start[i] (); } on my MCU (in the reset handler) i use gdb to print these variables, but they are like this: #0 0x0800017c in Reset_Handler () (gdb) print __init_array_start $1 = 134218568 (gdb) p __init_array_end $2 = 134217996 (gdb) p __init_array_end - __init_array_start $3 = -572 As count is an size_t it is unsigned and the loop doesn't stop. But end should be greater than start in any case. I created a very minimalistic c++ Project on Stm32F103RBT6 with the toolchain from arm. It uses binutils and also tried different other compilers. like from debian but all show this behaviour. --- Comment #1 from schorsch_76 at gmx dot de --- Created attachment 11350 --> https://sourceware.org/bugzilla/attachment.cgi?id=11350&action=edit main.cpp -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils