Wrote a fortran module which can wrap all the matrix data types at once. By the grace of God, it compiled without any ICEs. Tested with CSR format successfully.