Commit a7632ca
committed
fix: guard flatten_il against empty ranges to silence gcc -Wnonnull
gcc-13/-14 inlines std::copy on a 0-length range to
__builtin_memmove(out, in, 0) and trips -Wnonnull when both pointers
are null (e.g. std::array<T, 0>::begin()), which is what the
empty_vector unit test exercises. The std::copy itself is a well-
defined no-op on empty ranges, but the optimizer can't see past the
inlined memmove's nonnull attribute. Short-circuit empty ranges so
std::copy is not called at all in that case.1 parent 11dc950 commit a7632ca
1 file changed
Lines changed: 8 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
212 | 212 | | |
213 | 213 | | |
214 | 214 | | |
215 | | - | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
216 | 220 | | |
217 | | - | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
218 | 224 | | |
219 | 225 | | |
220 | 226 | | |
| |||
0 commit comments