On arm64, if you run under GDB and look at the address that faulted it's
clear that the address has been truncated to 32 bits. And there's some
obvious code in src/gen.h that looks as if it's truncating addresses
to 32 bits on any architecture that isn't x86_64. However, I don't
think gen.h is the only problem. I'd recommend grepping all the code
for __x86_64__ to see if there are other places where it's assumed
that all other architectures are 32-bit.

In src/gen.h you could just use something like (_ptr & (uintptr_t)-4):
no need for the preprocessor. Even if you do have to use the
preprocessor I'd advise against listing all the 64-bit architectures
you can think of. You could use UINTPTR_MAX from <stdlint.h>, for
example.

It's encouraging that a statically linked icas was reported to have
worked on arm64:
http://xcas.e.ujf-grenoble.fr/XCAS/viewtopic.php?f=4&t=1785

That suggests that pointer truncation is perhaps the only problem (and
the pointers happen to be 32-bit with static linking on that system).
So perhaps quite a small patch would make this package work on other
64-bit architectures.

Reply via email to