[llvm-bugs] [Bug 50222] New: Default fp-contract behavior does not match documentation

via llvm-bugs llvm-bugs at lists.llvm.org
Tue May 4 15:00:57 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=50222

            Bug ID: 50222
           Summary: Default fp-contract behavior does not match
                    documentation
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Driver
          Assignee: unassignedclangbugs at nondot.org
          Reporter: andrew.kaylor at intel.com
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

According to the clang documentation for '-ffp-contract'
(https://clang.llvm.org/docs/UsersManual.html#cmdoption-ffp-contract), the
fp-contract state defaults to 'on' for languages other than CUDA/HIP . 

The documentation for '-ffp-model'
(https://clang.llvm.org/docs/UsersManual.html#cmdoption-ffp-model) says that
'-ffp-model=precise' implicitly enables '-ffp-contract=fast' and that 'precise'
is the default.

It appears that the current behavior (at least for C input with an x86-64
target) is equivalent to -fp-contract=off when the '-ffp-model' option isn't
used.

https://godbolt.org/z/7YM75hK9e

Obviously, the documentation for the default settings for fp-contract and
fp-model are contradictory. I think the default described in the fp-contract
documentation is correct and that setting should be used by -ffp-model=precise.
Apart from the fp-contract setting, the default state is equivalent to
fp-model=precise.

So, three things should happen:

1) Fix whatever it is that's causing clang to default to fp-contract=off.
2) The clang toolchain code that handles -ffp-model should be changed to use
fp-contract=on instead of fp-contract=fast for the precise model.
3) Update the fp-model documentation.


FWIW, there was at one time a problem with one of the backends that was exposed
if fp-contract was enabled at -O0. That may be why the default behavior isn't
as documented.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210504/51676241/attachment-0001.html>


More information about the llvm-bugs mailing list