Path: csiph.com!weretis.net!feeder6.news.weretis.net!news.misty.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end From: gah4 Newsgroups: comp.compilers Subject: Re: binary search debugging of compilers Date: Wed, 17 May 2023 15:23:51 -0700 (PDT) Organization: Compilers Central Sender: johnl@iecc.com Approved: comp.compilers@iecc.com Message-ID: <23-05-017@comp.compilers> References: <23-05-003@comp.compilers> <23-05-005@comp.compilers> <23-05-006@comp.compilers> <23-05-008@comp.compilers> <23-05-011@comp.compilers> <23-05-012@comp.compilers> <23-05-015@comp.compilers> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="14570"; mail-complaints-to="abuse@iecc.com" Keywords: debug, tools Posted-Date: 18 May 2023 13:00:08 EDT X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com In-Reply-To: <23-05-015@comp.compilers> Xref: csiph.com comp.compilers:3473 On Wednesday, May 17, 2023 at 12:08:27 PM UTC-7, Kaz Kylheku wrote: > On 2023-05-17, gah4 wrote: > > On Monday, May 15, 2023 at 6:54:08 PM UTC-7, Kaz Kylheku wrote: > > > > (snip) > > > >> Say we have a basket of apples with a rotten smell emanating from it. > >> We can subdivide it, and smell one half and the other. If both halves > >> smell, we know we have two or more rotten apples and they ended up > >> in different halves. This doesn't matter. We just pick one half and > >> keep subdividing. > > But the algorithm described, at least as I remember it, doesn't test both > > halves. > If the problem reproducews with the half you're testing, you assume > the misprocessed function is in that half. (There could be a bad > function in the other half also, and you could test that, but it's > unnecessary.) > > If the problem deosn't reproduce in the half you're testing, you > assume the misprocessed functions lie in the other half, and > recurse on that half instead. I was mostly noting it, as the apple test was written to test both halves. > The algorithm will work even if every single function is miscompiled. > (And will take the same logarithmic number of steps, since we cut > in half no matter what.) > It will arbitrarily narrow it down to one, showing that even if the > compiler change is enabled for just one function, there is a problem. > That function can be investigated. Then maybe then the fix solve the > issue for the five hundred other broken functions, too. As to the problem of debugging by miscompiled code, this reminds me of stories of debugging compilers by feeding them cards from the card recycling bin. It seems that cards were especially high grade paper and so worth keeping separate for recycling. I never actually saw anyone do that, though. In my younger days, some said that I was especially good at finding compiler errors. Maybe not as good now. I would try things that were allowed, but others might not have thought about doing. Only one I remember now, is a C compiler that miscompiled the ++ operator on a double variable. Allowed in C, but maybe not often used.