bmx-ng / bcc

A next-generation bcc parser for BlitzMax
zlib License
33 stars 13 forks source link

StaticArray alignment in structs lead to debugstop segfault #590

Closed GWRon closed 2 years ago

GWRon commented 2 years ago
SuperStrict
Framework Brl.StandardIO

Struct STestStruct
    Field X:Int 'does not matter if you prepend something before the arrays
    Field StaticArray statArr1:Int[10]
'    Field StaticArray statArr2:Int[10]
    Field arr1:Int[] = Null
'    Field arr2:Int[] = Null

    Method Base:Int()
        DebugStop  '<--- segfault
        Print "Hello World"
    End Method
End Struct

Local s:STestStruct
s.Base()

This will segfault on reaching the "DebugStop".

If you enable both static arrays then it works.

stat1 + arr1 = FAIL
stat1 + arr1 + arr2 = FAIL
stat1 + arr1 = FAIL
stat1 + stat2 + arr1 = OK
stat1 + stat2 + arr1 + arr2 = FAIL

So this sounds like some alignment issue or so.

GWRon commented 2 years ago

If this is the debugger itself, please move it into brl.mod then

GWRon commented 2 years ago

Works now with commit 1a0bdf84171500df6e94826209bc8a93c8d3650f