I have pushed a copy of the code in the master branch of https://github.com/yolomep/TIEMERALDCE/ (ignore the main branch, that's github's fault, though there is a readme with the whole error). It's pretty much the code for the whole project I'm working on. It looks like a mess, but the only function you should be worried about is the damageCalc() function. Adding the function just breaks the compiler completely. Removing parts of the function, then compiling, does not break the code. But then, compiling again produces the same error. I may seem to be rambling, but it really is driving me crazy.

I feel like if I compiled with gcc it would give me a better sense of what is going on, but there is no good gcc compiler for ez80.

The header files don't break the program at all, although i did copy the contents into the main.cpp file.
I don't know what to say. The error seems to be about a "function pass manager". The code compiles correctly, so no errors, but the compiler can't seem to turn it into assembly...
Do... you have the latest C toolchain which uses llvm lol. Also this repo doesn't make sense, I would suggest you take a look at https://ce-programming.github.io/toolchain/static/git.html
yeah. I just got the latest c toolchain.
Also, I just pushed the copy of a folder that was supposed to be in C:\CEdev\examples
The only files that you need to pay attention to is the testBattle.cpp and whatever header files it references to. The other header files are part of the main program. The function giving me the error is the damageCalc function. I don't see anything wrong with stynax and compiles correctly. Removing the function entirely solves the problem. Another thing I realized is that regardless of what you remove in the function, as long as it doesn't reach a certain "size" in lines? it works. Though I am not sure about this.
Post the full error message and commands please.
Ok. I have posted in github repo, but i will post again.

simple make clean then make

Before this there are some warnings telling me that I did not use a variable, but it is only a placeholder.

fatal error: error in backend: Error while trying to spill UBC from class O24: Cannot scavenge register without an emergency spill slot!
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: C:\\CEdev\\bin\\ez80-clang.exe -S -nostdinc -isystem C:\\CEdev/include -Isrc -Dinterrupt=__attribute__((__interrupt__)) -Wno-main-return-type -Xclang -fforce-mangle-main-argc-argv -mllvm -profile-guided-section-prefix=false -D_EZ80 -DNDEBUG -g0 -Wall -Wextra -Oz -fno-exceptions -fno-rtti -Wall -Wextra -Oz -Wno-reorder-ctor C:/CEdev/examples/TiEmeraldCE/src/testBattle.cpp -o C:/CEdev/examples/TiEmeraldCE/obj/testBattle.cpp.src
1. <eof> parser at end of file
2. Code generation
3. Running pass 'Function Pass Manager' on module 'C:/CEdev/examples/TiEmeraldCE/src/testBattle.cpp'.
4. Running pass 'Prologue/Epilogue Insertion & Frame Finalization' on function '@_Z10damageCalc7PokemonS_4MovePh'
#0 0x770fb512 (C:\WINDOWS\System32\KERNELBASE.dll+0x12b512)
#1 0x011be2c6 (C:\CEdev\bin\ez80-clang.exe+0x3ae2c6)
#2 0x76403c68 (C:\WINDOWS\System32\ucrtbase.dll+0x33c68)
#3 0x033d02d4 (C:\CEdev\bin\ez80-clang.exe+0x25c02d4)
#4 0x00e1d867 (C:\CEdev\bin\ez80-clang.exe+0xd867)
#5 0x011be4ee (C:\CEdev\bin\ez80-clang.exe+0x3ae4ee)
#6 0x01dbfd7f (C:\CEdev\bin\ez80-clang.exe+0xfafd7f)
#7 0x01dbff53 (C:\CEdev\bin\ez80-clang.exe+0xfaff53)
#8 0x01dc021e (C:\CEdev\bin\ez80-clang.exe+0xfb021e)
#9 0x013f58cb (C:\CEdev\bin\ez80-clang.exe+0x5e58cb)
ez80-clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)
clang version 12.0.0 (https://github.com/jacobly0/llvm-project 170be88120e3aa88c20eea5615ba76b8f1d6c647)
Target: ez80
Thread model: posix
InstalledDir: C:\CEdev\bin
ez80-clang: note: diagnostic msg:
Preprocessed source(s) and associated run script(s) are located at:
ez80-clang: note: diagnostic msg: C:\Users\admin\AppData\Local\Temp\testBattle-91094d.cpp
ez80-clang: note: diagnostic msg: C:\Users\admin\AppData\Local\Temp\testBattle-91094d.sh
ez80-clang: note: diagnostic msg:

make: *** [obj/testBattle.cpp.src] Error 70
The Pokemon class is ginormous, please don't pass them around by value on a CE, you will run into lots of random issues.
Ahhhh. C++ doesn't pass classes by value. So do I use &pokemon?
Thanks. Fixed. Worked. Lol just needed advice from the great Jacobly.
so why does this happen? I just know that passing by reference doesn't require copying all members... I don't usually dabble with these things. I've been learning c++ lately because of contests and lots of people saying that Java doesn't run as fast as c++.
The ez80 only has instructions for addressing signed 8-bit offsets, so by passing more than 128 bytes of arguments you are putting a huge strain on the compiler to generate extremely bloated and register hungry code, something is bound to go wrong somewhere on a hobbyist compiler.
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum