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

            Bug ID: 77378
           Summary: [7 Regression] tree-profile and libgcov assume long
                    long atomic operations are supported
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Keywords: link-failure
          Severity: normal
          Priority: P3
         Component: gcov-profile
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dje at gcc dot gnu.org
  Target Milestone: ---
            Target: powerpc*-*-*

The "Various GCOV/PGO improvements" in August 2016 implicitly assume that 64
bit atomic operations are supported in 32 bit mode.

tree-profile.c:
      /* __atomic_fetch_add (&counter, 1, MEMMODEL_RELAXED); */
      tree addr = tree_coverage_counter_addr (GCOV_COUNTER_ARCS, edgeno);
      tree f = builtin_decl_explicit (LONG_LONG_TYPE_SIZE > 32
                                      ? BUILT_IN_ATOMIC_FETCH_ADD_8:
                                      BUILT_IN_ATOMIC_FETCH_ADD_4);

libgcov.h:
#if LONG_LONG_TYPE_SIZE > 32
typedef signed gcov_type __attribute__ ((mode (DI)));
typedef unsigned gcov_type_unsigned __attribute__ ((mode (DI)));
#else
typedef signed gcov_type __attribute__ ((mode (SI)));
typedef unsigned gcov_type_unsigned __attribute__ ((mode (SI)));
#endif

libgcov-profiler.c:
__atomic_fetch_add (...)


LONG_LONG_TYPE_SIZE is defined as 64 on PPC32 (both PPC32 Linux and AIX), but
64 bit atomic operations are not supported. GCC emits libcalls, but no library
provides the definition, so profiled programs fail to link.

Reply via email to