https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126723
--- Comment #11 from Oliver Rosten <oliver.rosten at googlemail dot com> ---
Following up on my previous comment (10): the same absorption can also make a
location read past the end of the atom ld64 keeps, so a program crashes instead
of only misreporting.
In the reproduction case from comment 10, add a second call to from_b() in
b.cpp:
void from_b()
{
++weak_var;
report("b1");
report("b2"); // added
}
a.o's __DATA,__data is 0x20 bytes (_weak_var and one Lsrc_loc), and b.o's is
0x38 (_weak_var and two). ld64 keeps a.o's atom, so b2's location, addressed as
_weak_var+0x20, lies past its end. file_name() reads as null and std::format
faults in strlen.
gcc 16.2.0, aarch64-apple-darwin.