Skip to content

Translation failed with union #14

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

Closed
yjh0502 opened this issue May 23, 2011 · 2 comments
Closed

Translation failed with union #14

yjh0502 opened this issue May 23, 2011 · 2 comments
Assignees

Comments

@yjh0502
Copy link

yjh0502 commented May 23, 2011

You can get a disassembled llvm from following link: http://desti.ruree.net/core_simple.o.ll
Original source code is here: http://dosbox.svn.sourceforge.net/viewvc/dosbox/dosbox/tags/RELEASE_0_74/src/cpu/core_simple.cpp?revision=3609&view=markup

I don't know why, but it failed after long execution, and a error message is following:

Assertion failed: What variable is this? |getelementptr|
Stack: Error
    at assertTrue (utility.js:60:23)
    at getVarImpl (jsifier.js:435:5)
    at jsifier.js:636:16
    at Object.processItem (jsifier.js:495:19)
    at Object.process (framework.js:155:26)
    at framework.js:104:25
    at Array.forEach (native)
    at Object.solve (framework.js:92:27)
    at JSify (jsifier.js:792:34)
    at JSify (jsifier.js:33:15)
utility.js:61: Assertion failed: What variable is this? |getelementptr|
    throw msg;
    ^
@yjh0502
Copy link
Author

yjh0502 commented May 24, 2011

Shorter source code. I wish it helps.

#include <stdint.h>

enum {
    REGI_AX, REGI_CX, REGI_DX, REGI_BX,
    REGI_SP, REGI_BP, REGI_SI, REGI_DI
};

union GenReg32 {
    uint32_t dword[1];
    uint16_t word[2];
    uint8_t byte[4];
};

struct CPU_Regs {
    GenReg32 regs[8];
};

CPU_Regs cpu_regs;

int main(void) {
    cpu_regs.regs[REGI_AX].word[0] = 
        cpu_regs.regs[REGI_DX].word[0];

    return 0;
}

@ghost ghost assigned kripken May 24, 2011
@kripken
Copy link
Member

kripken commented May 24, 2011

Thanks for filing this issue, and especially for the reduced testcase! :)

This is fixed in commit bcdfcfb.

@kripken kripken closed this as completed May 24, 2011
gunyarakun pushed a commit to tombo-a2o/emscripten that referenced this issue Jun 18, 2018
tlively pushed a commit to tlively/emscripten that referenced this issue Mar 23, 2022
steveisok pushed a commit to steveisok/emscripten that referenced this issue Sep 18, 2023
…804.2 (emscripten-core#14)

[dotnet/main] Update dependencies from dotnet/arcade
eagleoflqj pushed a commit to eagleoflqj/emscripten that referenced this issue Nov 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants