Subject: bug#41754: [feature/native-comp] Fix crash when loading lambdas from dumps with --enable-checking.

From: Nicolas Bértolo <[email-masked]>
Date: Tue, 9 Jun 2020 12:11:15 -0300

> This conses a string for each extension each time through the loop,
> doesn't it?  Is that really necessary?

It does. I thought that keeping the code simple (aka using the FOR_* macros)
more important than saving a few memory allocations, especially when this
function accesses the filesystem, which should be much more expensive.

> AFAIU, you cons the extended_suf list to be able to use the
> FOR_* loops that manipulate lists, is that correct?

Exactly.

> If so, could it be that removing that constraint will lead to a more elegant
> and less expensive code? After all, all this function does is to append STR to
> each directory in PATH, then try finding the resulting file with or without one
> of the extensions in SUFFIXES. Could we produce the file name to probe without
> walking a single list?

I'll come up with a new version taking your suggestions into account.

Thanks, Nico.