GCC codegen doesn't seem to align stack variables with the specified alignment value, when the address sanitizer is used.
The following code causes an assertion failure on g++ (GCC) 13.1.1 20230429, arch x86_64 GNU/Linux, when the flag -fsanitize=address
is used. When the flag isn't specified, the assertion doesn't fail.
#include <cassert>
#include <cstdint>
int main() {
alignas(64) char c;
auto addr = reinterpret_cast<uintptr_t>(&c);
assert(addr % 64 == 0);
}
Using clang 15.0.7 on the same arch with the same flag does not cause this bug.
Is this a GCC bug?