https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118276
--- Comment #12 from Ben FrantzDale ---
Thanks for clarifying. To be 100% clear, you are saying that with no c'tor, or
`= default;`, `S{}` will zero just the non-padding bytes, but adding `S()
noexcept {}` drops that requirement?
Yes, the middl
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118276
--- Comment #10 from Ben FrantzDale ---
I see the same codegen with `alignas(long) T a[n] = {};`:
https://godbolt.org/z/z93KEnoao
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118276
--- Comment #8 from Ben FrantzDale ---
Interesting. It looks like the behavior depends on the data type... If I make
11 `long`s it's different from `11 * sizeof(long)` `char`s:
https://godbolt.org/z/nKPcYv4MG
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118276
--- Comment #6 from Ben FrantzDale ---
I think I understand. You are saying that gcc wants to (or must?) zero-out the
entire struct in the trivial case, which includes `S() = default;` but with
`S() noexcept {}` it winds up on a code path where
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118276
--- Comment #2 from Ben FrantzDale ---
@Andrew Pinski, the quick-bench link shows the `stosq` version running slower.
Regardless, the code-gen shouldn't be different, should it? (Is there any
semantic difference I'm missing?)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118276
Bug ID: 118276
Summary: Adding empty c'tor to struct of std::array and integer
improves codegen
Product: gcc
Version: 14.2.0
Status: UNCONFIRMED
Severity: norm