Consider this program: -------------- a.c -------------------- #include <stdio.h>
int main() { int a = 10; printf("%d\n", a); printf("%0.4d\n", a); return 0; } --------------------------------------- By compiling with: gcc -Wall a.c This warning gets displayed: a.c:7: warning: '0' flag ignored with precision and %d printf format The '0' flag isn't actually ignored, and it shouldn't be anyway, so I think the warning is incorrect. ============================== More details: I found this on 4.2.1, but I also tried it on 4.1.0 and 4.3.1, and the result is the same. Both gcc and g++ show the warning (initially I found this in a C++ project and then I checked to see if C code exhibits the same issue). -- Summary: Incorrect warning "flag ignored with precision" in printf Product: gcc Version: 4.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: ciobi at inbox dot com GCC build triplet: x86_64-suse-linux GCC host triplet: x86_64-suse-linux GCC target triplet: x86_64-suse-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37648