https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90414
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to Matthew Malcomson from comment #0) > Hello, > > I'm looking into how we can implement MTE in the compiler. What is MTE? ... > 3) Would there be any obvious difficulties with a transformation of the form: > _4 = big_arrayD.3771[num_3(D)] > > TO > > _6 = &big_arrayD.3771[num_3(D)]; > _7 = HWASAN_CHECK(6, _6, 4, 4); > _4 = *_7; > > Instead of > _4 = big_arrayD.3771[num_3(D)] > > TO > > _6 = &big_arrayD.3771[num_3(D)]; > ASAN_CHECK(6, _6, 4, 4); > _4 = big_arrayD.3771[num_3(D)] > > which is what ASAN currently does. > This new form would enable using MTE by allowing the check to modify the > pointer that the access will be made with (so it can have have its tag). The "obvious" difficulties is that HWASAN_CHECK expansion needs to handle expanding the actual memory reference. But that's only a slight complication. Other complication is of course that it may pessimize optimization more than the old approach.