From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19450 invoked by alias); 9 Mar 2003 16:36:00 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 19436 invoked by uid 71); 9 Mar 2003 16:36:00 -0000 Date: Sun, 09 Mar 2003 16:36:00 -0000 Message-ID: <20030309163600.19435.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Jim Wilson Subject: Re: middle-end/9997: Coelesce stack slots for disjoint scopes. Reply-To: Jim Wilson X-SW-Source: 2003-03/txt/msg00431.txt.bz2 List-Id: The following reply was made to PR middle-end/9997; it has been noted by GNATS. From: Jim Wilson To: Daniel Jacobowitz Cc: gcc-gnats@gcc.gnu.org Subject: Re: middle-end/9997: Coelesce stack slots for disjoint scopes. Date: Sun, 09 Mar 2003 11:32:47 -0500 This patch seems more complicated than necessary. expand_end_bindings already calls pop_temp_slots. So all you have to do is arrange for locals to have the right temp_slot_level. I tried looking at this. We are calling preserve_stack_temps, and that preserves all temp slots whose address was taken. This means a local of array type won't be freed when its scope terminates. The question then is whether this is really necessary to preserve values whose address was taken. This code is used to preserve values that might be needed by an expression statement result. In this case, the result is const0_rtx. This code has a test for !MEM. This is apparently to handle the case where the result is in a REG that might contain an address. However, !MEM also includes constants, and constants can't possibly contain the address of a stack local. I think this problem would go away if we fixed this code to do nothing for constant results. The problematic code is here: /* If X is not in memory or is at a constant address, it cannot be in a temporary slot, but it can contain something whose address was taken. */ if (p == 0 && (GET_CODE (x) != MEM || CONSTANT_P (XEXP (x, 0)))) We should do nothing here if x is a constant, but there is no code for that. Jim