https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128350
Bug ID: 128350
Summary: Corrupt line coverage in static inline function
Product: gcc
Version: 16.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: gcov-profile
Assignee: unassigned at gcc dot gnu.org
Reporter: postmaster at raasu dot org
Target Milestone: ---
This doesn't work:
> static inline uint64_t zng_memread_8(const void *ptr) {
> typedef struct { uint64_t val; } __attribute__ ((__packed__,
> __may_alias__)) unaligned_uint64_t;
> return ((const unaligned_uint64_t *)ptr)->val;
> }
This works:
> inline __attribute__((always_inline)) static uint64_t zng_memread_8(const
> void *ptr) {
> typedef struct { uint64_t val; } __attribute__ ((__packed__,
> __may_alias__)) unaligned_uint64_t;
> return ((const unaligned_uint64_t *)ptr)->val;
> }
I've tried with release and debug build (with -DNDEBUG and without it) with
Ubuntu 24.04, Ubuntu 26.04 and MinGW-w64 MINGW64/UCRT64 using GCC 15.2.0 and
16.2.0 in both CI container and Windows 11 26H2 + WSL2.
Command line options for coverage are:
> --coverage -fcondition-coverage -Wno-coverage-too-many-conditions
> -fprofile-update=atomic -O0