Inspired by https://github.com/pocl/pocl/pull/779
Inspired by pocl/pocl#779