From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8235 invoked by alias); 1 Jul 2010 16:52:19 -0000 Received: (qmail 8189 invoked by uid 48); 1 Jul 2010 16:52:05 -0000 Date: Thu, 01 Jul 2010 16:52:00 -0000 Message-ID: <20100701165205.8188.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug tree-optimization/44736] Overeager -O1 optimization results in incorrect code generation In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "opensource3141 at gmail dot com" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-07/txt/msg00095.txt.bz2 ------- Comment #4 from opensource3141 at gmail dot com 2010-07-01 16:52 ------- (In reply to comment #3) > We are going to ask developers to use -fno-builtin-malloc for now. I also > think this is a glibc bug which should mark the hook variables volatile. I tested using the volatile keyword inside the glibc header malloc.h, and that also serves as a workaround. However, I believe the meaning of volatile is something a bit different, and using the qualifier would prevent GCC from optimizing accesses to the hook variables independent of calls to malloc. The fundamental issue seems to be that there is a mismatch between how malloc behaves and how GCC thinks it behaves. It sounds like the best way to resolve that mismatch is to use -fno-builtin-malloc, the main drawback being that the developer has to be consciously aware of this when building the code. Otherwise, there will be a nasty surprise. > So, can you file a bug in the glibc bugzilla as well? I have filed a bug there and referenced this one: http://sources.redhat.com/bugzilla/show_bug.cgi?id=11781 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44736