Hi,
I noticed that "./configure --enable-debug" will set "-O2" to CFLAGS. To better debug/trace the code, I have to manually change "-O2" to "-O0" in src/Makefile.global.
In the script "configure" line 5254 through 5259, I see this comment:
# C[XX]FLAGS are selected so:
# If the user specifies something in the environment, that is used.
# else: If the template file set something, that is used.
# else: If coverage was enabled, don't set anything.
# else: If the compiler is GCC, then we use -O2.
# else: If the compiler is something else, then we use -O, unless debugging.
The last line, "unless debugging", my first impression is that should apply to GCC. However, the following code shows the GCC always use "-O2".
elif test "$GCC" = yes; then
CFLAGS="-O2"
else
# if the user selected debug mode, don't use -O
if test "$enable_debug" != yes; then
CFLAGS="-O"
fi
fi
For GCC, we need to use "-O0" for best debugging experience. Why here always uses "-O2" for GCC regardless debugging?
If confirmed a bug, I'd like a submit a patch to fix that.
Thanks,
Chao Li (Evan)
============
HighGo Inc.