Skip to content

Bad floating-point "optimizations" #43070

Closed
@tydeman

Description

@tydeman
Bugzilla Link 43725
Version 8.0
OS Linux
CC @DougGregor,@zygoloid

Extended Description

Is there a way to disable ALL "optimizations" related to floating-point?
My testing has shown that clang does the following:

  1. * x  => x
  0. * x  => 0.
  x / 1.  => x
  x / x   => 1.
  0. / x  => 0.
  x + 0.  => x
  x - 0.  => x
  x - x   => 0.

They are all invalid "optimizations" if x is a signaling NaN.
In addition, some are invalid if x is a signed zero or infinity.
In the above, 'x' can be either a variable or a constant.
It might matter if 'x' is float, double, or long double.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions