From: Junio C Hamano Date: Sat, 07 May 2022 18:42:15 GMT Subject: Re: [PATCH] http.c: clear the 'finished' member once we are done with it Message-ID: In-Reply-To: <20220507054017.fnvb6xisr6s7m2l5@carlos-mbp.lan> Carlo Marcelo Arenas Belón writes: > On Fri, May 06, 2022 at 02:17:01PM -0700, Junio C Hamano wrote: >> diff --git a/http.c b/http.c >> index 229da4d148..85437b1980 100644 >> --- a/http.c >> +++ b/http.c >> @@ -1367,6 +1367,9 @@ void run_active_slot(struct active_request_slot *slot) >> select(max_fd+1, &readfds, &writefds, &excfds, &select_timeout); >> } >> } >> + >> + if (slot->finished == &finished) >> + slot->finished = NULL; > > I am not completely sure yet (since I looked at it long ago and got > sidetracked) but I think this might be optimized out (at least by gcc12) > since it is technically UB, which is why it never "fixed" the warning. UB meaning "undefined behaviour"? Which part is? Taking the address of an on-stack variable "finished"? Comparing it with a pointer that may or may not have been assigned/overwritten elsewhere in a structure? Not clearing the member in the struct unconditionally? Puzzled.