Re: [fpc-devel] Progress on pure functions

2022-12-13 Thread J. Gareth Moreton via fpc-devel
Fixed that bug!  Also fixed a bug where the code analysis would get upset if you have "X mod Y" behind a "if (Y <> 0) then" check, and Y evaluates to zero.  I've attached a new test project to showcase this (and which revealed the aforementioned bug).  My branch also correctly replaces the func

Re: [fpc-devel] Progress on pure functions

2022-12-13 Thread J. Gareth Moreton via fpc-devel
So there are bugs in my pure function code, specifically with the use of current_procinfo - I didn't realise until now that the one relating to the current function is actually freed after the body has been parsed. Ideally I would have gone the approach of reusing more of the pass1_inline code

Re: [fpc-devel] Progress on pure functions

2022-12-13 Thread J. Gareth Moreton via fpc-devel
The next big milestone that I want to achieve is to make this a pure function: procedure int_str_unsigned(l:longword;out s:shortstring); pure; var   m1 : longword;   pcstart,   pc2start,   pc,pc2 : pchar;   hs : string[32];   overflow : longint; begin   pc2start:=@s[1];   pc2:=pc2start;   pcstar