[sgen] Fix an endless loop canary bug.