This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #87708] $tied / $tied under use integer
[perl5.git] / pp.c
diff --git a/pp.c b/pp.c
index 9858f91..941cc9d 100644 (file)
--- a/pp.c
+++ b/pp.c
@@ -2846,15 +2846,14 @@ PP(pp_i_multiply)
 
 PP(pp_i_divide)
 {
-    IV num;
     dVAR; dSP; dATARGET;
     tryAMAGICbin_MG(div_amg, AMGf_assign);
     {
       dPOPTOPssrl;
-      IV value = SvIV_nomg(right);
+      IV num = SvIV_nomg(left);
+      IV value = left==right ? SvIV(right) : SvIV_nomg(right);
       if (value == 0)
          DIE(aTHX_ "Illegal division by zero");
-      num = SvIV_nomg(left);
 
       /* avoid FPE_INTOVF on some platforms when num is IV_MIN */
       if (value == -1)