I was processing the transitive inferred ranges in fold_stmt when it was the final statement in the block.  the substitute_and_fold engine actually does a bit of work before calling fold_stmt.  this patch moves the check to pre_fold_stmt instead so it gets done before the final statement in the block is processed... as was the original intention. I also changed it so we always do this just before the last statement in any block.  This allows us to get transitive inferred ranges registered for returns, as well as just normal blocks which can feed other blocks.   Performance impact is minimal. Bootstraped on x86_64-pc-linux-gnu with no regressions.  Pushed. Andrei