Compiler bug?

Archives Forums/BlitzMax Bug Reports/Compiler bug?

LordChaos(Posted 2009) [#1]
Recently FASM had problems to create a binary of my program, and I tried to track it down. Could someone check this?

' This works:
Local a:Int[] = [1,2,3,4,5,6,7]


Local b:Int Ptr = Int Ptr(a)

Print Int Ptr(b + 5 - 2)[0]

End



' This doesn't:
Local a:Int[] = [1,2,3,4,5,6,7]


Local b:Int Ptr = Int Ptr(a)

Local k:Int = 2

Print Int Ptr(b + 5 - k)[0]

End


' But this does again:
Local a:Int[] = [1,2,3,4,5,6,7]


Local b:Int Ptr = Int Ptr(a)

Local k:Int = 2

Local c:Int Ptr = Int Ptr(b + 5 - k)

Print c[0]

End


The error message is something like this:

	push	dword [eax-edx*4]
error: invalid address.



Brucey(Posted 2009) [#2]
I get this on Mac x86 :
	movl	(%edx,%-eax,4),%eax

error: bad register name `-1.995537e+00ax,4)'


I'd tend to do this instead though :
Print b[5 - k]


But the compiler probably shouldn't be crashing anyway :-)