Message333877
| Author | vstinner |
|---|---|
| Recipients | David.Edelsohn, cstratak, fweimer, mark.dickinson, skrah, vstinner |
| Date | 2019-01-17.14:44:14 |
| SpamBayes Score | -1.0 |
| Marked as misclassified | Yes |
| Message-id | <1547736254.52.0.711543941858.issue35752@roundup.psfhosted.org> |
| In-reply-to |
| Content | |
|---|---|
The bug occurs when GCC emits a single instruction (stxsspx) for cast + memcpy.
I understand that the struct module is not affected because there is a condition branch (if) between the cast ("float x = ...") and the memcpy().
static int
np_float(char *p, PyObject *v, const formatdef *f)
{
float x = (float)PyFloat_AsDouble(v);
if (x == -1 && PyErr_Occurred()) {
PyErr_SetString(StructError,
"required argument is not a float");
return -1;
}
memcpy(p, (char *)&x, sizeof x);
return 0;
} |
|
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2019-01-17 14:44:16 | vstinner | set | recipients: + vstinner, mark.dickinson, skrah, fweimer, David.Edelsohn, cstratak |
| 2019-01-17 14:44:14 | vstinner | set | messageid: <1547736254.52.0.711543941858.issue35752@roundup.psfhosted.org> |
| 2019-01-17 14:44:14 | vstinner | link | issue35752 messages |
| 2019-01-17 14:44:14 | vstinner | create | |