fn icon indicating copy to clipboard operation
fn copied to clipboard

DEFHANDLER PROGN blows the stack on DECLARE NOTINILINE

Open phoe opened this issue 6 years ago • 9 comments

CLHS NOTINLINE says,

In the presence of a compiler macro definition for function-name, a notinline declaration prevents that compiler macro from being used.

The macroexpansion machinery contained in this library ignores this fact and recursively compiler-macroexpands a form which was explicitly declared NOTINLINE, which leads into undefined behaviour as demonstrated in https://github.com/Clozure/ccl/issues/270.

phoe avatar Dec 31 '19 13:12 phoe

So fixing this FN bug should make CEPL usable again?

Devon7 avatar Sep 16 '20 19:09 Devon7

What does "make CEPL usable again" mean? I have no idea what broke all of CEPL; all I know is that, at the time or writing this bug, this code invoked undefined behavior by expanding compiler macros where they explicitly should not be expanded.

phoe avatar Sep 16 '20 20:09 phoe

If I understand correctly, then fixing this on FN side will prevent the stack overflows mentioned in linked tickets.

phoe avatar Sep 16 '20 20:09 phoe

By "make CEPL usable again" I mean this stack overflow prevents CEPL from loading and I'm not aware of any other show-stopping CEPL bugs.

Devon7 avatar Sep 16 '20 20:09 Devon7

I'll whale on FN now.

Devon7 avatar Sep 16 '20 20:09 Devon7

No need to whale on it; just figure out a way to not call compiler-macroexpand-1 on a form if the car of this form has been declared notinline in the lexical environment.

phoe avatar Sep 16 '20 20:09 phoe

Sounds good to me. Meanwhile, I found a workaround at https://github.com/cbaggers/cepl/issues/350#issuecomment-693713107

Devon7 avatar Sep 17 '20 00:09 Devon7

There seems to be the function cltl2: function-information that can check if a function is declared inline. Not sure if it available everywhere, as it looks like a language extension. See https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node102.html.

sdilts avatar Nov 22 '20 20:11 sdilts

IMO this function is available everywhere enough - see https://github.com/Zulu-Inuoe/trivial-cltl2/ on http://portability.cl/

phoe avatar Nov 22 '20 20:11 phoe