Author Topic: UAsm 2.41 bug, unknown cause.  (Read 177 times)

jimg

  • Member
  • **
  • Posts: 191
UAsm 2.41 bug, unknown cause.
« on: October 02, 2017, 09:25:49 AM »

The following program fails in assembly
Code: [Select]
.686p
.model  flat, stdcall
option  casemap :none   ; case sensitive
.xmm
.data
ProgName db "Uasm Test",0
.code
.nolist
include windows.inc

.code

Program:
    invoke ExitProcess, 0
end Program

The output:
Code: [Select]
UASM v2.41, Sep 29 2017, Masm-compatible assembler.
Portions Copyright (c) 1992-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.

***********
ASCII build
***********

F:\masm32\INCLUDE\winextra.inc(25183) : Error A2169: General Failure
 F:\masm32\INCLUDE\winextra.inc(25183): Included by
  F:\masm32\INCLUDE\windows.inc(26889): Included by
   R:\bugtest\Sol.asm(10): Main line code

If I take out the .nolist, I get
Code: [Select]
F:\masm32\INCLUDE\windows.inc(21253) : Error A2169: General Failure
 F:\masm32\INCLUDE\windows.inc(21253): Included by
  R:\bugtest\Sol.asm(10): Main line code

So I really don't know how to pin down the error much more without stripping stuff out of windows.inc
I downloaded and installed the latest masm32v11r.zip to get windows.inc and winextra.inc to be sure mine weren't corrupted.  They were identical, so that's not the problem.



jj2007

  • Member
  • *****
  • Posts: 7558
  • Assembler is fun ;-)
    • MasmBasic
Re: UAsm 2.41 bug, unknown cause.
« Reply #1 on: October 02, 2017, 10:32:45 AM »
It fails also for me:

UAsm64, latest build of today:
Tmp_File.asm(14) : Error A2160: INVOKE requires prototype for procedure

ML 6.15:
tmp_file.asm(14) : error A2006: undefined symbol : ExitProcess

jimg

  • Member
  • **
  • Posts: 191
Re: UAsm 2.41 bug, unknown cause.
« Reply #2 on: October 02, 2017, 11:10:39 AM »
okay-

same error with this program:
Code: [Select]
.686p
.model  flat, stdcall
option  casemap:none
.code
include R:\bugtest\windows.inc
.code
Program:
    ret
end Program
no more invoke.

habran

  • Member
  • *****
  • Posts: 1107
    • uasm
Re: UAsm 2.41 bug, unknown cause.
« Reply #3 on: October 02, 2017, 11:45:06 AM »
I'll work on this later this afternoon
now I am busy with 32bit -> 64bit RECORD :dazzled:
Cod-Father

jimg

  • Member
  • **
  • Posts: 191
Re: UAsm 2.41 bug, unknown cause.
« Reply #4 on: October 02, 2017, 11:59:27 AM »
No problem.  I'm grateful for all you do  8)

Anyway, I just spent hours deleting stuff out of windows.inc and the problem seems to be more like it is a Uasm internal buffer problem, rather than something specific with the actual code.  "Seems"  being the operative word, I can't absolutely confirm yet.

habran

  • Member
  • *****
  • Posts: 1107
    • uasm
Re: UAsm 2.41 bug, unknown cause.
« Reply #5 on: October 02, 2017, 01:02:05 PM »
Try harder, it is easy to fix the problem ones when we know what it is ;)
Cod-Father

jj2007

  • Member
  • *****
  • Posts: 7558
  • Assembler is fun ;-)
    • MasmBasic
Re: UAsm 2.41 bug, unknown cause.
« Reply #6 on: October 02, 2017, 05:32:06 PM »
Jim,

It could be related to
a) symbol ExitProcess missing (no kernel32.inc) and
b) includes and source on different drives

