* New warning [not found] <87fs74k8zq.fsf.ref@yahoo.com> @ 2023-06-06 13:36 ` Po Lu 2023-06-06 15:59 ` Eshel Yaron 0 siblings, 1 reply; 7+ messages in thread From: Po Lu @ 2023-06-06 13:36 UTC (permalink / raw) To: emacs-devel 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. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: New warning 2023-06-06 13:36 ` New warning Po Lu @ 2023-06-06 15:59 ` Eshel Yaron 2023-06-06 16:14 ` Eli Zaretskii 0 siblings, 1 reply; 7+ messages in thread From: Eshel Yaron @ 2023-06-06 15:59 UTC (permalink / raw) To: Po Lu; +Cc: emacs-devel Po Lu <luangruo@yahoo.com> 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? diff --git a/src/window.c b/src/window.c index 81578375498..644fcab9d04 100644 --- a/src/window.c +++ b/src/window.c @@ -5540,6 +5540,7 @@ window_wants_header_line (struct window *w) && !WINDOW_PSEUDO_P (w) && !EQ (window_header_line_format, Qnone) && (!null_header_line_format (window_header_line_format, f) + || !WINDOW_BUFFER (w) || !null_header_line_format (BVAR (XBUFFER (WINDOW_BUFFER (w)), header_line_format), f)) && (WINDOW_PIXEL_HEIGHT (w) ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: New warning 2023-06-06 15:59 ` Eshel Yaron @ 2023-06-06 16:14 ` Eli Zaretskii 2023-06-06 16:41 ` Eli Zaretskii 0 siblings, 1 reply; 7+ messages in thread From: Eli Zaretskii @ 2023-06-06 16:14 UTC (permalink / raw) To: Eshel Yaron; +Cc: luangruo, emacs-devel > From: Eshel Yaron <me@eshelyaron.com> > Cc: emacs-devel@gnu.org > Date: Tue, 06 Jun 2023 18:59:14 +0300 > > Po Lu <luangruo@yahoo.com> 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. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: New warning 2023-06-06 16:14 ` Eli Zaretskii @ 2023-06-06 16:41 ` Eli Zaretskii 2023-06-06 17:53 ` Andreas Schwab 2023-06-06 23:26 ` Po Lu 0 siblings, 2 replies; 7+ messages in thread From: Eli Zaretskii @ 2023-06-06 16:41 UTC (permalink / raw) To: luangruo; +Cc: me, emacs-devel > Date: Tue, 06 Jun 2023 19:14:11 +0300 > From: Eli Zaretskii <eliz@gnu.org> > Cc: luangruo@yahoo.com, emacs-devel@gnu.org > > > From: Eshel Yaron <me@eshelyaron.com> > > Cc: emacs-devel@gnu.org > > Date: Tue, 06 Jun 2023 18:59:14 +0300 > > > > Po Lu <luangruo@yahoo.com> 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)) > > > | ~~~~~~~~~~~~~~~~~~~~~~~ I've now tried on two different systems, with and without optimizations, with GCC 9.2 and 11.3, and none of those produce this warning. What version of GCC do you have there, Po Lu? ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: New warning 2023-06-06 16:41 ` Eli Zaretskii @ 2023-06-06 17:53 ` Andreas Schwab 2023-06-06 18:30 ` Eli Zaretskii 2023-06-06 23:26 ` Po Lu 1 sibling, 1 reply; 7+ messages in thread From: Andreas Schwab @ 2023-06-06 17:53 UTC (permalink / raw) To: Eli Zaretskii; +Cc: luangruo, me, emacs-devel On Jun 06 2023, Eli Zaretskii wrote: > I've now tried on two different systems, with and without > optimizations, with GCC 9.2 and 11.3, and none of those produce this > warning. Did you configure with --enable-checking? Try without. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different." ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: New warning 2023-06-06 17:53 ` Andreas Schwab @ 2023-06-06 18:30 ` Eli Zaretskii 0 siblings, 0 replies; 7+ messages in thread From: Eli Zaretskii @ 2023-06-06 18:30 UTC (permalink / raw) To: Andreas Schwab; +Cc: luangruo, me, emacs-devel > From: Andreas Schwab <schwab@linux-m68k.org> > Cc: luangruo@yahoo.com, me@eshelyaron.com, emacs-devel@gnu.org > Date: Tue, 06 Jun 2023 19:53:44 +0200 > > On Jun 06 2023, Eli Zaretskii wrote: > > > I've now tried on two different systems, with and without > > optimizations, with GCC 9.2 and 11.3, and none of those produce this > > warning. > > Did you configure with --enable-checking? Try without. Thanks. Stupid GCC. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: New warning 2023-06-06 16:41 ` Eli Zaretskii 2023-06-06 17:53 ` Andreas Schwab @ 2023-06-06 23:26 ` Po Lu 1 sibling, 0 replies; 7+ messages in thread From: Po Lu @ 2023-06-06 23:26 UTC (permalink / raw) To: Eli Zaretskii; +Cc: me, emacs-devel Eli Zaretskii <eliz@gnu.org> writes: >> Date: Tue, 06 Jun 2023 19:14:11 +0300 >> From: Eli Zaretskii <eliz@gnu.org> >> Cc: luangruo@yahoo.com, emacs-devel@gnu.org >> >> > From: Eshel Yaron <me@eshelyaron.com> >> > Cc: emacs-devel@gnu.org >> > Date: Tue, 06 Jun 2023 18:59:14 +0300 >> > >> > Po Lu <luangruo@yahoo.com> 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)) >> > > | ~~~~~~~~~~~~~~~~~~~~~~~ > > I've now tried on two different systems, with and without > optimizations, with GCC 9.2 and 11.3, and none of those produce this > warning. What version of GCC do you have there, Po Lu? GCC 13.1.1. Thanks. ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-06-06 23:26 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <87fs74k8zq.fsf.ref@yahoo.com> 2023-06-06 13:36 ` New warning Po Lu 2023-06-06 15:59 ` Eshel Yaron 2023-06-06 16:14 ` Eli Zaretskii 2023-06-06 16:41 ` Eli Zaretskii 2023-06-06 17:53 ` Andreas Schwab 2023-06-06 18:30 ` Eli Zaretskii 2023-06-06 23:26 ` Po Lu
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.