[all-commits] [llvm/llvm-project] fa459d: [flang] Rewrite "1*j" to "(j)", not "j", when j is...

Peter Klausler via All-commits all-commits at lists.llvm.org
Thu Jun 22 07:23:55 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: fa459d988276bb88ab577dd7a38b42a85ac8db94
      https://github.com/llvm/llvm-project/commit/fa459d988276bb88ab577dd7a38b42a85ac8db94
  Author: Peter Klausler <pklausler at nvidia.com>
  Date:   2023-06-22 (Thu, 22 Jun 2023)

  Changed paths:
    M flang/lib/Evaluate/fold-implementation.h
    A flang/test/Evaluate/rewrite04.f90

  Log Message:
  -----------
  [flang] Rewrite "1*j" to "(j)", not "j", when j is a variable

Expression folding currently unconditionally rewrites "1*j"
to "j", which is wrong when "j" is a variable, as it transforms
an expression into a variable and can lead to incorrect associations
in contexts like an actual argument or an ASSOCIATE selector.
Transform "1*j" to a parenthesized "(j)" when "j" is a variable.
Fixes LLVM bug https://github.com/llvm/llvm-project/issues/63259.

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




More information about the All-commits mailing list