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: New warning Date: Tue, 06 Jun 2023 19:14:11 +0300 Message-ID: <83ilc036wc.fsf@gnu.org> References: <87fs74k8zq.fsf.ref@yahoo.com> <87fs74k8zq.fsf@yahoo.com> 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="20966"; mail-complaints-to="usenet@ciao.gmane.io" Cc: luangruo@yahoo.com, emacs-devel@gnu.org To: Eshel Yaron Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Jun 06 18:14:59 2023 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 1q6ZKk-0005DM-Af for ged-emacs-devel@m.gmane-mx.org; Tue, 06 Jun 2023 18:14:58 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q6ZK0-0003cf-0R; Tue, 06 Jun 2023 12:14:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6ZJz-0003cW-8o for emacs-devel@gnu.org; Tue, 06 Jun 2023 12:14:11 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6ZJy-0007pe-SY; Tue, 06 Jun 2023 12:14:10 -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=y+iniIsWWYQ6BXhJukMiSq2+Hg+kxpWk7n/BxoZ1Avo=; b=H0GUQrOydvnDlZT+J4r6 Qv+sx3DkI5sZHeRNwgXauVJL1auKvNKDgUO0w4bxN4Cc+GEcJSSvssKNnIV+yFLv6gbtDvg4q7+SQ FFWmmKIm1xR0y89k6ocKa5e3BihiJ9ZFzJ0j/RyIhp3tFHpMulG/MgoM5dmPt7dBUhppzxyPpYN0+ jLQhxjknpQQcV8GtaxNJ1cLr6t1RKnwMu3wp81Lbfk3b1x1Kgbe4fB9ifWc3E4S70DZpvkNFd58R9 pdbVN3Cjdyspqj/oheYROV025ygIG3V4K2Z8xPibSF3leFNnL4NFGUqv5fX0lsauJzEtX9694qBgm osgu8bbLy+WygQ==; Original-Received: from [87.69.77.57] (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 1q6ZJy-0002F3-Cd; Tue, 06 Jun 2023 12:14:10 -0400 In-Reply-To: (message from Eshel Yaron on Tue, 06 Jun 2023 18:59:14 +0300) 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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:306670 Archived-At: > From: Eshel Yaron > Cc: emacs-devel@gnu.org > Date: Tue, 06 Jun 2023 18:59:14 +0300 > > Po Lu writes: > > > Since a previous commit, I get: > > > > ../../emacs/src/window.c: In function ‘window_wants_header_line’: > > ../../emacs/src/window.c:5546:19: warning: potential null pointer dereference [-Wnull-dereference] > > 5546 | || !null_header_line_format (BVAR (XBUFFER (WINDOW_BUFFER (w)), > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > 5547 | header_line_format), f)) > > | ~~~~~~~~~~~~~~~~~~~~~~~ > > > > Would someone please look into this? > > Thanks. > > Hmm, clang doesn't emit this warning (and I didn't try compiling with > gcc before submitting that patch, sorry about that). > > The following seems to silence this warning with gcc 13.1, but I'm not > sure I fully understand why/when WINDOW_BUFFER might return NULL, so I'm > not sure it's the right thing to do... Any insights? WINDOW_BUFFER returns a Lisp object, so using !WINDOW_BUFFER is wrong (and will cause compilation errors with some configure options). You want to use either BUFFERP (WINDOW_BUFFER (w)) or NILP (WINDOW_BUFFER (w)). In which case this is AFAIU a bogus warning, since we already test WINDOW_LEAF_P. So I'm not sure what exactly did GCC see there (my version of GCC doesn't emit any warnings there). And I don't know how to ask GCC which part triggered the warning.