[all-commits] [llvm/llvm-project] 283e0a: [clang] Correct sanitizer behavior in union FAMs

Bill Wendling via All-commits all-commits at lists.llvm.org
Thu Oct 20 16:08:33 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 283e0a81ef35deec46aa231cb8b9d826060f532a
      https://github.com/llvm/llvm-project/commit/283e0a81ef35deec46aa231cb8b9d826060f532a
  Author: Bill Wendling <morbo at google.com>
  Date:   2022-10-20 (Thu, 20 Oct 2022)

  Changed paths:
    M clang/lib/AST/Expr.cpp
    M clang/test/CodeGen/bounds-checking-fam.c
    M clang/test/CodeGen/bounds-checking.c
    M clang/test/Sema/array-bounds-ptr-arith.c

  Log Message:
  -----------
  [clang] Correct sanitizer behavior in union FAMs

Clang doesn't have the same behavior as GCC does with union flexible
array members. (Technically, union FAMs are probably not acceptable in
C99 and are an extension of GCC and Clang.)

Both Clang and GCC treat *all* arrays at the end of a structure as FAMs.
GCC does the same with unions. Clang does it for some arrays in unions
(incomplete, '0', and '1'), but not for all. Instead of having this
half-supported feature, sync Clang's behavior with GCC's.

Reviewed By: kees

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




More information about the All-commits mailing list