[Bug middle-end/83373] False positive reported by -Wstringop-overflow

bugzilla@poradnik-webmastera.com gcc-bugzilla@gcc.gnu.org
Wed Dec 13 22:04:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83373

--- Comment #9 from Daniel Fruzynski <bugzilla@poradnik-webmastera.com> ---
Thanks for explanation. In addition to allocation on stack, my app also uses
custom allocator function like below. So in this case it also should work as
expected.

void* msg_alloc(int msg_id);
...

Msg* msg = (Msg*)msg_alloc(ID_OF_MSG);
...

Anyway, this new attribute looks useful for me, it probably could allow better
diagnostics and optimization. However treating all [sub]objects without this
attribute as a fixed size may break some existing code, so extra command line
switch to enable old (current) behavior also would be needed. All of this
probably needs separate issue here to track it.


More information about the Gcc-bugs mailing list