Make x volatile to prevent infinite loop caused by overaggressive optimization

This fixes issue #257.