This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/64504] Invalid free() with _GLIBCXX_DEBUG and -fwhole-program
- From: "andrey.vihrov at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 06 Jan 2015 14:08:42 +0000
- Subject: [Bug libstdc++/64504] Invalid free() with _GLIBCXX_DEBUG and -fwhole-program
- Auto-submitted: auto-generated
- References: <bug-64504-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64504
--- Comment #2 from Andrey Vihrov <andrey.vihrov at gmail dot com> ---
Thanks for a fast reply!
My use case for these two (amongst several others) options together is
competitive programming, in which a contestant is required a write a
one-source-file solution, test it locally and submit it to a grading server.
Debug Mode helps detect mistakes, and -fwhole-program helps find variables or
functions that I defined and intended to use, but forgot to. For example, for
this source:
int unused;
int main()
{
}
"g++ -Wall -fwhole-program x.cpp" gives
x.cpp:1:5: warning: 'unused' defined but not used [-Wunused-variable]
, and there is no warning without -fwhole-program. Of course, I can get the
same effect by making everything "static", but this depends on me remembering
to do it, so this option is better in this regard. -flto doesn't have the same
effect.
If -fwhole-program isn't supported in this case, then it's fair enough. But
then it would be great if the documentation on -fwhole-program was updated to
clarify when the option can be used and when not.