Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unsupported member object access using inline PPC load instruction crashes compiler #11

Open
Hypexed opened this issue Aug 14, 2021 · 0 comments
Labels
bug Something isn't working
Milestone

Comments

@Hypexed
Copy link

Hypexed commented Aug 14, 2021

The ECX guide is vague and lacks more examples but some PPC ASM constructs are unsupported. The compiler will attempt to throw an error but will send a corrupt pointer to output and crash. Depending on the severity it can recover after the crash and will write corrupt code to binary.

Consider the following construct:
LZW Rx, .member(object:Rx)

This will crash:

DEF object:PTR TO object, base:REG PTR TO object

LZW R13, .member(object)
LZW R13, .member(object:object)
LZW R13, .member(base:object)
LZW R13, member(base)

As you can see, technically it should accept base as base is a register, but it doesn't work and crashes. On top of this it's also rather complicated. In most cases, internally it will need to load the base in and the load a member off the base. But if the base is already a register all it needs to do is to load member offset from base. I also tested using OFFSETOF to calculate a member offset from base but it gives another error about that even after setting it in a CONST value.

The problem code is in ppcgen.e in the doAsm() proc at the section examining "." member case.

@SamuraiCrow SamuraiCrow added the bug Something isn't working label Aug 14, 2021
@SamuraiCrow SamuraiCrow added this to the Release 1.0 milestone May 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants