From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 97790 invoked by alias); 27 Sep 2016 15:20:34 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 97768 invoked by uid 89); 27 Sep 2016 15:20:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_05,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=H*R:D*gcc.gnu.org, H*R:D*gnu.org, baseline, mingw X-Spam-User: qpsmtpd, 2 recipients X-HELO: albireo.enyo.de Received: from albireo.enyo.de (HELO albireo.enyo.de) (5.158.152.32) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 27 Sep 2016 15:20:31 +0000 Received: from [172.17.203.2] (helo=deneb.enyo.de) by albireo.enyo.de with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) id 1bouBF-0006hz-EU; Tue, 27 Sep 2016 17:20:25 +0200 Received: from fw by deneb.enyo.de with local (Exim 4.84_2) (envelope-from ) id 1bouBF-0002Om-Av; Tue, 27 Sep 2016 17:20:25 +0200 From: Florian Weimer To: Nikolaus Dunn Cc: gcc@gcc.gnu.org, gcc-help@gcc.gnu.org Subject: Re: Optimization question References: Reply-To: Nikolaus Dunn , gcc-help@gcc.gnu.org Date: Tue, 27 Sep 2016 15:20:00 -0000 In-Reply-To: (Nikolaus Dunn's message of "Tue, 27 Sep 2016 11:01:49 -0400") Message-ID: <87zimt5pza.fsf@mid.deneb.enyo.de> MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2016-09/txt/msg00104.txt.bz2 * 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?