Author Topic: UASM crash with malformed .for syntax  (Read 1778 times)

Biterider

  • Member
  • *****
  • Posts: 1083
  • ObjAsm Developer
    • ObjAsm
UASM crash with malformed .for syntax
« on: May 06, 2020, 09:52:46 PM »
Hi
I was adopting the .for form of looping and I accidentally wrote a "," in place of ":".
It seems that UASM didn't like it at all and crashed.

Code: [Select]
.for (ebx = 0 : ebx < 10, ebx++)
  ...
.endfor

Biterider

habran

  • Member
  • *****
  • Posts: 1228
    • uasm
Re: UASM crash with malformed .for syntax
« Reply #1 on: May 07, 2020, 06:25:36 PM »
You are correct, there was not implemented checking for that.
It will be fixed in next release.
Here is solution for that:
hll.c, inserted on line 1642 and it goes to line 1656 inclusive:
Code: [Select]
    /* check for 2 ':',if not throw an error */
    p = tokenarray[i].tokpos;
    for (b = 0; *p ;p++)
    {
       if (*p == ':') b++;
       if (*p == 39) break;
    }
    if (b < 2) {
      DebugMsg(("HllStartDir .for loop \n"));
    return(EmitError(SYNTAX_ERROR_EX, "Missing ':' before ')'"));
    }
    else if (b > 2) {
      DebugMsg(("HllStartDir .for loop \n"));
      return(EmitError(SYNTAX_ERROR_EX, "Only 2 ':' allowed before ')'"));
    }
line 1657:    // copy string to the buffer and get read of spaces

So, if you are in hurry, you know what to do :wink2:
Cod-Father

Biterider

  • Member
  • *****
  • Posts: 1083
  • ObjAsm Developer
    • ObjAsm
Re: UASM crash with malformed .for syntax
« Reply #2 on: May 07, 2020, 10:53:19 PM »
Hi habran
Thanks for your replay. I only wanted to report this issue.
The best fix is to write it correctly  :biggrin:

Biterider

johnsa

  • Member
  • ****
  • Posts: 893
    • Uasm
Re: UASM crash with malformed .for syntax
« Reply #3 on: May 11, 2020, 02:50:43 AM »
This update is in 2.50 branch now.