The fourth line of this function writes, "local = Array<OneD, NekDouble>(local.num_elements(),local.data());", which aims to make a copy of "loc" if "loc" and "global" have the same address. But this line makes a copy of "local", which hasn't been initialized yet. So this line should be substituted by "local = Array<OneD, NekDouble>(loc.num_elements(),loc.data());"
Best regards,
Ankang