* Thijs Koerselman [2009-01-06 17:38]:
On Tue, Jan 6, 2009 at 9:46 AM, Bernhard Walle <bernhard.walle@gmx.de>wrote:
Sorry it DOES work. When i step over the last assignment to the end of the function block, XCode doesn't update the value of ret in the debugging window. It still displays 0xdeadbeaf, even though the value has changed. So it did return a value. I wonder if this is intended. I can't think of a good reason why XCode it would work like that.
That could be an optimisation. Do you compile with -O0 (or without any -O)?
I accidentally had it set to -Os, but changing it back to -O0 doesn't seem to make a difference in this case. You may be right about the optimization though, because if I put an extra dummy statement in like "ret = ret" it is also skipped by gdb.
Works here: kopernikus % cat boost.cc #include <iostream> #include <limits> #include <boost/math/special_functions/fpclassify.hpp> int main(int argc, char *argv[]) { float nan = std::numeric_limits<float>::quiet_NaN(); int ret = 0xdeadbeef; ret = (boost::math::isnan)(nan); return 0; } kopernikus % g++ -g -o boost boost.cc kopernikus % gdb ./boost GNU gdb 6.8 Copyright (C) 2008 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "i686-pc-linux-gnu"... (gdb) break 11 Breakpoint 1 at 0x8048651: file boost.cc, line 11. (gdb) r Starting program: /home/bwalle/boost Breakpoint 1, main () at boost.cc:11 11 return 0; (gdb) p ret $1 = 1 (gdb) quit The program is running. Exit anyway? (y or n) y Regards, Bernhard