Put assert-only loop under HAVE_DIAGNOSTIC. #1371