Issue 75984
Summary unexpected warning from clang
Labels clang
Assignees
Reporter BaoshanPang
    Can someone tell me why clang report a warning here? isn't lludump.a a type of "unsigned long long"? Thanks.

#include <stdio.h>

typedef unsigned char u8;
typedef unsigned char u08;
typedef unsigned short u16;
typedef unsigned int u32;
typedef unsigned long long u64;

struct llu_dump_test {
  u64 a : 4;
  u64 b : 56;
  u64 c : 4;
};

int main() {
  struct llu_dump_test lludump;

 printf("%llu\n", lludump.a);

  return 0;
}
bpang@US-BPANG:~$ clang -c e.c
e.c:18:20: warning: format specifies type 'unsigned long long' but the argument has type 'int' [-Wformat]
  printf("%llu\n", lludump.a);
          ~~~~     ^~~~~~~~~
          %d
1 warning generated.

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to