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

Ding Fei via All-commits all-commits at lists.llvm.org
Mon Mar 6 23:44:58 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 53f75425b3fec73d7a78e85e2b982741c9aa81f0
      https://github.com/llvm/llvm-project/commit/53f75425b3fec73d7a78e85e2b982741c9aa81f0
  Author: danix800 <danix800 at gmail.com>
  Date:   2023-03-07 (Tue, 07 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




More information about the All-commits mailing list