[PATCH] util: refactor code to workaround gcc 10.1.0 bug