Bugfix: 32-bit vs 64-bit bug in x86_64-gen.c:gcall_or_jmp
commitaacf65bbfa1dad801428c1978cebb45400a2bd93
authorPhilip <pipcet@gmail.com>
Thu, 23 Apr 2015 17:30:16 +0000 (23 17:30 +0000)
committerPhilip <pipcet@gmail.com>
Thu, 23 Apr 2015 17:30:16 +0000 (23 17:30 +0000)
tree81305a29fa40dc4a2d42447fad6fcfa8d4bb9bbe
parentb08ce880822875d4bef103719179501d6ba38730
Bugfix: 32-bit vs 64-bit bug in x86_64-gen.c:gcall_or_jmp

Verify an immediate value fits into 32 bits before jumping to it/calling
it with a 32-bit immediate operand. Without this fix, code along the
lines of

  ((int (*)(const char *, ...))140244834372944LL)("hi\n");

will fail mysteriously, even if that decimal constant is the correct
address for printf.

See https://github.com/pipcet/tinycc/tree/bugfix-1
x86_64-gen.c