Skip to content

test: Avoid -ffinite-math-only on floating point comparisons - #1373

Open
iv-m wants to merge 2 commits into
simd-everywhere:masterfrom
iv-m:tests-no-finite-math-only
Open

test: Avoid -ffinite-math-only on floating point comparisons#1373
iv-m wants to merge 2 commits into
simd-everywhere:masterfrom
iv-m:tests-no-finite-math-only

Conversation

@iv-m

@iv-m iv-m commented Jan 21, 2026

Copy link
Copy Markdown
Contributor

With -ffinite-math-only (implied by -ffast-math and -Ofast), GCC considers all comparisons against infinities to be false and can optimize them away. This breaks several tests that rely on infinities to be compared correctly. To avoid this, we add GCC-specific optimize attribute that disables -ffinite-math-only optimization for floating point comarisions used in assertions.

@mr-c
mr-c force-pushed the tests-no-finite-math-only branch from 30e03ea to cea5dd8 Compare January 22, 2026 14:46
iv-m and others added 2 commits August 7, 2026 16:43
With `-ffinite-math-only` (implied by `-ffast-math` and -Ofast),
GCC considers all comparisons against infinities to be false
and can optimize them away. This breaks several tests that rely
on infinities to be compared correctly. To avoid this, we add
GCC-specific optimize attribute that disables `-ffinite-math-only`
optimization for floating point comarisions used in assertions.

Signed-off-by: Ivan A. Melnikov <iv@altlinux.org>
From the GCC manual page:

> Disregard strict standards compliance. -Ofast enables all -O3 optimizations.
> It also enables optimizations that are not valid for all standard-compliant
> programs. It turns on -ffast-math, -fallow-store-data-races.
> It turns off -fsemantic-interposition.

On recent clang, use "-O3 -ffast-math" due to
> error: argument '-Ofast' is deprecated; use '-O3 -ffast-math' for the same
> behavior, or '-O3' to enable only conforming optimizations
> [-Werror,-Wdeprecated-ofast]
@mr-c
mr-c force-pushed the tests-no-finite-math-only branch from cea5dd8 to 7afd6ea Compare August 9, 2026 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants