[all-commits] [llvm/llvm-project] 68efe6: [flang] Fix ICE for sqrt(0.0) evaluation

FruitClover via All-commits all-commits at lists.llvm.org
Thu Apr 14 02:53:59 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 68efe6356551237e967c23c1bf5fd01dc4a2fc90
  Author: Mike Kashkarov <fruitclover at gmail.com>
  Date:   2022-04-14 (Thu, 14 Apr 2022)

  Changed paths:
    M flang/include/flang/Evaluate/real.h
    M flang/lib/Evaluate/real.cpp
    M flang/test/Evaluate/folding28.f90

  Log Message:
  [flang] Fix ICE for sqrt(0.0) evaluation

    During real range reduction to [0.5, 4) with

           SQRT(2**(2a) * x) = SQRT(2**(2a)) * SQRT(x) = 2**a * SQRT(x)

    we fall into inf. recursion if IsZero() == true.

    Explicitly handle SQRT(0.0) instead of additional checks during folding. Also
    add helpers for +0.0/-0.0 generation to clean up a bit.

Reviewed By: klausler

Differential Revision: https://reviews.llvm.org/D123131

More information about the All-commits mailing list