This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] annotate vector::_M_default_append fo better codegen (PR 83229)


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]