[Bug target/105525] New: some targets don't define __INTPTR_TYPE__ breaking libgcov-driver.c

mikpelinux at gmail dot com gcc-bugzilla@gcc.gnu.org
Sun May 8 18:18:21 GMT 2022


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

            Bug ID: 105525
           Summary: some targets don't define __INTPTR_TYPE__ breaking
                    libgcov-driver.c
           Product: gcc
           Version: 12.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mikpelinux at gmail dot com
  Target Milestone: ---

Attempting to build a gcc-12.1.0 based cross-compiler to lm32-uclinux-uclibc or
vax-unknown-linux fails with

/mnt/scratch/cross/sources/gcc-12.1.0/libgcc/libgcov-driver.c: In function
'write_topn_counters':
/mnt/scratch/cross/sources/gcc-12.1.0/libgcc/libgcov-driver.c:457:56: error:
'__INTPTR_TYPE__' undeclared (first use in this function); did you mean
'INTPTR_TYPE'?
  457 |       for (struct gcov_kvp *node = (struct gcov_kvp
*)(__INTPTR_TYPE__)start;
      |                                                        ^~~~~~~~~~~~~~~
      |                                                        INTPTR_TYPE
/mnt/scratch/cross/sources/gcc-12.1.0/libgcc/libgcov-driver.c:457:56: note:
each undeclared identifier is reported only once for each function it appears
in
/mnt/scratch/cross/sources/gcc-12.1.0/libgcc/libgcov-driver.c:457:72: error:
expected ',' or ';' before 'start'
  457 |       for (struct gcov_kvp *node = (struct gcov_kvp
*)(__INTPTR_TYPE__)start;
      |                                                                       
^~~~~
/mnt/scratch/cross/sources/gcc-12.1.0/libgcc/libgcov-driver.c:454:17: warning:
unused variable 'start' [-Wunused-variable]
  454 |       gcov_type start = ci_ptr->values[GCOV_TOPN_MEM_COUNTERS * i + 2];
      |                 ^~~~~
/mnt/scratch/cross/sources/gcc-12.1.0/libgcc/libgcov-driver.c:476:72: error:
expected ',' or ';' before 'start'
  476 |       for (struct gcov_kvp *node = (struct gcov_kvp
*)(__INTPTR_TYPE__)start;
      |                                                                       
^~~~~
/mnt/scratch/cross/sources/gcc-12.1.0/libgcc/libgcov-driver.c:473:17: warning:
unused variable 'start' [-Wunused-variable]
  473 |       gcov_type start = ci_ptr->values[GCOV_TOPN_MEM_COUNTERS * i + 2];
      |                 ^~~~~
make[2]: *** [Makefile:928: _gcov_info_to_gcda.o] Error 1
make[2]: Leaving directory
'/mnt/scratch/cross/objdir-vax-gcc/vax-unknown-linux/libgcc'
make[1]: *** [Makefile:12928: all-target-libgcc] Error 2
make[1]: Leaving directory '/mnt/scratch/cross/objdir-vax-gcc'
make: *** [Makefile:1012: all] Error 2

These builds work with gcc-11.3.0, so it's a regression. I haven't bisected but
I believe this started with:

2021-08-06  Sebastian Huber  <sebastian.huber@embedded-brains.de>

        * libgcov-driver.c (#include <stdint.h>): Remove.
        (write_topn_counters): Use __INTPTR_TYPE__ instead of intptr_t.

However, a deeper question is _why_ don't these two targets define
__INTPTR_TYPE__ when so many others do? I suspect that's the real bug here.

Workarounds: revert to gcc-11.3.0, or build gcc-12.1.0 with --disable-gcov.


More information about the Gcc-bugs mailing list