Issue 76084
Summary unexpected warnings with builtin_dump_struct
Labels new issue
Assignees
Reporter BaoshanPang
    ```
$ cat ~/tmp/t.c
int printf (const char *restrict, ...)
               __attribute__ ((__format__ (__printf__, 1, 2)));

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;

  __builtin_dump_struct(&lludump, printf);
  return 0;
}

$ /home/bpang/mywork/llvm_github/llvm-project/build/bin/clang -c ~/tmp/t.c
/home/bpang/tmp/t.c:19:25: warning: format specifies type 'unsigned long long' but the argument has type 'int' [-Wformat]
   19 | __builtin_dump_struct(&lludump, printf);
      | ^
/home/bpang/tmp/t.c:19:3: note: in call to printing function with arguments '("%s%s %s : %zu = %llu\n", "  ", "u64", "a", 4U, (&lludump)->a)' while dumping struct
   19 | __builtin_dump_struct(&lludump, printf);
      | ^
/home/bpang/tmp/t.c:19:25: warning: format specifies type 'unsigned long long' but the argument has type 'int' [-Wformat]
   19 | __builtin_dump_struct(&lludump, printf);
      | ^
/home/bpang/tmp/t.c:19:3: note: in call to printing function with arguments '("%s%s %s : %zu = %llu\n", "  ", "u64", "c", 4U, (&lludump)->c)' while dumping struct
   19 | __builtin_dump_struct(&lludump, printf);
      |   ^
2 warnings generated.

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

Reply via email to