File tree Expand file tree Collapse file tree 2 files changed +21
-16
lines changed Expand file tree Collapse file tree 2 files changed +21
-16
lines changed Original file line number Diff line number Diff line change @@ -1919,7 +1919,7 @@ PP(pp_subtract)
1919
1919
1920
1920
SV * svr = PL_stack_sp [0 ];
1921
1921
SV * svl = PL_stack_sp [-1 ];
1922
-
1922
+ NV nv ;
1923
1923
1924
1924
#ifdef PERL_PRESERVE_IVUV
1925
1925
@@ -2050,7 +2050,8 @@ PP(pp_subtract)
2050
2050
TARGi (NEGATE_2IV (result ), 1 );
2051
2051
else {
2052
2052
/* result valid, but out of range for IV. */
2053
- TARGn (- (NV )result , 1 );
2053
+ nv = - (NV )result ;
2054
+ goto ret_nv ;
2054
2055
}
2055
2056
}
2056
2057
goto ret ;
@@ -2060,13 +2061,14 @@ PP(pp_subtract)
2060
2061
#else
2061
2062
useleft = USE_LEFT (svl );
2062
2063
#endif
2063
- {
2064
- /* If left operand is undef, treat as zero - value */
2065
- NV value = useleft ? SvNV_nomg (svl ) : 0.0 ;
2066
- value -= SvNV_nomg (svr );
2067
- TARGn (value , 1 );
2068
- goto ret ;
2069
- }
2064
+
2065
+ /* If left operand is undef, treat as zero - value */
2066
+ nv = useleft ? SvNV_nomg (svl ) : 0.0 ;
2067
+ /* Separate statements here to ensure SvNV_nomg(svl) is evaluated
2068
+ before SvNV_nomg(svr) */
2069
+ nv -= SvNV_nomg (svr );
2070
+ ret_nv :
2071
+ TARGn (nv , 1 );
2070
2072
2071
2073
ret :
2072
2074
rpp_replace_2_1_NN (targ );
Original file line number Diff line number Diff line change @@ -1811,6 +1811,7 @@ PP(pp_add)
1811
1811
SV * targ = (PL_op -> op_flags & OPf_STACKED )
1812
1812
? PL_stack_sp [-1 ]
1813
1813
: PAD_SV (PL_op -> op_targ );
1814
+ NV nv ;
1814
1815
1815
1816
if (rpp_try_AMAGIC_2 (add_amg , AMGf_assign |AMGf_numeric ))
1816
1817
return NORMAL ;
@@ -1994,7 +1995,8 @@ PP(pp_add)
1994
1995
TARGi (NEGATE_2IV (result ), 1 );
1995
1996
else {
1996
1997
/* result valid, but out of range for IV. */
1997
- TARGn (- (NV )result , 1 );
1998
+ nv = - (NV )result ;
1999
+ goto ret_nv ;
1998
2000
}
1999
2001
}
2000
2002
goto ret ;
@@ -2006,12 +2008,13 @@ PP(pp_add)
2006
2008
useleft = USE_LEFT (svl );
2007
2009
#endif
2008
2010
2009
- {
2010
- /* If left operand is undef, treat as zero. */
2011
- NV value = useleft ? SvNV_nomg (svl ) : 0.0 ;
2012
- value += SvNV_nomg (svr );
2013
- TARGn (value , 1 );
2014
- }
2011
+ /* If left operand is undef, treat as zero. */
2012
+ nv = useleft ? SvNV_nomg (svl ) : 0.0 ;
2013
+ /* Separate statements here to ensure SvNV_nomg(svl) is evaluated
2014
+ before SvNV_nomg(svr) */
2015
+ nv += SvNV_nomg (svr );
2016
+ ret_nv :
2017
+ TARGn (nv , 1 );
2015
2018
2016
2019
ret :
2017
2020
rpp_replace_2_1_NN (targ );
You can’t perform that action at this time.
0 commit comments