[Bug c++/84502] [8 Regression] Argument corruption when passing empty templated struct
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Feb 21 17:10:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84502
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |ABI
Status|UNCONFIRMED |NEW
Last reconfirmed| |2018-02-21
Known to work| |7.3.0
Summary|Argument corruption when |[8 Regression] Argument
|passing empty templated |corruption when passing
|struct |empty templated struct
Ever confirmed|0 |1
Known to fail| |8.0.1
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This is caused by -fabi-version=12 (which is the default for GCC 8). You can
get the old handling of empty structs with -fabi-version=11
The bug only seems to happen when the empty struct is a class template.
Reduced, this fails at -O0 but not any other optimization level, or with
-fabi-version=11:
template<typename T>
struct EmptyTemplatedStruct { };
using X = EmptyTemplatedStruct<int>;
void func(X, int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8)
{
if (a1 != 0)
__builtin_abort();
if (a2 != 1)
__builtin_abort();
if (a3 != 2)
__builtin_abort();
if (a4 != 3)
__builtin_abort();
if (a5 != 4)
__builtin_abort();
if (a6 != 5)
__builtin_abort();
if (a7 != 6)
__builtin_abort();
if (a8 != 7)
__builtin_abort();
}
int main()
{
func(X{}, 0, 1, 2, 3, 4, 5, 6, 7);
}
More information about the Gcc-bugs
mailing list