You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[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 53f7542)
unsignedshift=323U; // expected-note{{'shift' initialized to 323}}
13
+
switch (i) { // expected-note{{Control jumps to 'case 8:' at line 14}}
14
+
case offsetof(S, guest_fpc):
15
+
return3 << shift; // expected-warning{{The result of the left shift is undefined due to shifting by '323', which is greater or equal to the width of type 'int'}}
16
+
// expected-note@-1{{The result of the left shift is undefined due to shifting by '323', which is greater or equal to the width of type 'int'}}
0 commit comments