jacobly0 / llvm-project

This fork of the canonical git mirror of the LLVM subversion repository adds (e)Z80 targets. Please refer to the wiki for important build instructions.
https://github.com/jacobly0/llvm-project/wiki
123 stars 15 forks source link

Any compile fails #3

Closed b-s-a closed 4 years ago

b-s-a commented 4 years ago

I try to compile small function: $ ~/projects/llvm-project/build/bin/clang -target z180 -v -xc -S -o- - <<<'int main(void) { return 0; }' fatal error: error in backend: unable to legalize instruction: GSTORE %1:(s16), %0:_(p0) :: (store 2 into %ir.retval, align 1) (in function: main) clang-10: error: clang frontend command failed with exit code 70 (use -v to see invocation) clang version 10.0.0 (https://github.com/b-s-a/llvm-project.git 040b525c8d7f148c892431cc12a85b4e9bdbf6f0)

More complex functions (for example { return x * y; } or CRC computation) cause same errors (instructions G_LOAD, G_PHI...).

jacobly0 commented 4 years ago

Yeah this seems like a bug with at least Release Linux builds that I haven't tracked down yet.

b-s-a commented 4 years ago

Can I help you to fix the bug? I just build llvm with clang from your repository. I do not understand, how my Linux may influence on build results.

jacobly0 commented 4 years ago

This bug does not happen with a Debug Linux build, but I can reproduce it with a Release Linux Build.

b-s-a commented 4 years ago

Interesting. I suggest run compilation under valgrind memcheck. But it is may be caused by UB in the code.

jacobly0 commented 4 years ago

I have fixed this, will push soon.