Use-after-free in the x86-64 compiler.

In !1278 (merged), I mentioned that the compiler built with heaptrc crashes when compiling itself.

With !1278 (merged), by enabling KeepReleased and adding a manual CheckPointer before the crash site, I extracted a bit more information. (Note that trunk heaptrc.CheckPointer won’t tell you the free site, so you should merge !1278 (merged) ASAP until someone stumbles into a critical use-after-free error, cannot debug it, and moves to an ecosystem with better debugging.)

Pointer allocated when compiling aasmtai.pas:3432:16 was freed at

DESTROY,                  line  2243 of cclasses.pas
STRIPDEADLABELS,          line  1930 of aoptobj.pas
OPTIMIZECONDITIONALJUMP,  line  2246 of aoptobj.pas
DOJUMPOPTIMIZATIONS,      line  2458 of aoptobj.pas
TRYJCCSTCCLCOPT,          line 10724 of x86/aoptx86.pas
OPTPASS1STCCLC,           line 10533 of x86/aoptx86.pas
PEEPHOLEOPTPASS1CPU,      line   192 of x86_64/aoptcpu.pas
PEEPHOLEOPTPASS1,         line  2785 of aoptobj.pas
OPTIMIZE,                 line   278 of aopt.pas
OPTIMIZE,                 line   377 of aopt.pas
GENERATE_CODE,            line  2288 of psub.pas
GENERATE_CODE_TREE,       line  1626 of psub.pas
READ_PROC_BODY,           line  2690 of psub.pas
READ_PROC,                line  2913 of psub.pas
READ_DECLARATIONS,        line  3151 of psub.pas
BLOCK,                    line   351 of psub.pas
PARSE_BODY,               line  2502 of psub.pas
PROC_UNIT_IMPLEMENTATION, line  1195 of pmodules.pas
CONTINUE,                 line   331 of ctask.pas
PROCESSQUEUE,             line   457 of ctask.pas
COMPILE,                  line   310 of compiler.pas
main,                     line   306 of pp.pas

and touched again at

GETNEXTINSTRUCTION,       line   193 of aoptbase.pas
OPTPASS1STCCLC,           line 10585 of x86/aoptx86.pas
PEEPHOLEOPTPASS1CPU,      line   192 of x86_64/aoptcpu.pas
PEEPHOLEOPTPASS1,         line  2785 of aoptobj.pas
OPTIMIZE,                 line   278 of aopt.pas
OPTIMIZE,                 line   377 of aopt.pas
GENERATE_CODE,            line  2288 of psub.pas
GENERATE_CODE_TREE,       line  1626 of psub.pas
READ_PROC_BODY,           line  2690 of psub.pas
READ_PROC,                line  2913 of psub.pas
READ_DECLARATIONS,        line  3151 of psub.pas
BLOCK,                    line   351 of psub.pas
PARSE_BODY,               line  2502 of psub.pas
PROC_UNIT_IMPLEMENTATION, line  1195 of pmodules.pas
CONTINUE,                 line   331 of ctask.pas
PROCESSQUEUE,             line   457 of ctask.pas
COMPILE,                  line   310 of compiler.pas
main,                     line   306 of pp.pas

@FPK2 @CuriousKit, maybe you see something immediately...