[all-commits] [llvm/llvm-project] 83dca1: [flang] Fix a crash when a BOZ literal is used as ...

Pete Steinfeld via All-commits all-commits at lists.llvm.org
Thu Jul 23 09:14:55 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 83dca19c11236700d26ebd1ecff65e01876c1e9d
      https://github.com/llvm/llvm-project/commit/83dca19c11236700d26ebd1ecff65e01876c1e9d
  Author: Pete Steinfeld <psteinfeld at nvidia.com>
  Date:   2020-07-23 (Thu, 23 Jul 2020)

  Changed paths:
    M flang/lib/Semantics/expression.cpp
    M flang/test/Semantics/resolve63.f90

  Log Message:
  -----------
  [flang] Fix a crash when a BOZ literal is used as a relational operator

Summary:
Expressions like `iVar==z'fe'` were causing an assertion error  because
the `Relate()` function in `Evaluate/tools.cpp` that processes
relational operators didn't deal with BOZ literals, which are typeless.
I fixed this by checking to see if the operands are BOZ literals.  If
so, if the other operand is REAL, I convert them to REAL.  Otherwise, I convert
them to integers with default kind.

I also added a test to resolve63.f90 that triggers the problem.

Reviewers: tskeith, DavidTruby

Subscribers: llvm-commits

Tags: #llvm

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




More information about the All-commits mailing list