Kingcom / armips

An assembler for various ARM and MIPS platforms. Builds available at http://buildbot.orphis.net/armips/
MIT License
363 stars 77 forks source link

Building as Release (as per readme) on macOS/clang causes errors with some valid ARM opcodes #108

Closed AuroraWright closed 7 years ago

AuroraWright commented 7 years ago

Hi, I just compiled the latest commit as Release (as indicated in the readme) on macOS (clang-802.0.42, not sure if this also happens with GCC), but when compiling this file: https://github.com/AuroraWright/Luma3DS/blob/master/patches/reboot.s#L67 it errors: /Users/aurora/Luma3DS/patches/reboot.s(67) error: Invalid shifted immediate 52 When omitting the "-DCMAKE_BUILD_TYPE=Release" it works just fine.

Kingcom commented 7 years ago

Hm, probably the same reason as #84. Interesting that it only happens with Release builds. At the very least this doesn't happen with Visual Studio, but it may be that the immediate parsing code is relying on some undefined behavior somewhere... This is likely to be the function where it goes wrong: https://github.com/Kingcom/armips/blob/master/Archs/ARM/CArmInstruction.cpp#L31 Called from here: https://github.com/Kingcom/armips/blob/master/Archs/ARM/CArmInstruction.cpp#L213

I'll have to try it out in a Linux/Ubuntu VM later to see if I can reproduce it there. If you want, can you maybe post the assembly code generated for getShiftedImmediate, or try to disable optimizations for it and see if it helps?