[all-commits] [llvm/llvm-project] 22e2db: [clang] Reject flexible array member in a union in...

Mariya Podchishchaeva via All-commits all-commits at lists.llvm.org
Wed May 3 05:59:12 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 22e2db6010b029ebd4c6d3d1fd30224d8b3109ef
      https://github.com/llvm/llvm-project/commit/22e2db6010b029ebd4c6d3d1fd30224d8b3109ef
  Author: Mariya Podchishchaeva <mariya.podchishchaeva at intel.com>
  Date:   2023-05-03 (Wed, 03 May 2023)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/Basic/DiagnosticGroups.td
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/lib/Sema/SemaDecl.cpp
    M clang/lib/Sema/SemaInit.cpp
    M clang/test/Layout/aix-power-alignment-typedef.cpp
    M clang/test/Sema/MicrosoftExtensions.c
    M clang/test/Sema/init.c
    M clang/test/SemaCXX/flexible-array-test.cpp
    M clang/test/SemaCXX/gnu-flags.cpp
    M clang/test/SemaObjCXX/flexible-array.mm

  Log Message:
  -----------
  [clang] Reject flexible array member in a union in C++

It was rejected in C, and in a strange way accepted in C++. However, the
support was never properly tested and fully implemented, so just reject
it in C++ mode as well.

This change also fixes crash on attempt to initialize union with flexible
array member. Due to missing check on union, there was a null expression
added to init list that caused crash later.

Fixes https://github.com/llvm/llvm-project/issues/61746

Reviewed By: aaron.ballman

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




More information about the All-commits mailing list