[Bug c/69605] New: printf %f on integers

elmerido at yopmail dot com gcc-bugzilla@gcc.gnu.org
Mon Feb 1 20:40:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69605

            Bug ID: 69605
           Summary: printf %f on integers
           Product: gcc
           Version: 4.8.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: elmerido at yopmail dot com
  Target Milestone: ---

#include<stdio.h>
int main() {
        printf("a= %f \n",3.14);
        printf("b= %f \n",200);
        return 0;
}

returns :
a= 3.140000 
b= 3.140000 

Compilation gives warning but still generates the binary :
i.c: In function ‘main’:
i.c:6:2: warning: format ‘%f’ expects argument of type ‘double’, but argument 2
has type ‘int’ [-Wformat=]
  printf("b= %f \n",200);
  ^


More information about the Gcc-bugs mailing list