[Bug libstdc++/106664] std::valarray::resize(0): spurious -Walloc-zero warning
vz-gcc at zeitlins dot org
gcc-bugzilla@gcc.gnu.org
Wed Aug 17 17:59:47 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106664
--- Comment #2 from Vadim Zeitlin <vz-gcc at zeitlins dot org> ---
FWIW I think it's a rather useful warning as allocating 0 bytes is rarely
intentional, i.e. I haven't seen any false positive occurrences of this warning
in my own code. And in valarray case, it indicates a small but real problem
too: empty valarray shouldn't allocate memory at all, not allocate 0 bytes.
And AFAICS it would be pretty trivial to fix the warning in valarray code (but
I have never contributed to libstdc++ so I don't know how to do it and don't
volunteer to do it neither).
More information about the Gcc-bugs
mailing list