[PATCH] annotate vector::_M_default_append fo better codegen (PR 83229)
Jonathan Wakely
jwakely@redhat.com
Mon Dec 11 15:07:00 GMT 2017
On 05/12/17 20:44 -0700, Martin Sebor wrote:
>Bug 83239 - False positive from -Wstringop-overflow on simple
>std::vector code, besides pointing out the warning, suggests
>a missed optimization opportunity. This is the second report
>involving for vector (the last one was pr79095) with the same
>symptoms and a similar root cause. Since the information GCC
>keeps about pointers is limited, it's difficult to determine
>that their relationship is p <= q <= r. This is exacerbated
>by the fact that GCC doesn't know that the difference between
>any two pointers into the same object cannot be greater than
>PTRDIFF_MAX (bug 79119).
>
>To help GCC generate better code and avoid the false positive,
>the attached patch adds simple instrumentation to
>vector::_M_default_append() asserting the important pointer
>relationships.
The vector annotation is OK for trunk, thanks.
More information about the Libstdc++
mailing list