From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: warnings compiling emacs28 with gcc 12.1 Date: Thu, 28 Jul 2022 20:02:08 +0300 Message-ID: <83o7x9892n.fsf@gnu.org> References: <87h731vrmw.fsf@mail.jao.io> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30547"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: "Jose A. Ortega Ruiz" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Jul 28 19:04:28 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oH6w0-0007k8-A6 for ged-emacs-devel@m.gmane-mx.org; Thu, 28 Jul 2022 19:04:28 +0200 Original-Received: from localhost ([::1]:59654 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oH6vy-00028Q-Rk for ged-emacs-devel@m.gmane-mx.org; Thu, 28 Jul 2022 13:04:26 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40474) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oH6td-0000Ln-2g for emacs-devel@gnu.org; Thu, 28 Jul 2022 13:02:02 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:52274) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oH6tb-000899-Kt; Thu, 28 Jul 2022 13:02:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=yW6ebC9vFIAmVk8MBs3ndwOkjTEfDvGD4IsDtTSnfM8=; b=WKCu9bD/xRg0Cb9NFYDa VjcoFDhKP1BEJpKNwkIMAUg3Ef3XxXqif/BMzJ6AuqDDEts3B3kNQEsldeqj1n553LUM7+V+jcmCv 5TXIc2T5aHgbuUoKvgiLnk9ezUJwaV8aVpGzuKHbJTIfwXsBNfty2gSLdNvfihjSI7k+niSjq/kxq kdv/5TOMBCJIjZrDqhaBvEYxViuZnU9iQFwl1wuAenjYEXn/hreP0xBPdjxeU+CBe9BIh+vb1AfZ+ a32tH9Cv0GCXkErmBhqFilepmtotyAsfCOQzkxGkk5QCj1uW87mxneP4nN2y9snyDRNfiNjOtK429 9jBrxX1tERS+WA==; Original-Received: from [87.69.77.57] (port=4696 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oH6ta-0003Ap-3e; Thu, 28 Jul 2022 13:01:59 -0400 In-Reply-To: <87h731vrmw.fsf@mail.jao.io> X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:292797 Archived-At: > From: "Jose A. Ortega Ruiz" > Date: Thu, 28 Jul 2022 04:32:39 +0100 > > I compiled today the emacs28 branch with gcc version > 'gcc (Debian 12.1.0-7) 12.1.0' and configured with The lesson to be learned here is never use NN.1 version of GCC with too high level of warnings: you get a lot of noise due to bugs in an immature GCC version. > In file included from intervals.c:45: > intervals.c: In function ‘graft_intervals_into_buffer’: > intervals.h:101:29: warning: potential null pointer dereference [-Wnull-dereference] > 101 | #define TOTAL_LENGTH(i) ((i)->total_length) > | ~~~~^~~~~~~~~~~~~~~ Nonsense. > and there's another one about free that looks a bit scary: > > alloc.c: In function ‘lisp_free’: > alloc.c:1052:3: warning: pointer ‘block’ used after ‘free’ [-Wuse-after-free] > 1052 | mem_delete (mem_find (block)); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > alloc.c:1050:3: note: call to ‘free’ here > 1050 | free (block); > | ^~~~~~~~~~~~ Another nonsense. Look in mem_find, and you will see that it uses its argument as just a number, it never dereferences it. > There are also several out-of-bounds access in xdisp.c that look like > this one: > > xdisp.c: In function ‘append_space_for_newline’: > xdisp.c:22011:7: warning: ‘memset’ offset [2352, 2359] from the object at ‘it’ is out of the bounds of referenced subobject ‘charpos’ with type ‘long int’ at offset 2344 [-Warray-bounds] > 22011 | memset (&it->position, 0, sizeof it->position); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > In file included from composite.h:29, > from xdisp.c:441: > dispextern.h:214:13: note: subobject ‘charpos’ declared here > 214 | ptrdiff_t charpos; > | ^~~~~~~ I see no problem there. > And so on. I guess the whole list is easily reproducible by anyone > compiling git gcc 12.1 in a GNU/Linux system, so i'm not sending it in > full. I can do that in a bug report if you think it's needed. > > Apologies if all this is already well-known/spurious. I wouldn't worry about these. Thanks.