But of course, "general failure" is never a nice feedback :(
« Last Edit: October 02, 2017, 07:06:56 PM by jj2007 »

aw27

  • Member
  • ****
  • Posts: 709
Re: UAsm 2.41 bug, unknown cause.
« Reply #7 on: October 02, 2017, 06:00:45 PM »
okay-

same error with this program:
Code: [Select]
.686p
.model  flat, stdcall
option  casemap:none
.code
include \masm32\include\windows.inc
.code
Program:
    ret
end Program
no more invoke.

This works here.
Make sure you build with:
uasm64 -c -coff jimg.asm
link /SUBSYSTEM:console jimg.obj


habran

  • Member
  • *****
  • Posts: 1107
    • uasm
Re: UAsm 2.41 bug, unknown cause.
« Reply #8 on: October 02, 2017, 06:42:45 PM »
Thanks aw27 :t
Cod-Father

jimg

  • Member
  • **
  • Posts: 191
Re: UAsm 2.41 bug, unknown cause.
« Reply #9 on: October 03, 2017, 01:06:23 AM »
I used /c /coff /Cp /Fl /Sn /Sg

jj-
I moved everything into one folder on a different drive with same results
I deleted winextra, and started deleting stuff from within windows.inc until it's down to 449 kb so far.

It's very touchy.   Sometimes I delete a block and it works.  I put that block back in, it doesn't work. 
I delete a different block, sometimes it works, sometimes not.

At one point, it got so if I deleted a single blank line, it would work, but if I put the blank line back in it failed.

Which is why I think it is some kind of internal buffer/pointer problem.




jj2007

  • Member
  • *****
  • Posts: 7558
  • Assembler is fun ;-)
    • MasmBasic
Re: UAsm 2.41 bug, unknown cause.
« Reply #10 on: October 03, 2017, 01:28:05 AM »
Code: [Select]
*** Assemble using \masm32\bin\UAsm64 /c /coff /c /coff /Cp /Fl /Sn /Sg tmp_file.asm ***
UASM v2.41, Oct  1 2017, Masm-compatible assembler.
Portions Copyright (c) 1992-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.

***********
ASCII build
***********

Tmp_File.asm: 9 lines, 2 passes, 91 ms, 0 warnings, 0 errors

Only change to your code:
  include R:\bugtest\windows.inc
to
  include C:\Masm32\include\windows.inc

I use UAsm64 by default, and assemble a dozen different sources every day. No such problems in the last six months or so...

johnsa

  • Member
  • ****
  • Posts: 526
    • Uasm
Re: UAsm 2.41 bug, unknown cause.
« Reply #11 on: October 03, 2017, 01:53:40 AM »
I have to say I've not been able to re-produce this error under any conditions using any of the various includes.

Given that it seems to be random I don't believe it has much to do with the specific file in question, it definitely sounds like some sort of memory corruption or buffer overrun issue.

What OS/versions/ram size etc ? Perhaps I need to try a different test combination if there is something else causing interference.

jimg

  • Member
  • **
  • Posts: 191
Re: UAsm 2.41 bug, unknown cause.
« Reply #12 on: October 03, 2017, 02:01:13 AM »
While you were testing, so was I and I came to a similar conclusion.

I put everything in a single folder, including uasm32.exe, so there were no different drives drives involved.

if I assemble with-

uasm32 /c /coff /Cp /Fl /Sn /Sg "Sol.asm"

 it works,but if I assemble with

uasm32 /c /coff /Cp /Fl /Sn /Sg ".\Sol.asm"

 it fails.

Similarly, if I use the above line that worked, but change the include line to

include windows.inc

  it works, but if I use

include R:\bugtest\windows.inc
 
 it fails, even though it is the same file.

So I changed the name of the include file to be sure it wasn't referencing the masm32 include folder somehow, and got totally different results using the above tests, but it still fails.  I'm putting together as simple a test as I can to upload.

jj2007

  • Member
  • *****
  • Posts: 7558
  • Assembler is fun ;-)
    • MasmBasic
Re: UAsm 2.41 bug, unknown cause.
« Reply #13 on: October 03, 2017, 02:08:08 AM »
Given that it seems to be random

For Jim, it doesn't seem so random. Does the "general failure" result from a SEH? If yes, can that be switched off for testing, so that Jim gets to see the offending line in the Just-in-time debugger? JIT works fine with x64dbg.

jimg

  • Member
  • **
  • Posts: 191
Re: UAsm 2.41 bug, unknown cause.
« Reply #14 on: October 03, 2017, 02:10:29 AM »
Since John found the problem, I'm deleteing the huge worthless attachment.