https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115049

--- Comment #11 from LIU Hao <lh_mouse at 126 dot com> ---
The function template `std::discard_block_engine::operator()` is instantiated
in both translation units. The two specializations use different sets of
caller-saved registers. Specifically, the specialization in 'file1.cpp' uses
the `r10` register, but the other one in 'file2.cpp' doesn't.

GCC assumes that `r10` will not be clobbered by the call in 'file2.cpp', but
due to COMDAT, after linking it's the specialization in 'file1.cpp' that is
called, where `r10` is really clobbered, which causes a fault.

Reply via email to