Closed C-far closed 5 years ago
Can you show which line in your code caused the assertion?
@YashasSamaga The GM has +50 000 lines (it's horrible, but it was not I who made it), excluding includes. The assertion is caused by the variable glb_declared (see the file /compiler/sc4.c line 76).
The code in your GM which caused it is needed (not all your code). It is really difficult to find out what caused it without having something to start with.
@YashasSamaga Yes I know this a part of code which causes this assertion, but with so much lines, it is difficult for me to detect the line.
Do you have a technic to find easily ?
I think I've found a way to reprodeuce the bug or some other bug that causes the error.
#include <fixes>
main()
{
print("\n----------------------------------");
print(" Bare Script\n");
print("----------------------------------\n");
printf("Compiled on %s at %s\n", __date, __time);
}
The last printf()
with the __date
and __time
constants causes the assertion error. But the error is reproduced only if you have the "fixes" include and only on Linux. The native Linux compiler exits with the error, the Windows version of the compiler under Wine prints out a lot of nonsense warnings, and the server just crashes. Windows compiler under Windows compiles the gamemode just fine.
Hope that helps.
P.S. Compiler cmd line:
LD_LIBRARY_PATH=../bin ../bin/pawncc filename.pwn -\; -\( -d1 -O1 -i=../pawno/include
wine ../pawno/pawncc.exe filename.pwn -\; -\( -d1 -O1
What are the nonsense warnings on wine?
The warnings are about unused symbols, but the symbols are actually in use.
filename.pwn(0) : warning 203: symbol is never used: "carid"
filename.pwn(0) : warning 203: symbol is never used: "cordx"
filename.pwn(0) : warning 203: symbol is never used: "cordy"
filename.pwn(0) : warning 203: symbol is never used: "cordz"
filename.pwn(28185 -- 0) : warning 203: symbol is never used: "string"
Found a way to trigger the same assertion failure without including fixes.inc:
#include <a_samp>
public OnGameModeInit()<automaton1:STATE1>{}
main()
{
printf("File: %s", __file);
}
So what happens here is that string constants __file
, __date
and __time
are predefined, so if they're used somewhere, then their data is being put into the assembler file before the automatons (and before everything else, including the halt 0
program exit point), thus causing an assertion failure.
The fix for this should be relatively simple.
This issue has been automatically marked as stale because it has not had recent activity.
@pawn-lang You'll probably want to close this and #399 (fixed in #433).
Done. Thanks.
Hello, with a friend we are working with a BitBucket repository, the machine pulls the last commit and compile, but we have a assertion when the compiler runs.
So we went to see why the compiler told us that by looking at the last sources of the sc4.c file, but we did not understand why the variable glb_declared kept the value 0.
Here is the command line and the infos to compile :
gmFile = "/home/test_server/gamemodes/roleplay.pwn" gmOutFile = "/home/test_server/gamemodes/roleplay.amx" gmIncludesFile = "/home/test_server/include"
Edit : I would point out that an almost virgin GM is perfectly compiled. We use the following includes (+ includes plugins) :