mpn/t_get_d test failure with '-O3 -ffast-math'

Vasili Burdo vasili.burdo at gmail.com
Sun Jul 13 14:09:50 CEST 2025


Thanks, Mark.
I agree w/ your opinion.
I ran into this problem when tried to include gmplib into CI chain and used
inherited compile options.

To me, it could be useful to at least warn about it or, just add "#error"
to mpn_get_d() an similar places, so build will fail with clear explanation.
This will save quite a bit of time in situations like mine.

Thanks.
Vasili

вс, 13 июл. 2025 г., 14:58 Marc Glisse <marc.glisse at inria.fr>:

> Hello,
>
> thanks for the report.
>
> On Fri, 11 Jul 2025, Vasili Burdo wrote:
>
> > mpn_get_d wrong, didn't get infinity
>
> -ffast-math implies -ffinite-math-only, so of course anything dealing with
> infinities is likely to break.
>
> > - disallow gmplib building w/ -ffast-math.
>
> That's the default for any software that does not explicitly document that
> they support -ffast-math (with a specific version of a specific compiler).
> -ffast-math means that floating point operations are allowed to produce
> arbitrary nonsense and makes the compiler non-conforming.
>
> > - workaround mpn_gmp_d() somehow in case of aggressive FP optimizations.
>
> That might be possible, but it does not seem worth the trouble.
>
> --
> Marc Glisse
>


More information about the gmp-bugs mailing list