[all-commits] [llvm/llvm-project] 874ef0: [Flang] Fix crash in structure constructor lowerin...

jay0x via All-commits all-commits at lists.llvm.org
Sun Mar 8 22:23:44 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 874ef0073aba2498516b06c8f2ec91a14e4d4336
      https://github.com/llvm/llvm-project/commit/874ef0073aba2498516b06c8f2ec91a14e4d4336
  Author: jay0x <90309873+blazie2004 at users.noreply.github.com>
  Date:   2026-03-09 (Mon, 09 Mar 2026)

  Changed paths:
    M flang/lib/Lower/ConvertConstant.cpp
    A flang/test/Lower/pdt-struct-constructor-init.f90

  Log Message:
  -----------
  [Flang] Fix crash in structure constructor lowering for PDT (#183543)

Fixes - [#181278](https://github.com/llvm/llvm-project/issues/181278)
This patch fixes a crash in Flang when parsing array constructors like:
 

`[ty0(2)(4)]`
 
The current implementation parses this as a type constructor ty0(2),
followed by what appears to be another call (4), instead of rejecting it
as invalid syntax. The lowering of` StructureConstructor` attempts to
retrieve the parent derived type using `sym->owner().derivedTypeSpec()`,
which return `nullptr` for PDT cases and lead to a crash.
 
In` flang/lib/Lower/ConvertConstant.cpp`, a safeguard is being added
which ensures that we fall back to the constructor’s derived type
specification when the parent type cannot be obtained, preventing the
null dereference and eliminating the crash. This change addresses only
the immediate crash, proper diagnostic handling for this invalid syntax
is still pending and remains as TODO.

---------

Co-authored-by: Jay Satish Kumar Patel <kumarpat at pe31.hpc.amslabs.hpecorp.net>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list