https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104498
rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Last reconfirmed| |2022-02-11 Status|UNCONFIRMED |NEW --- Comment #6 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> --- The problem is that compare_base_symbol_refs can swap x and y: if (!x_decl) { std::swap (x_decl, y_decl); std::swap (x_base, y_base); } but this doesn't change the polarity of the distance added here: if (distance) *distance += (SYMBOL_REF_BLOCK_OFFSET (y_base) - SYMBOL_REF_BLOCK_OFFSET (x_base));