This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/11307] Random printf values under different optimization levels.
- From: "bangerth at dealii dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 Jun 2003 16:23:47 -0000
- Subject: [Bug c/11307] Random printf values under different optimization levels.
- References: <20030624144643.11307.paudley@compbio.dundee.ac.uk>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11307
------- Additional Comments From bangerth at dealii dot org 2003-06-24 16:23 -------
Why do people not learn to include the proper function declarations?
Including stdio.h and running gcc with -W -Wall would have said
tmp/gg> gcc -c x.c -W -Wall
x.c:2: warning: return type defaults to `int'
x.c: In function `main':
x.c:7: warning: double format, different type arg (arg 2)
x.c:8: warning: double format, different type arg (arg 3)
x.c:9: warning: control reaches end of non-void function
Which is not surprising given this call
printf( "n, s: %f, %f\n", n, s );
with n being an integer. Everything that comes after that is at an
unexpected position on the stack and will be wrong, of course.
W.