https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94335
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> --- You should be using (intptr_t)t - (intptr_t)this when computing the relative pointer, not sure if that makes a difference but pointer difference between pointers to different objects invokes undefined behavior.