#include <iostream>
struct foo {
char c[12];
};
int main()
{
foo fa;
foo fb;
std::cout << &fa << "\n";
std::cout << &fb << "\n";
}
With GCC 6.2, the output: 0x7fff67cd1ff0 0x7fff67cd1fe0 The difference is 16 bytes
With GCC 8.3, the output: 0x7ffc5fe3cf14 0x7ffc5fe3cf08 The difference is 12 bytes
It seems gcc6.2.0 has different default stack alignment with gcc8.3.0. And I also tried the -mpreferred-stack-boundary=4, but it seems not work.
I want to eliminate the difference between gcc6.2.0 and gcc8.3.0, can anyone tell me that if some options can disable that, thanks.