This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Optimization question
- From: Florian Weimer <fw at deneb dot enyo dot de>
- To: Nikolaus Dunn <nikdunn1979 at gmail dot com>
- Cc: gcc at gcc dot gnu dot org, gcc-help at gcc dot gnu dot org
- Date: Tue, 27 Sep 2016 17:20:25 +0200
- Subject: Re: Optimization question
- Authentication-results: sourceware.org; auth=none
- References: <c8204c33-7085-5dde-96f3-92d7745a0018@gmail.com>
- Reply-to: Nikolaus Dunn <nikdunn1979 at gmail dot com>, gcc-help at gcc dot gnu dot org
* Nikolaus Dunn:
> I've run into an issue where turning on compiler optimization using
> -O1 or higher causes an issue in my program. Specifically, I am
> replacing the new and delete operators globally to perform some real
> time allocation tracking. When I compile with -O1 or -O2, my
> implementation of new is not being called by STL classes, via the
> std::allocator. My version of delete IS being called.
This matter is appropriate for the gcc-help list, redirecting there.
> I realize I may be doing something wrong and I've read many posts from
> people saying not to replace new and delete, but I'm hacking on a 15
> year old baseline. We've just stepped up to GCC 5.3.0 and are
> compiling with the -std=c++14 option (to give a little context). I'm
> also compiling using MinGW, but I'm figuring MinGW would be using the
> same optimization logic at the compiler level as pure GCC.
It's unclear whether this is an optimization issue, or a different
build issue. We can't really comment on what's going wrong until you
have actual source code to show, I'm afraid.
Do you define your version of the global operators new and delete in
the same translation unit?