https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105548

            Bug ID: 105548
           Summary: -frounding-math description contains an misleading
                    sentence
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vincent-gcc at vinc17 dot net
  Target Milestone: ---

https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html has

  -frounding-math
    Disable transformations and optimizations that assume default
floating-point
    rounding behavior. This is round-to-zero for all floating point to integer
    conversions, and round-to-nearest for all other arithmetic truncations.
This
    option should be specified for programs that change the FP rounding mode
    dynamically, or that may be executed with a non-default rounding mode. This
    option disables constant folding of floating-point expressions at compile
    time (which may be affected by rounding mode) and arithmetic
transformations
    that are unsafe in the presence of sign-dependent rounding modes.

However, the sentence "This is round-to-zero for all floating point to integer
conversions, and round-to-nearest for all other arithmetic truncations." is
misleading, because even code with no rounding in the source code may be
affected (e.g. PR102498, due to code generated by GCC to load particular
floating-point constants). This sentence doesn't bring anything useful and
should be removed (in short, if some part of the code runs in non-default
rounding mode, then -frounding-math should be used, whatever the operations
involved in the source code). Note also that "round-to-zero for all floating
point to integer conversions" probably doesn't concern the user (or are there
languages with dynamic FP-to-integer rounding modes?).

Possibly add "(round-to-nearest)" at the end of the first sentence.

Reply via email to