https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64435
--- Comment #22 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Or perhaps we could change SizeClassAllocator64 so that on some architectures it could use variable bounds. The fact that they are template parameters makes this harder, but perhaps we could say that if some template parameters are zero then some variable is used instead. Use kSpaceBeg ? kSpaceBeg : kSpaceBegVar instead of kSpaceBeg and kSpaceSize ? kSpaceSize : kSpaceSizeVar instead of kSpace (perhaps put into some method). For architectures where there is no such big variability of address space sizes it could stay constant, while for aarch64 we could decide during asan initialization, after finding out how large address space we have. So for say the 39-bit VA we could use 0x2000000000 to 0x3fffffffff (i.e. 128GB for the allocator), which is not possible for 42-bit VA, because that is shadow gap and high shadow. And for 42-bit VA we could use say 0x10000000000 to 0x2ffffffffff (i.e. 2TB).