[Bug bootstrap/106779] GCC 12.2 fails to compile in libiberty - uknown symbol PTR - requires later patch

todd_richmond at hotmail dot com gcc-bugzilla@gcc.gnu.org
Tue Aug 30 17:59:00 GMT 2022


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

--- Comment #3 from Todd Richmond <todd_richmond at hotmail dot com> ---
We have been using the same build setup for the last 20 years and this is the
1st gcc failure :) We build EVERYTHING in a self contained fashion and don't
rely on any OS libraries except libc.so.
I don't know what file normally defines PTR, but someone else must have run
into this for the patch to have been checked in
Below log is from a CentOS 7 compile using gcc 12.1

/tools/arch/Linux_3.10.0-x86_64/gcc-12.1.0-bootstrap/bin/gcc -c -DHAVE_CONFIG_H
-fPIC -pipe -DNDEBUG -Wno-error=unused-value -Wno-unused-variable 
-I/tools/arch/Linux_3.10.0-x86_64/gcc-12.1.0-bootstrap//include    -I.
-I/var/tmp/gcc-12.2.0-bootstrap/gcc-12.2.0/libiberty/../include  -W -Wall
-Wwrite-strings -Wc++-compat -Wstrict-prototypes -Wshadow=local -pedantic 
-D_GNU_SOURCE -fcf-protection
/var/tmp/gcc-12.2.0-bootstrap/gcc-12.2.0/libiberty/objalloc.c -o objalloc.o

/var/tmp/gcc-12.2.0-bootstrap/gcc-12.2.0/libiberty/objalloc.c: In function
‘objalloc_create’:
/var/tmp/gcc-12.2.0-bootstrap/gcc-12.2.0/libiberty/objalloc.c:95:18: error:
‘PT’ undeclared (first use in this function)
   95 |   ret->chunks = (PTR) malloc (CHUNK_SIZE);
      |                  ^~~
/var/tmp/gcc-12.2.0-bootstrap/gcc-12.2.0/libiberty/objalloc.c:95:18: note: each
undeclared identifier is reported only once for each function it appears in
/var/tmp/gcc-12.2.0-bootstrap/gcc-12.2.0/libiberty/objalloc.c:95:22: error:
expected ‘;’ before ‘malloc’
   95 |   ret->chunks = (PTR) malloc (CHUNK_SIZE);
      |                      ^~~~~~~
      |                      ;
/var/tmp/gcc-12.2.0-bootstrap/gcc-12.2.0/libiberty/objalloc.c: At top level:
/var/tmp/gcc-12.2.0-bootstrap/gcc-12.2.0/libiberty/objalloc.c:114:1: error:
unknown type name ‘PTR’
  114 | PTR
      | ^~~
/var/tmp/gcc-12.2.0-bootstrap/gcc-12.2.0/libiberty/objalloc.c:115:1: error:
conflicting types for ‘_objalloc_alloc’; have ‘int(struct objalloc *, long
unsigned int)’
  115 | _objalloc_alloc (struct objalloc *o, unsigned long original_len)
      | ^~~~~~~~~~~~~~~


More information about the Gcc-bugs mailing list