manuel-serrano / bigloo

a practical Scheme compiler
http://www-sop.inria.fr/indes/fp/Bigloo
Other
135 stars 19 forks source link

LTO and trap instructions #49

Closed jamesjer closed 3 years ago

jamesjer commented 3 years ago

The Fedora project is building all packages with link-time optimization (LTO) starting with Fedora 33. This turned up a problem that affects at least the ppc64le and aarch64 architectures. With LTO information, GCC is so clever that it can figure out that some of the tests in test-error (recette/error.scm) divide by zero. It then cleverly replaces each such division with a TRAP instruction. When the TRAP instruction is executed, bigloo receives SIGTRAP and dies.

I'm not certain of the best solution to this problem. For now, I have added this to runtime/Llib/error.scm:

(signal sigtrap sigfpe-error-handler)

with appropriate macro and field definitions of SIGTRAP above. That "works", in the sense that the tests pass. Does that seem like a reasonable way to handle the issue? If so, I can submit a pull request.

manuel-serrano commented 3 years ago

Hi Jerry,

Your proposal seems fine to me. I have included your suggestion directly in Llib/error.scm. No need for you then to create a pull request.

Thanks a lot for the suggestion.