[Bug rtl-optimization/115049] [14/15 Regression] Silent severe miscompilation around inline functions
lh_mouse at 126 dot com
gcc-bugzilla@gcc.gnu.org
Sun Jul 14 12:05:24 GMT 2024
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.
More information about the Gcc-bugs
mailing list