Re: [hub] Andrzej's review
Peter Dimov via Boost <[email protected]>
| Newsgroups | gmane.comp.lib.boost.devel |
|---|---|
| Message-ID | <[email protected]> |
Andrzej Krzemienski wrote: > 5. Compiling with -Wall gives me a warning in GCC when sorting an empty > hub: a zero-sized heap array is allocated: > https://godbolt.org/z/dWvxv9n8s > This is technically fine to allocate such arrays, but maybe it is worth to > make -Wall clean. The warning isn't caused by the zero sized allocation (which is legal.) It's because the compiler can see that the array has zero elements, but can't see that the loop inside this call to visit https://github.com/joaquintides/hub/blob/063cf1d3589d4893b53964084ee56f4476eed471/include/boost/container/hub.hpp#L1628 is never executed. So it says "if this loop is executed, it would be UB because there aren't any elements there" but this is a false positive because the loop isn't executed. (The subsequent loops suffer from the same issue and also cause warnings for the same reason.) A common problem with GCC, and unfortunately nothing can be done about it short of disabling the warning. _______________________________________________ Boost mailing list -- [email protected] To unsubscribe send an email to [email protected] https://lists.boost.org/mailman3/lists/boost.lists.boost.org/ Archived at: https://lists.boost.org/archives/list/[email protected]/message/GLNSFH3WPJOFC4672HQ4WIKQ7D4DE2GM/