Print this page
new smatch

Split Close
Expand all
Collapse all
          --- old/usr/src/tools/smatch/src/validation/constexpr-offsetof.c
          +++ new/usr/src/tools/smatch/src/validation/constexpr-offsetof.c
↓ open down ↓ 5 lines elided ↑ open up ↑
   6    6  extern int c;
   7    7  
   8    8  static int o[] = {
   9    9          [__builtin_offsetof(struct A, b)] = 0,          // OK
  10   10          [__builtin_offsetof(struct A, a[0])] = 0,       // OK
  11   11          [__builtin_offsetof(struct A, a[0*0])] = 0,     // OK
  12   12          [__builtin_offsetof(struct A, a[c])] = 0        // KO
  13   13  };
  14   14  
  15   15  /*
  16      - * check-name: __builtin_offsetof() constness verification.
       16 + * check-name: constexprness __builtin_offsetof()
  17   17   *
  18   18   * check-error-start
  19   19  constexpr-offsetof.c:12:39: error: bad constant expression
  20   20   * check-error-end
  21   21   */
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX