Change behavior of -O0 and -O1 for backward compatibility
authorCharles Crayne <chuck@thor.crayne.org>
Tue, 30 Sep 2008 23:11:32 +0000 (16:11 -0700)
committerCharles Crayne <chuck@thor.crayne.org>
Tue, 30 Sep 2008 23:11:32 +0000 (16:11 -0700)
-O0: JMP default to NEAR, Jcc/LOOP/JCXZ default to SHORT.
      In other words, this is reverting to full-blown 0.98 behavior, not
      0.98.39.
-O1: JMP and Jcc default to NEAR, LOOP/JCXZ default to SHORT (only
      possible form).

assemble.c

index 16c8861..9d23240 100644 (file)
@@ -247,9 +247,13 @@ static int jmp_match(int32_t segment, int64_t offset, int bits,
     int64_t isize;
     uint8_t c = code[0];
 
-    if (c != 0370 && c != 0371)
+    if ((c != 0370 && c != 0371) || (ins->oprs[0].type & STRICT))
         return 0;
-    if ((optimizing <= 0 || (ins->oprs[0].type & STRICT)))
+    if (optimizing == 0)
+         {
+            return 0;
+         }
+    if (optimizing < 0 && c == 0371 )
          {
             return 0;
          }