https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84502
Bug ID: 84502 Summary: Argument corruption when passing empty templated struct Product: gcc Version: 8.0.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: patrick.schlangen at bmw dot de Target Milestone: --- Created attachment 43483 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43483&action=edit Minimal example Hi, we've discovered a strange problem when passing many function arguments where one argument is an alias (using = ...) for a templated struct which has no members (e.g. std::integer_sequence). When building in non-optimized mode or with -O1/-O2, all arguments starting from argument #7 seem to be corrupt. Building with -O3 seems to solve the issue. I've attached a small example program. Correct output: --------------- $ ~/gcc-8/bin/g++ -O3 -o repro repro.cpp && ./repro 0, 1, 2, 3, 4, 5, 6, 7 Wrong outputs: -------------- $ ~/gcc-8/bin/g++ -O2 -o repro repro.cpp && ./repro 0, 1, 2, 3, 4, 5, 7, 0 $ ~/gcc-8/bin/g++ -O1 -o repro repro.cpp && ./repro 0, 1, 2, 3, 4, 5, 7, 0 $ ~/gcc-8/bin/g++ -O0 -o repro repro.cpp && ./repro 0, 1, 2, 3, 4, 5, 7, 2088590376 gcc version (freshly built): ---------------------------- $ ~/gcc-8/bin/g++ -v Using built-in specs. COLLECT_GCC=/home/patrick/gcc-8/bin/g++ COLLECT_LTO_WRAPPER=/home/patrick/gcc-8/libexec/gcc/x86_64-pc-linux-gnu/8.0.1/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ./configure --prefix=/home/patrick/gcc-8 --disable-multilib Thread model: posix gcc version 8.0.1 20180218 (experimental) (GCC) Best Regards Patrick