Make sure preallocated output is contiguous before using it