@@ -279,7 +279,8 @@ pack_halffloat(_structmodulestate *state,
279279               PyObject  * v ,  /* value to pack */ 
280280               int  le )       /* true for little-endian, false for big-endian */ 
281281{
282-     double  x  =  PyFloat_AsDouble (v );
282+     volatile  double  x  =  PyFloat_AsDouble (v );
283+ 
283284    if  (x  ==  -1.0  &&  PyErr_Occurred ()) {
284285        PyErr_SetString (state -> StructError ,
285286                        "required argument is not a float" );
@@ -764,26 +765,28 @@ np_halffloat(_structmodulestate *state, char *p, PyObject *v, const formatdef *f
764765static  int 
765766np_float (_structmodulestate  * state , char  * p , PyObject  * v , const  formatdef  * f )
766767{
767-     float  x  =  (float )PyFloat_AsDouble (v );
768+     volatile  float  x  =  (float )PyFloat_AsDouble (v );
769+ 
768770    if  (x  ==  -1  &&  PyErr_Occurred ()) {
769771        PyErr_SetString (state -> StructError ,
770772                        "required argument is not a float" );
771773        return  -1 ;
772774    }
773-     memcpy (p , & x , sizeof  x );
775+     memcpy (p , ( void   * ) & x , sizeof  x );
774776    return  0 ;
775777}
776778
777779static  int 
778780np_double (_structmodulestate  * state , char  * p , PyObject  * v , const  formatdef  * f )
779781{
780-     double  x  =  PyFloat_AsDouble (v );
782+     volatile  double  x  =  PyFloat_AsDouble (v );
783+ 
781784    if  (x  ==  -1  &&  PyErr_Occurred ()) {
782785        PyErr_SetString (state -> StructError ,
783786                        "required argument is not a float" );
784787        return  -1 ;
785788    }
786-     memcpy (p , & x , sizeof (double ));
789+     memcpy (p , ( void   * ) & x , sizeof (double ));
787790    return  0 ;
788791}
789792
@@ -1138,7 +1141,8 @@ bp_halffloat(_structmodulestate *state, char *p, PyObject *v, const formatdef *f
11381141static  int 
11391142bp_float (_structmodulestate  * state , char  * p , PyObject  * v , const  formatdef  * f )
11401143{
1141-     double  x  =  PyFloat_AsDouble (v );
1144+     volatile  double  x  =  PyFloat_AsDouble (v );
1145+ 
11421146    if  (x  ==  -1  &&  PyErr_Occurred ()) {
11431147        PyErr_SetString (state -> StructError ,
11441148                        "required argument is not a float" );
@@ -1150,7 +1154,8 @@ bp_float(_structmodulestate *state, char *p, PyObject *v, const formatdef *f)
11501154static  int 
11511155bp_double (_structmodulestate  * state , char  * p , PyObject  * v , const  formatdef  * f )
11521156{
1153-     double  x  =  PyFloat_AsDouble (v );
1157+     volatile  double  x  =  PyFloat_AsDouble (v );
1158+ 
11541159    if  (x  ==  -1  &&  PyErr_Occurred ()) {
11551160        PyErr_SetString (state -> StructError ,
11561161                        "required argument is not a float" );
@@ -1475,7 +1480,8 @@ lp_halffloat(_structmodulestate *state, char *p, PyObject *v, const formatdef *f
14751480static  int 
14761481lp_float (_structmodulestate  * state , char  * p , PyObject  * v , const  formatdef  * f )
14771482{
1478-     double  x  =  PyFloat_AsDouble (v );
1483+     volatile  double  x  =  PyFloat_AsDouble (v );
1484+ 
14791485    if  (x  ==  -1  &&  PyErr_Occurred ()) {
14801486        PyErr_SetString (state -> StructError ,
14811487                        "required argument is not a float" );
@@ -1487,7 +1493,8 @@ lp_float(_structmodulestate *state, char *p, PyObject *v, const formatdef *f)
14871493static  int 
14881494lp_double (_structmodulestate  * state , char  * p , PyObject  * v , const  formatdef  * f )
14891495{
1490-     double  x  =  PyFloat_AsDouble (v );
1496+     volatile  double  x  =  PyFloat_AsDouble (v );
1497+ 
14911498    if  (x  ==  -1  &&  PyErr_Occurred ()) {
14921499        PyErr_SetString (state -> StructError ,
14931500                        "required argument is not a float" );
0 commit comments