emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Emacs-diffs] emacs-26 9bf66c6: Don't run FOR_EACH_FRAME when there'


From: Paul Eggert
Subject: Re: [Emacs-diffs] emacs-26 9bf66c6: Don't run FOR_EACH_FRAME when there's no frame left (Bug#29961)
Date: Sat, 16 Dec 2017 16:50:48 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0

martin rudalics wrote:
 > I recognized callers that either --enable-gcc-warnings complained
 > about (because code after the FOR_EACH_FRAME loop clearly had
 > undefined behavior unless the loop iterated at least once),

Which ones were these?

The code with undefined behavior is in delete_frame, after its 3rd use of FOR_EACH_FRAME. This loop head is of the form 'FOR_EACH_FRAME (tail, frame1) ...' and the code after the loop assumes that frame1 is initialized, an assumption that is false if Vframe_list is nil.

Neither next_frame nor prev_frame exhibit such behavior IMO.

That's right. However, commit 8720f601e715e5f1d41f7cf863a525a1cc1bc12c removed these functions' assertions that frame-list is non-nil, so I thought it wise to resurrect them.

 > and
 > callers where historically there was an eassert that checked the
 > assumption.

How far did you go back in history?

To commit 8720f601e715e5f1d41f7cf863a525a1cc1bc12c, which is the commit that inserted the (now-removed) assumption that frame-list is non-nil when FOR_EACH_FRAME is first executed.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]