[fpc-devel] Debugging Loop Unroll Optimization

J. Gareth Moreton gareth at moreton-family.com
Fri May 18 17:13:55 CEST 2018


 

"
 I think based on both documented and observed behaviour, the following
definition would be appropriate: 

 The for-loop variable is undefined after the loop if the loop ran to
completion. It retains its last value if the loop exited in a controlled
way (goto, break, exit, ?) before running to completion. 
 "

 I'm happy with that, although it might be best to simply say (goto, break
etc.) since it's hard to be completely exhaustive (since there's raise and
continue as well), and let's just hope that someone doesn't call a function
that then performs a long jump to a completely different routine!

 For purposes of compiler optimisation, I would argue that,
internally, 'exit' is only necessary to check if the for-loop variable is
Result, but that's just nit-picking.  I'm in two minds with 'raise'
because it's not always easy to determine where the exception is raised
(e.g. in a subroutine called by the for-loop, or triggered by an interrupt
signal such as a segmentation fault), and I wouldn't call it exiting the
loop in a controlled way.

 Gareth aka. Kit.

 _______________________________________________ 
 fpc-devel maillist - fpc-devel at lists.freepascal.org [1] 
 http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel [2]"
target="_blank">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


  

Links:
------
[1] mailto:fpc-devel at lists.freepascal.org
[2] http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20180518/bb32a115/attachment.html>


More information about the fpc-devel mailing list