Skip to content

Sparc: VM miscopiled with -O2 #151

@nbuwe

Description

@nbuwe

reldbg build defaults to -O2 and on NetBSD/sparc with gcc (nb2 20230710) 10.5.0 the VM gets SIGBUS when trying to load the world:

#0  Conversion::convertVFrames (this=0x6ebfc8) at vm/src/any/runtime/conversion.cpp:176
#1  0x000c75f8 in Conversion::convert (this=0x6ebfc8) at vm/src/any/runtime/conversion.cpp:66
#2  0x000c8578 in Conversion::doit (this=0x6ebfc8) at vm/src/any/runtime/conversion.cpp:14
#3  0x000e6208 in switchToVMStack (continuation=0xc9380 <ConvertFrame_cont()>) at vm/src/any/runtime/process.cpp:1800
#4  0x000cbd14 in ConvertFrame (isInterp=false, nlrHomeID=14, nlrHome=0xe7ffe030, nlr=true, sp=0xe7ffe030, result=0x40e5785) at vm/src/any/runtime/frame.cpp:518
#5  HandleReturnTrap (result=0x40e5785, sp_of_patched_frame=0xe7ffe030, nlr=<optimized out>, nlrHome=0xe7ffe030, nlrHomeID=14) at vm/src/any/runtime/frame.cpp:588
#6  0x00175954 in ReturnTrapNLR_returnPC ()

Telling reldbg to use more conservative -Og results in the VM that seems to work ok and passes the tests.

Unfortunately, I currently don't have time to debug this further or to binary-search for the -f optimization that is not in -Og but is in -O2 that triggers this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions