https://llvm.org/bugs/show_bug.cgi?id=30533
Bug ID: 30533 Summary: -Wformat check is not correct when using bitfield parameters Product: clang Version: unspecified Hardware: PC OS: Linux Status: NEW Severity: normal Priority: P Component: Frontend Assignee: unassignedclangb...@nondot.org Reporter: arichardson....@gmail.com CC: llvm-bugs@lists.llvm.org Classification: Unclassified I noticed that one of my printfs was outputting garbage values even though I compile with -Werror=format. Abbreviated example: struct foo { uint64_t a : 10; uint64_t b : 12; uint64_t c : 10 }; foo f; f.b = 0xab; printf("Foo.b: %llx", f.b); This usually gave me random garbage like Foo.b:7fa0000000ab (always with the correct value at the end). It seems to me that the f.b is being passed as a 32 bit int on the stack but because it is declared as a uint64_t bitfield the -Wformat check assumes that %llx is okay. clang --version clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final) Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/bin -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs