This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/11307] Random printf values under different optimization levels.


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]