diff --git a/src/thunks.cc b/src/thunks.cc index 28a65246c4..cb8f341520 100644 --- a/src/thunks.cc +++ b/src/thunks.cc @@ -164,7 +164,7 @@ void OutputSection::create_range_extension_thunks(Context &ctx) { c++; // Move A forward so that A is reachable from C. - i64 c_offset = (c == m.size()) ? offset : m[c]->offset; + i64 c_offset = (c == d) ? offset : m[c]->offset; while (a < b && m[a]->offset + branch_distance < c_offset) a++;