[Bug c/11783] New: type promotion for printf under gcc
achim dot gaedke at physik dot tu-darmstadt dot de
gcc-bugzilla@gcc.gnu.org
Sun Aug 3 13:25:00 GMT 2003
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11783
Summary: type promotion for printf under gcc
Product: gcc
Version: 3.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: achim dot gaedke at physik dot tu-darmstadt dot de
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
#include <stdio.h>
int main() {
double x=5.4;
size_t i=3;
printf("%.2f\n",-i+x);
return 0;
}
compiled with: /opt/gcc-3.3/bin/gcc test_printf.cc -o test_printf
does result 4294967298.40
Swapping the order of i and x, the expected result is returned.
#include <stdio.h>
int main() {
double x=5.4;
size_t i=3;
printf("%.2f\n",x-i);
return 0;
}
Output: 2.40
My system: Redhat 8.0 with glibc-2.3.2-4.80.6, fully patched
The compiler is built without extra options.
More information about the Gcc-bugs
mailing list