> So, wouldn't it be better to check for STRICT_ALIGNMENT > get_pointer_alignment (base_addr) and do this only if that alignment > (shifted right by ASAN_SHADOW_SHIFT) is not sufficient and e.g. if we would > know that the shadow is at least 2 byte aligned but not 4 byte aligned, use > size = 2 instead of always 1? E.g. compute this before the loop as > max_size and for !STRICT_ALIGNMENT use always max_size 4?
In practice this makes a difference only for objects aligned on 128-bit or above boundaries though. Moreover, don't you need to take into account the offset as well, which can be modified through -fasan-shadow-offset? -- Eric Botcazou