llvm / llvm/llvm-project

-fno-finite-math-only leaves __FINITE_MATH_ONLY__ defined

Open
#224,637 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

clang:driver
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

Minimal reproducible example:

int main()
{
  #ifdef __FINITE_MATH_ONLY__
    #error __FINITE_MATH_ONLY__ defined
  #endif
  return 0;
}

Command line:
\installed\LLVM-23.1.0-win64\bin\clang++ -ffast-math -fno-finite-math-only bug.cpp

Output:

bug.cpp:4:6: error: __FINITE_MATH_ONLY__ defined
    4 |     #error __FINITE_MATH_ONLY__ defined
      |      ^
1 error generated.

Expected output:
No error.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the minimal reproducer in bug.cpp and run the reported clang++ command using -ffast-math and -fno-finite-math-only. Trace how these options define FINITE_MATH_ONLY; done means the macro is not defined and the reproducer compiles without an error.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.