[all-commits] [llvm/llvm-project] 2162a1: [clang][CodeGen] Check initializer of zero-size fi...

Michael Buch via All-commits all-commits at lists.llvm.org
Fri Sep 20 11:43:03 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2162a18fb206736c41c9182737b72ae15d5e6bf0
      https://github.com/llvm/llvm-project/commit/2162a18fb206736c41c9182737b72ae15d5e6bf0
  Author: Michael Buch <michaelbuch12 at gmail.com>
  Date:   2024-09-20 (Fri, 20 Sep 2024)

  Changed paths:
    M clang/lib/CodeGen/CGExprConstant.cpp
    M clang/test/CodeGen/union-init2.c

  Log Message:
  -----------
  [clang][CodeGen] Check initializer of zero-size fields for nullptr (#109271)

In https://github.com/llvm/llvm-project/pull/96422 we started treating
empty records as zero-sized for the purpose of layout. In `C`, empty
fields were never considered `isZeroSize`, so we would never have tried
to call `Init->hasSideEffects` on them. But since
https://github.com/llvm/llvm-project/pull/96422 we can get here when
compiling `C`, but `Init` need not exist. This patch adds a null-check
to account for this situtation.



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