[all-commits] [llvm/llvm-project] 7fd255: [analyzer] Explicit cast on customized offsetof sh...

Ding Fei via All-commits all-commits at lists.llvm.org
Thu Mar 9 06:56:56 PST 2023


  Branch: refs/heads/release/16.x
  Home:   https://github.com/llvm/llvm-project
  Commit: 7fd255fe6e3551c06e9d233517576e95c9a912fe
      https://github.com/llvm/llvm-project/commit/7fd255fe6e3551c06e9d233517576e95c9a912fe
  Author: danix800 <danix800 at gmail.com>
  Date:   2023-03-09 (Thu, 09 Mar 2023)

  Changed paths:
    M clang/lib/StaticAnalyzer/Core/BugReporter.cpp
    A clang/test/Analysis/bitwise-ops-nocrash.c

  Log Message:
  -----------
  [analyzer] Explicit cast on customized offsetof should not be ignored when evaluating as const

If ignored, the subexpr is a UnaryOperator (&) which cannot be evaluated
(assertion failed).

  #define offsetof(type,memb) ((unsigned long)&((type*)0)->memb)

Patch By danix800!

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

(cherry picked from commit 53f75425b3fec73d7a78e85e2b982741c9aa81f0)




More information about the All-commits mailing list