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

"Standard library" function calls cause program to crash #48

Open
ghost opened this issue Apr 28, 2020 · 2 comments
Open

"Standard library" function calls cause program to crash #48

ghost opened this issue Apr 28, 2020 · 2 comments
Assignees
Labels

Comments

@ghost
Copy link

ghost commented Apr 28, 2020

I am getting a segmentation fault on 64-bit Linux Mint on this file:

#include <console>

main()
{
  printf("hello\n");
}

Compile string is pawncc -C:64 hello.p, pawncc is compiled with -DHAVE_I64 -DPAWN_CELL_SIZE=64, pawnrun is compiled with AMX_ALTCORE (GNU extensions). This segfault traces back into amx_Exec->amx_exec_run->first NEXT instruction, it executes 7 times then crashes. Corresponding macro expansion is
#define NEXT(cip,op) goto *amx_opcodelist[(op=*cip++) & ((1 << sizeof(cell)*4)-1)]
My knowledge of underlying procedures ends here.

When compiling without AMX_ALTCORE, the same behaviour occurs: execution reaches the main for ( ;; ) loop, does 7 iterations and crashes successfully.

If I substitute printf with print in pawn code, it crashes after 13 iterations.

It seems that the segfault occurs with every native function that *.inc files in pawn toolkit provide (even with clamp; some other functions cause just run-time errors).

This problem arises in 32-bit pawn codes too, so I moved this post out of 64-bit thread into a new one.

@ghost
Copy link
Author

ghost commented Apr 28, 2020

Previous available version 3.3.4288 has no such problems in its implementation; only master branch and latest stable versions are affected.

@compuphase compuphase self-assigned this Apr 30, 2020
@compuphase compuphase added the bug label Apr 30, 2020
@compuphase
Copy link
Owner

For 32-bit cells, commit 37cee7c has a number of bug-fixes. However AMX_ALTCORE requires that the cell size is the same as the native pointer size. So this is a fix to a laterally related problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant