[all-commits] [llvm/llvm-project] e91a4b: [flang][hlfir] Fix c_null_ptr lowering in structur...

jeanPerier via All-commits all-commits at lists.llvm.org
Fri Oct 6 00:20:27 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e91a4bec0b3dd5d7c5d745fe1c7791fdc008e07a
      https://github.com/llvm/llvm-project/commit/e91a4bec0b3dd5d7c5d745fe1c7791fdc008e07a
  Author: jeanPerier <jperier at nvidia.com>
  Date:   2023-10-06 (Fri, 06 Oct 2023)

  Changed paths:
    M flang/lib/Lower/ConvertConstant.cpp
    A flang/test/HLFIR/c-null-ptr-init.f90

  Log Message:
  -----------
  [flang][hlfir] Fix c_null_ptr lowering in structure constructors (#68321)

Lowering handles C_PTR initial values that are designators or NULL()
inside structure constructors as an extension to support. This extension
is used by initial values generated for runtime derived type info.

But c_null_ptr wrongly fell into this extension path with HLFIR, causing
the initial value to be set to some (non null) address containing
c_null_ptr instead of c_null_ptr itself...

This was caused by the FIR lowering relying on genExtAddrInInitializer
to not place c_null_ptr inside an address. Fix this by only falling
through into the extension handling code if this is an extension: i.e,
the expression is some designated symbol or NULL().




More information about the All-commits mailing list