[all-commits] [llvm/llvm-project] 3c84e4: [C11] Improve the diagnostic when accessing a memb...

Aaron Ballman via All-commits all-commits at lists.llvm.org
Tue Mar 29 09:16:22 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3c84e4a0dbd08fc03bbcdd8354a984e0efcf7672
      https://github.com/llvm/llvm-project/commit/3c84e4a0dbd08fc03bbcdd8354a984e0efcf7672
  Author: Aaron Ballman <aaron at aaronballman.com>
  Date:   2022-03-29 (Tue, 29 Mar 2022)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/lib/Sema/SemaExprMember.cpp
    M clang/test/Sema/atomic-expr.c

  Log Message:
  -----------
  [C11] Improve the diagnostic when accessing a member of an atomic struct

Member access for an atomic structure or union is unconditional
undefined behavior (C11 6.5.2.3p5). However, we would issue a confusing
error message about the base expression not being a structure or union
type.

GCC issues a warning for this case. Clang now warns as well, but the
warning is defaulted to an error because the actual access is still
unsafe.

This fixes Issue 54563.




More information about the All-commits mailing list