From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32758 invoked by alias); 28 Nov 2008 11:25:20 -0000 Received: (qmail 30662 invoked by uid 48); 28 Nov 2008 11:23:59 -0000 Date: Fri, 28 Nov 2008 11:25:00 -0000 Message-ID: <20081128112359.30661.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug rtl-optimization/38245] [4.4 Regression] apparent improper segfault in compiler output In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "steven at gcc dot gnu dot org" 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: 2008-11/txt/msg02428.txt.bz2 ------- Comment #2 from steven at gcc dot gnu dot org 2008-11-28 11:23 ------- There really is obvious way to remove the argument pushes without libcall notes. There is nothing in the RTL to make clear that the pushes are dead when the call is removed, so they pushes stay. There are several ways to "fix" this. 1. Make the call not pure (even if the function is technically pure). IIRC the call pops the incoming arguments on return, which is clearly a non-pure side-effect. I am assuming it is acceptable that the call is not a candidate for DCE. I think this is acceptable -- it's the consequence of removing libcall notes -- but OTOH I would like to understand *why* we end up with a DCE-able pure call in the first place, why it's not optimized away in the tree optimizations. Of course, a call would only have to be non-pure if it takes arguments via the stack. For targets with "proper" argument passing via registers ;) the call should still be pure. 2. Make it explicit in the IL that the pushes are inputs for the call. For example, add EXPR_LISTs from the CALL_INSNs to the pushes of the outgoing args, and teach DCE to remove the insn in the EXPR_LIST when a CALL_INSN is removed. Or resurrect REG_LIBCALL_ID (renamed REG_PURECALL_ID), teach DCE to keep a list of the REG_PURECALL_IDs for removed pure calls, and do a second pass to remove all (non-CALL_INSN) insns that have the REG_PURECALL_ID of a removed libcall. This assumes that we can always remove the outgoing argument pushes if a pure call is removed. I'm not sure if this is true (is it conceivable that we CSE things in such a way that other insns would depend on the argument pushes?). Personally, I'm strongly in favor of option 1. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38245