From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lug-owl.de (lug-owl.de [IPv6:2a03:4000:10:469::]) by sourceware.org (Postfix) with ESMTPS id DFA923858CDB for ; Sat, 1 Apr 2023 19:09:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DFA923858CDB Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=lug-owl.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=lug-owl.de Received: by lug-owl.de (Postfix, from userid 1001) id E2E8642095; Sat, 1 Apr 2023 21:09:23 +0200 (CEST) Date: Sat, 1 Apr 2023 21:09:23 +0200 From: Jan-Benedict Glaw To: libc-alpha@sourceware.org Subject: Wrong warning in open_catalog.c with trunk GCC? Message-ID: <20230401190923.mwd273x54a5b67zm@lug-owl.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="2ifsme5cgomfliof" Content-Disposition: inline X-Operating-System: Linux chamaeleon 5.14.0-0.bpo.2-amd64 X-gpg-fingerprint: 250D 3BCF 7127 0D8C A444 A961 1DBD 5E75 8399 E1BB X-gpg-key: wwwkeys.de.pgp.net X-Echelon-Enable: howto poison arsenous mail psychological biological nuclear warfare test the bombastical terror of flooding the spy listeners explosion sex drugs and rock'n'roll X-TKUeV: howto poison arsenous mail psychological biological nuclear warfare test the bombastical terror of flooding the spy listeners explosion sex drugs and rock'n'roll X-message-flag: Please send plain text messages only. Do not send HTML emails. Thank you. User-Agent: NeoMutt/20170113 (1.7.2) X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,KAM_ASCII_DIVIDERS,KAM_DMARC_STATUS,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --2ifsme5cgomfliof Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! With the CI builds, after supplying --disable-gcov to gcc-first, I see this while building glibc: x86_64-glibc-linux-gnu-gcc open_catalog.c -c -std=3Dgnu11 -fgnu89-inline -= g -O2 -Wall -Wwrite-strings -Wundef -Werror -fmerge-all-constants -froundin= g-math -fno-stack-protector -fno-common -Wstrict-prototypes -Wold-style-def= inition -fmath-errno -fPIE -ftls-model=3Dinitial-exec -DNLSPATH=3D= '"/usr/share/locale/%L/%N:/usr/share/locale/%L/LC_MESSAGES/%N:/usr/share/lo= cale/%l/%N:/usr/share/locale/%l/LC_MESSAGES/%N:"' -I../include -I/var/lib/l= aminar/run/glibcbot-x86_64-linux-gnu/10/build/compilers/x86_64-linux-gnu/gl= ibc/x86_64-linux-gnu/catgets -I/var/lib/laminar/run/glibcbot-x86_64-linux-= gnu/10/build/compilers/x86_64-linux-gnu/glibc/x86_64-linux-gnu -I../sysdep= s/unix/sysv/linux/x86_64/64 -I../sysdeps/unix/sysv/linux/x86_64 -I../sysd= eps/unix/sysv/linux/x86/include -I../sysdeps/unix/sysv/linux/x86 -I../sysd= eps/x86/nptl -I../sysdeps/unix/sysv/linux/wordsize-64 -I../sysdeps/x86_64= /nptl -I../sysdeps/unix/sysv/linux/include -I../sysdeps/unix/sysv/linux -= I../sysdeps/nptl -I../sysdeps/pthread -I../sysdeps/gnu -I../sysdeps/unix= /inet -I../sysdeps/unix/sysv -I../sysdeps/unix/x86_64 -I../sysdeps/unix = -I../sysdeps/posix -I../sysdeps/x86_64/64 -I../sysdeps/x86_64/fpu/multia= rch -I../sysdeps/x86_64/fpu -I../sysdeps/x86/fpu -I../sysdeps/x86_64/mul= tiarch -I../sysdeps/x86_64 -I../sysdeps/x86/include -I../sysdeps/x86 -I.= =2E/sysdeps/ieee754/float128 -I../sysdeps/ieee754/ldbl-96/include -I../sys= deps/ieee754/ldbl-96 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754/flt= -32 -I../sysdeps/wordsize-64 -I../sysdeps/ieee754 -I../sysdeps/generic = -I.. -I../libio -I. -D_LIBC_REENTRANT -include /var/lib/laminar/run/glibcb= ot-x86_64-linux-gnu/10/build/compilers/x86_64-linux-gnu/glibc/x86_64-linux-= gnu/libc-modules.h -DMODULE_NAME=3Dlibc -include ../include/libc-symbols.h = -DPIC -DTOP_NAMESPACE=3Dglibc -o /var/lib/laminar/run/glibcbot-x86_64-= linux-gnu/10/build/compilers/x86_64-linux-gnu/glibc/x86_64-linux-gnu/catget= s/open_catalog.o -MD -MP -MF /var/lib/laminar/run/glibcbot-x86_64-linux-gnu= /10/build/compilers/x86_64-linux-gnu/glibc/x86_64-linux-gnu/catgets/open_ca= talog.o.dt -MT /var/lib/laminar/run/glibcbot-x86_64-linux-gnu/10/build/comp= ilers/x86_64-linux-gnu/glibc/x86_64-linux-gnu/catgets/open_catalog.o open_catalog.c: In function =E2=80=98__open_catalog=E2=80=99: open_catalog.c:64:11: error: pointer =E2=80=98old_buf=E2=80=99 may be used = after =E2=80=98realloc=E2=80=99 [-Werror=3Duse-after-free] 64 | free (old_buf); = \ | ^~~~~~~~~~~~~~ open_catalog.c:86:15: note: in expansion of macro =E2=80=98ENOUGH=E2=80=99 86 | ENOUGH (len); | ^~~~~~ open_catalog.c:61:13: note: call to =E2=80=98realloc=E2=80=99 here 61 | buf =3D realloc (buf, bufmax); = \ | ^~~~~~~~~~~~~~~~~~~~~ open_catalog.c:86:15: note: in expansion of macro =E2=80=98ENOUGH=E2=80=99 86 | ENOUGH (len); | ^~~~~~ open_catalog.c:64:11: error: pointer =E2=80=98old_buf=E2=80=99 may be used = after =E2=80=98realloc=E2=80=99 [-Werror=3Duse-after-free] 64 | free (old_buf); = \ | ^~~~~~~~~~~~~~ open_catalog.c:102:23: note: in expansion of macro =E2=80=98ENOUGH=E2=80=99 102 | ENOUGH (len); | ^~~~~~ open_catalog.c:61:13: note: call to =E2=80=98realloc=E2=80=99 here 61 | buf =3D realloc (buf, bufmax); = \ | ^~~~~~~~~~~~~~~~~~~~~ open_catalog.c:102:23: note: in expansion of macro =E2=80=98ENOUGH=E2=80=99 102 | ENOUGH (len); | ^~~~~~ open_catalog.c:64:11: error: pointer =E2=80=98old_buf=E2=80=99 may be used = after =E2=80=98realloc=E2=80=99 [-Werror=3Duse-after-free] 64 | free (old_buf); = \ | ^~~~~~~~~~~~~~ open_catalog.c:109:23: note: in expansion of macro =E2=80=98ENOUGH=E2=80=99 109 | ENOUGH (len); | ^~~~~~ open_catalog.c:61:13: note: call to =E2=80=98realloc=E2=80=99 here 61 | buf =3D realloc (buf, bufmax); = \ | ^~~~~~~~~~~~~~~~~~~~~ open_catalog.c:109:23: note: in expansion of macro =E2=80=98ENOUGH=E2=80=99 109 | ENOUGH (len); | ^~~~~~ open_catalog.c:64:11: error: pointer =E2=80=98old_buf=E2=80=99 may be used = after =E2=80=98realloc=E2=80=99 [-Werror=3Duse-after-free] 64 | free (old_buf); = \ | ^~~~~~~~~~~~~~ open_catalog.c:118:27: note: in expansion of macro =E2=80=98ENOUGH=E2=80=99 118 | ENOUGH (1); | ^~~~~~ open_catalog.c:61:13: note: call to =E2=80=98realloc=E2=80=99 here 61 | buf =3D realloc (buf, bufmax); = \ | ^~~~~~~~~~~~~~~~~~~~~ open_catalog.c:118:27: note: in expansion of macro =E2=80=98ENOUGH=E2=80=99 118 | ENOUGH (1); | ^~~~~~ open_catalog.c:64:11: error: pointer =E2=80=98old_buf=E2=80=99 may be used = after =E2=80=98realloc=E2=80=99 [-Werror=3Duse-after-free] 64 | free (old_buf); = \ | ^~~~~~~~~~~~~~ open_catalog.c:134:31: note: in expansion of macro =E2=80=98ENOUGH=E2=80=99 134 | ENOUGH (1); | ^~~~~~ open_catalog.c:61:13: note: call to =E2=80=98realloc=E2=80=99 here 61 | buf =3D realloc (buf, bufmax); = \ | ^~~~~~~~~~~~~~~~~~~~~ open_catalog.c:134:31: note: in expansion of macro =E2=80=98ENOUGH=E2=80=99 134 | ENOUGH (1); | ^~~~~~ open_catalog.c:64:11: error: pointer =E2=80=98old_buf=E2=80=99 may be used = after =E2=80=98realloc=E2=80=99 [-Werror=3Duse-after-free] 64 | free (old_buf); = \ | ^~~~~~~~~~~~~~ open_catalog.c:151:31: note: in expansion of macro =E2=80=98ENOUGH=E2=80=99 151 | ENOUGH (1); | ^~~~~~ open_catalog.c:61:13: note: call to =E2=80=98realloc=E2=80=99 here 61 | buf =3D realloc (buf, bufmax); = \ | ^~~~~~~~~~~~~~~~~~~~~ open_catalog.c:151:31: note: in expansion of macro =E2=80=98ENOUGH=E2=80=99 151 | ENOUGH (1); | ^~~~~~ open_catalog.c:64:11: error: pointer =E2=80=98old_buf=E2=80=99 may be used = after =E2=80=98realloc=E2=80=99 [-Werror=3Duse-after-free] 64 | free (old_buf); = \ | ^~~~~~~~~~~~~~ open_catalog.c:158:23: note: in expansion of macro =E2=80=98ENOUGH=E2=80=99 158 | ENOUGH (1); | ^~~~~~ open_catalog.c:61:13: note: call to =E2=80=98realloc=E2=80=99 here 61 | buf =3D realloc (buf, bufmax); = \ | ^~~~~~~~~~~~~~~~~~~~~ open_catalog.c:158:23: note: in expansion of macro =E2=80=98ENOUGH=E2=80=99 158 | ENOUGH (1); | ^~~~~~ open_catalog.c:64:11: error: pointer =E2=80=98old_buf=E2=80=99 may be used = after =E2=80=98realloc=E2=80=99 [-Werror=3Duse-after-free] 64 | free (old_buf); = \ | ^~~~~~~~~~~~~~ open_catalog.c:171:19: note: in expansion of macro =E2=80=98ENOUGH=E2=80=99 171 | ENOUGH (1); | ^~~~~~ open_catalog.c:61:13: note: call to =E2=80=98realloc=E2=80=99 here 61 | buf =3D realloc (buf, bufmax); = \ | ^~~~~~~~~~~~~~~~~~~~~ open_catalog.c:171:19: note: in expansion of macro =E2=80=98ENOUGH=E2=80=99 171 | ENOUGH (1); | ^~~~~~ open_catalog.c:64:11: error: pointer =E2=80=98old_buf=E2=80=99 may be used = after =E2=80=98realloc=E2=80=99 [-Werror=3Duse-after-free] 64 | free (old_buf); = \ | ^~~~~~~~~~~~~~ open_catalog.c:175:11: note: in expansion of macro =E2=80=98ENOUGH=E2=80=99 175 | ENOUGH (1); | ^~~~~~ open_catalog.c:61:13: note: call to =E2=80=98realloc=E2=80=99 here 61 | buf =3D realloc (buf, bufmax); = \ | ^~~~~~~~~~~~~~~~~~~~~ open_catalog.c:175:11: note: in expansion of macro =E2=80=98ENOUGH=E2=80=99 175 | ENOUGH (1); | ^~~~~~ cc1: all warnings being treated as errors make[3]: *** [../o-iterator.mk:9: /var/lib/laminar/run/glibcbot-x86_64-linu= x-gnu/10/build/compilers/x86_64-linux-gnu/glibc/x86_64-linux-gnu/catgets/op= en_catalog.o] Error 1 make[3]: Leaving directory '/var/lib/laminar/run/glibcbot-x86_64-linux-gnu/= 10/src/glibc/catgets' make[2]: *** [Makefile:484: catgets/subdir_lib] Error 2 make[2]: Leaving directory '/var/lib/laminar/run/glibcbot-x86_64-linux-gnu/= 10/src/glibc' make[1]: *** [Makefile:9: all] Error 2 make[1]: Leaving directory '/var/lib/laminar/run/glibcbot-x86_64-linux-gnu/= 10/build/compilers/x86_64-linux-gnu/glibc/x86_64-linux-gnu' FAIL: compilers-x86_64-linux-gnu glibc x86_64-linux-gnu build That's when calling the ENOUGH() macro: 56 #define ENOUGH(n) = \ 57 if (__glibc_unlikely (bufact + (n) >=3D bufmax)) = \ 58 { = \ 59 char *old_buf =3D buf; = \ 60 bufmax +=3D (bufmax < 256 + (n)) ? 256 + (n) : bufmax; = \ 61 buf =3D realloc (buf, bufmax); = \ 62 if (__glibc_unlikely (buf =3D=3D NULL)) = \ 63 { = \ 64 free (old_buf); = \ 65 return -1; = \ 66 } = \ 67 } I don't spot an issue there. Maybe recent GCCs get confused over __glibc_unlikely()? Thanks, Jan-Benedict --=20 --2ifsme5cgomfliof Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQQlDTvPcScNjKREqWEdvV51g5nhuwUCZCiBYwAKCRAdvV51g5nh u0tIAJ0X+HK548ByqaWIKy67ZJKsPIU4fwCdFvJRviSzPifLSHCBieFLWXMdHT8= =aymL -----END PGP SIGNATURE----- --2ifsme5cgomfliof--