English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 31 July 2020, 22:24   #1
buzzybee
Registered User
 
Join Date: Oct 2015
Location: Landsberg / Germany
Posts: 526
VASM: strange behaviour, quits with error 8

I am currently cleaning up portions of code within the RESHOOT PROXIMA 3 project. Strange things happen. For example, VASM compiles sourcecode perfectly fine when it looks like this:

Code:
    tst.b .wbclosed(pc)
    beq .reopenWB
    nop	; without this VASM quits. Wtf?
	CALLINTUITION OpenWorkBench
.reopenWB
But with this code ...
Code:
    tst.b .wbclosed(pc)
    beq .reopenWB
;    nop	; without this VASM quits. Wtf?
	CALLINTUITION OpenWorkBench
.reopenWB
... VASM quits after a few moments and prints this line:
fatal error 8: cannot resolve section <CODE>, maximum number of passes reached

Given code is just an example. I am having trouble reproducing the error, but it seems like the error happens if size of code is too small (?!) / behavour seems to be related to size of source / compiled code. Puzzled. Anyone got any idea what might happen here?

Last edited by buzzybee; 31 July 2020 at 22:36.
buzzybee is offline  
Old 31 July 2020, 22:49   #2
buzzybee
Registered User
 
Join Date: Oct 2015
Location: Landsberg / Germany
Posts: 526
Ah, seems like the puzzle was solved. I had these lines in my startup-code

Code:
.VARS
	ALIGNLONG (align to 4-byte address)
.OldView	dc.l	0
.OldCop1	dc.l	0
.OldCop2	dc.l	0
.VBRptr		dc.l	0
...
... where I should have had those:

Code:
	ALIGNLONG (align to 4-byte address)
.VARS
.OldView	dc.l	0
.OldCop1	dc.l	0
.OldCop2	dc.l	0
.VBRptr		dc.l	0
...
Therefore, .VARS was at first only randomly aligned to .OldView etc., which is fatal as .VARS is referenced several times within startup-code like this

move.l sp,.Stack-.VARS(a5) ; save stack

I would have imagined VASM would still compile even the address of VARS is not aligned and not dividable by 4 (of course code would have crashed then), but hey ...

Should not code when I am too tired at night.

Last edited by buzzybee; 31 July 2020 at 22:58.
buzzybee is offline  
Old 07 August 2020, 23:06   #3
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
Quote:
Originally Posted by buzzybee View Post
I would have imagined VASM would still compile even the address of VARS is not aligned and not dividable by 4
It would.

The problem here is that the combination of branch-optimizations and 32-bit alignments may get you into a situation which results in an endless oscillation of performing the optimization and having to revert it again. A special difficulty on the M68k is that a branch instruction has to become larger (Bcc.W) when the distance to the target becomes zero (even when only momentarily).

vasm has lots of strategies to deal with it. So usually it shouldn't happen, but with some weird code constructions it still seems to be possible.

I'm glad that you found the problem. Otherwise your last options would have been to set a fixed size for the branch or to disable optimizations in this area.
phx is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
vasm strange behaviour Den Coders. Asm / Hardware 3 12 December 2015 15:24
Strange Prefs (non) behaviour. khph_re support.WinUAE 4 02 October 2010 14:34
Strange A600 behaviour Gavilan support.Hardware 9 08 July 2009 19:02
Strange guru behaviour! deejaya support.Other 11 31 January 2009 21:01
Strange A1200 behaviour manicx support.Hardware 39 09 November 2005 08:32

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 22:10.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.11666 seconds with 13 queries