forked from lijiext/lammps
avoids the possibility of undefined behavior with memcpy having the same source and destination arrays; this is not every instance of this issue in the source code
This commit is contained in:
parent
3e4fd3dade
commit
76900b8325
|
@ -56,7 +56,7 @@ int mldivide3(const double m[3][3], const double *v, double *ans)
|
||||||
if (fabs(aug[j][i]) > fabs(aug[i][i])) {
|
if (fabs(aug[j][i]) > fabs(aug[i][i])) {
|
||||||
double tempv[4];
|
double tempv[4];
|
||||||
memcpy(tempv,aug[i],4*sizeof(double));
|
memcpy(tempv,aug[i],4*sizeof(double));
|
||||||
memcpy(aug[i],aug[j],4*sizeof(double));
|
memmove(aug[i],aug[j],4*sizeof(double));
|
||||||
memcpy(aug[j],tempv,4*sizeof(double));
|
memcpy(aug[j],tempv,4*sizeof(double));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ int mldivide3(const double m[3][3], const double *v, double *ans)
|
||||||
if (p != i) {
|
if (p != i) {
|
||||||
double tempv[4];
|
double tempv[4];
|
||||||
memcpy(tempv,aug[i],4*sizeof(double));
|
memcpy(tempv,aug[i],4*sizeof(double));
|
||||||
memcpy(aug[i],aug[p],4*sizeof(double));
|
memmove(aug[i],aug[p],4*sizeof(double));
|
||||||
memcpy(aug[p],tempv,4*sizeof(double));
|
memcpy(aug[p],tempv,4*sizeof(double));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -537,7 +537,7 @@ void RCB::compute(int dimension, int n, double **x, double *wt,
|
||||||
if (dotmark[i] == markactive)
|
if (dotmark[i] == markactive)
|
||||||
memcpy(&buf[outgoing++],&dots[i],sizeof(Dot));
|
memcpy(&buf[outgoing++],&dots[i],sizeof(Dot));
|
||||||
else
|
else
|
||||||
memcpy(&dots[keep++],&dots[i],sizeof(Dot));
|
memmove(&dots[keep++],&dots[i],sizeof(Dot));
|
||||||
}
|
}
|
||||||
|
|
||||||
// post receives for dots
|
// post receives for dots
|
||||||
|
@ -1029,7 +1029,7 @@ void RCB::compute_old(int dimension, int n, double **x, double *wt,
|
||||||
if (dotmark[i] == markactive)
|
if (dotmark[i] == markactive)
|
||||||
memcpy(&buf[outgoing++],&dots[i],sizeof(Dot));
|
memcpy(&buf[outgoing++],&dots[i],sizeof(Dot));
|
||||||
else
|
else
|
||||||
memcpy(&dots[keep++],&dots[i],sizeof(Dot));
|
memmove(&dots[keep++],&dots[i],sizeof(Dot));
|
||||||
}
|
}
|
||||||
|
|
||||||
// post receives for dots
|
// post receives for dots
|
||||||
|
|
Loading…
Reference in New Issue