Browse Source

* fixed web bug #1716

Jonas Maebe 24 years ago
parent
commit
760e88791c
1 changed files with 8 additions and 5 deletions
  1. 8 5
      compiler/i386/n386mat.pas

+ 8 - 5
compiler/i386/n386mat.pas

@@ -246,6 +246,8 @@ implementation
                    ungetregister32(R_EDI);
                    ungetregister32(R_EDI);
                    if nodetype=divn then
                    if nodetype=divn then
                      begin
                      begin
+                        if not popedx and (hreg1 <> R_EDX) then
+                          ungetregister(R_EDX);
                         { if result register is busy then copy }
                         { if result register is busy then copy }
                         if popeax then
                         if popeax then
                           begin
                           begin
@@ -261,14 +263,14 @@ implementation
                               { the div (JM)                                        }
                               { the div (JM)                                        }
                               hreg1 := R_EAX;
                               hreg1 := R_EAX;
                             end;
                             end;
-                        if not popedx and (hreg1 <> R_EDX) then
-                          ungetregister(R_EDX);
                      end
                      end
                    else
                    else
                      {if we did the mod by an "and", the result is in hreg1 and
                      {if we did the mod by an "and", the result is in hreg1 and
                       EDX certainly hasn't been pushed (JM)}
                       EDX certainly hasn't been pushed (JM)}
                      if not(andmod) Then
                      if not(andmod) Then
                        begin
                        begin
+                         if not popeax and (hreg1 <> R_EAX)then
+                           ungetregister(R_EAX);
                          if popedx then
                          if popedx then
                           {the mod was done by an (i)div (so the result is now in
                           {the mod was done by an (i)div (so the result is now in
                            edx), but edx was occupied prior to the division, so
                            edx), but edx was occupied prior to the division, so
@@ -280,8 +282,6 @@ implementation
                                ungetregister32(hreg1);
                                ungetregister32(hreg1);
                              hreg1 := R_EDX
                              hreg1 := R_EDX
                            End;
                            End;
-                         if not popeax and (hreg1 <> R_EAX)then
-                           ungetregister(R_EAX);
                        end;
                        end;
                    if popeax then
                    if popeax then
                      emit_reg(A_POP,S_L,R_EAX);
                      emit_reg(A_POP,S_L,R_EAX);
@@ -1018,7 +1018,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.18  2001-12-04 15:57:28  jonas
+  Revision 1.19  2001-12-07 13:03:49  jonas
+    * fixed web bug 1716
+
+  Revision 1.18  2001/12/04 15:57:28  jonas
     * never generate any "shll/shrl $0,%reg" anymore
     * never generate any "shll/shrl $0,%reg" anymore
 
 
   Revision 1.17  2001/12/02 16:19:17  jonas
   Revision 1.17  2001/12/02 16:19:17  jonas