From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from vmicros1.altlinux.org (vmicros1.altlinux.org [194.107.17.57]) by sourceware.org (Postfix) with ESMTP id 8CC903858C33 for ; Wed, 24 Aug 2022 21:01:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8CC903858C33 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=altlinux.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=altlinux.org Received: from mua.local.altlinux.org (mua.local.altlinux.org [192.168.1.14]) by vmicros1.altlinux.org (Postfix) with ESMTP id 7092772C90B for ; Thu, 25 Aug 2022 00:01:34 +0300 (MSK) Received: by mua.local.altlinux.org (Postfix, from userid 508) id 491D97CF82C; Thu, 25 Aug 2022 00:01:34 +0300 (MSK) Date: Thu, 25 Aug 2022 00:01:34 +0300 From: "Dmitry V. Levin" To: elfutils-devel@sourceware.org Subject: Re: elfutils does not compile with gcc 12.2.0 Message-ID: <20220824210134.GA1005@altlinux.org> References: <340e1f2d-ffd6-6b28-aa5e-3d3f3a535f07@systemli.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <340e1f2d-ffd6-6b28-aa5e-3d3f3a535f07@systemli.org> X-Spam-Status: No, score=2.0 required=5.0 tests=BAYES_00,BODY_8BITS,KAM_CRIM,KAM_DMARC_STATUS,KAM_NUMSUBJECT,MIME_CHARSET_FARAWAY,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Wed, Aug 24, 2022 at 10:51:13PM +0200, Nick via Elfutils-devel wrote: > I try to compile elfutils on OpenWrt with the newest gcc 12.2.0 version. > However, it fails due to -Werror=use-after-free. A workaround is a patch > that I found on the mailinglist, to disable -Werror > (https://sourceware.org/legacy-ml/elfutils-devel/imported/msg00994.html) > I modified it to apply to newest elfutils version. The error with > elfutils 0.187 and gcc 12.2.0: > > In function 'bigger_buffer', > ššš inlined from '__libdw_gunzip' at gzip.c:376:12: > gzip.c:98:9: error: pointer may be used after 'realloc' > [-Werror=use-after-free] > šš 98 |šššš b = realloc (state->buffer, more -= 1024); > ššššš |šššššššš ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > gzip.c:96:13: note: call to 'realloc' here > šš 96 |šš char *b = realloc (state->buffer, more); > ššššš |šššššššššššš ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This warning is definitely wrong, looks like a regression in gcc, please report this to compiler people, otherwise they will never know they introduced a bug that needs fixing. -- ldv