Why is this happening to my software? An illegal instruction error.

Basile B. b2.temp at gmx.com
Thu Jun 20 11:20:07 UTC 2024


On Tuesday, 18 June 2024 at 23:07:47 UTC, Murilo wrote:
> I've created a software which performs the Fermat's Primality 
> Test, however if I input a very big number it causes an error 
> saying "Illegal instruction (core dumped)". Does anyone know 
> why?
>
> I've used GDB and here is the message:
> Program received signal SIGILL, Illegal instruction.
> 0x00005555555e40b0 in 
> _D3std8internal4math11biguintcore7BigUint3powFNaNbNfNkMSQCcQCbQBvQBtQBjmZQs ()
>
> Here is the link to the source code: 
> https://github.com/MuriloMir/Fermat-primality-test

That has to be an assertion failure happening at runtime. IIRC 
the `ud2` instruction (causing SIGILL) is used in -betterC mode. 
If you look at biguintcore.d you'll see a couple of them, e.g 
https://github.com/dlang/phobos/blob/master/std/internal/math/biguintcore.d#L1042.


More information about the Digitalmars-d-learn mailing list