Hi.

Doing something like

    movl (4+2)*4(%eax),%ebx

causes tcc to abort with "32 bit register expected" (a similar line can be found in the wine sources) - tcc assumes no displacement when it sees the '(' and tries to parse the 4 as the base-register.

A quick fix (and the way it's done in gas) would be:

--- i386-asm.c  18 Oct 2004 00:13:39 -0000      1.5
+++ i386-asm.c  22 May 2005 15:26:16 -0000
@@ -294,10 +294,15 @@
         op->reg2 = -1;
         op->shift = 0;
         if (tok != '(') {
+        disp_expr:
             asm_expr(s1, &e);
             op->e.v = e.v;
             op->e.sym = e.sym;
         } else {
+            char c, *p = file->buf_ptr;
+            PEEKC(c, p);
+            if(c != '%' && c != ',')
+                goto disp_expr;
             op->e.v = 0;
             op->e.sym = NULL;
         }


However that's a rather ugly hack - I guess it would be more correct to move EA parsing (or at least EA detection) to asm_expr()?

-flx

P.S.: Considering the traffic of this list and the number of CVS checkins I'm wondering... is this project dead?


_______________________________________________
Tinycc-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to