https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116458
--- Comment #7 from Mark Wielaard <mark at gcc dot gnu.org> ---
You could try --expensive-definedness-checks=yes
--expensive-definedness-checks=<no|auto|yes> [default: auto]
Controls whether Memcheck should employ more precise but also more
expensive (time consuming) instrumentation when checking the
definedness of certain values. In particular, this affects the
instrumentation of integer adds, subtracts and equality
comparisons.
Selecting --expensive-definedness-checks=yes causes Memcheck to use
the most accurate analysis possible. This minimises false error
rates but can cause up to 30% performance degradation.
Selecting --expensive-definedness-checks=no causes Memcheck to use
the cheapest instrumentation possible. This maximises performance
but will normally give an unusably high false error rate.
The default setting, --expensive-definedness-checks=auto, is
strongly recommended. This causes Memcheck to use the minimum of
expensive instrumentation needed to achieve the same false error
rate as --expensive-definedness-checks=yes. It also enables an
instrumentation-time analysis pass which aims to further reduce the
costs of accurate instrumentation. Overall, the performance loss is
generally around 5% relative to --expensive-definedness-checks=no,
although this is strongly workload dependent. Note that the exact
instrumentation settings in this mode are architecture dependent.