From patchwork Tue May 15 09:10:52 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tristan Gingold X-Patchwork-Id: 159264 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 718A1B6FAF for ; Tue, 15 May 2012 19:11:21 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1337677881; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:From:Content-Type:Content-Transfer-Encoding:Subject: Date:Message-Id:To:Mime-Version:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=1pfoH7BACXqM+IRXkffTwCzTxVc=; b=gKcpgnr+/yFQWRq VHQL7IoS/iPZjzapR7lXrPVW/fkUgnpLiXQzB7mpWjh62tmOtyfTfd6P/x5DmQAG 1er5NzN6S4Ys4XvECWx3e3UF8hi+XEcZXrzMztlgojvSxK9Mn2HMFm1E2on392Ob KIA4GCpD2TeCxWgGr0t7NC7S1Bkc= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:From:Content-Type:Content-Transfer-Encoding:Subject:Date:Message-Id:To:Mime-Version:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=F3UVcHcHbhu2Y4KD/satCsbn4svU110doBue4WgXNkofA13ZR5RM8qKkAxg+Sy d01sMA/2NAC/rixI0/Sk+rJnA9/MahkMzQqKCJwLo5ubSfj9beoZToPxwUzH5GCg pud0U8lytEFxVichSf5o9AqmcQqtxb9N/WvxFdc8+vLkI=; Received: (qmail 3368 invoked by alias); 15 May 2012 09:11:15 -0000 Received: (qmail 3355 invoked by uid 22791); 15 May 2012 09:11:12 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (194.98.77.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 15 May 2012 09:10:53 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 4859E290073 for ; Tue, 15 May 2012 11:10:58 +0200 (CEST) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IWHacG6sGIa4 for ; Tue, 15 May 2012 11:10:58 +0200 (CEST) Received: from ulanbator.act-europe.fr (ulanbator.act-europe.fr [10.10.1.67]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id 36393290008 for ; Tue, 15 May 2012 11:10:58 +0200 (CEST) From: Tristan Gingold Subject: [Patch]: Fix very large frame bug on i386 Date: Tue, 15 May 2012 11:10:52 +0200 Message-Id: To: GCC Patches Mime-Version: 1.0 (Apple Message framework v1278) X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Hi, use of 'unsigned int' for i386.c:ix86_compute_frame_layout stack_alignment_needed results in truncation of frame offset in code such as: offset = (offset + stack_alignment_needed - 1) & -stack_alignment_needed (as it is -stack_alignment_needed that is converted to HOST_WIDE_INT). As a consequence, frames larger than 4GB are squeezed. Also, the frame field of struct ix86_frame is never used. Bootstrapped and reg-tested on x86_64 GNU/Linux, without regressions. Ok for trunk ? Tristan. 2012-05-15 Tristan Gingold * config/i386/i386.c (struct ix86_frame): Remove unused frame field. (ix86_compute_frame_layout): Fix type of stack_alignment_needed and preferred_alignment. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index ad4739b..353ee53 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -2408,7 +2408,6 @@ struct ix86_frame int va_arg_size; int red_zone_size; int outgoing_arguments_size; - HOST_WIDE_INT frame; /* The offsets relative to ARG_POINTER. */ HOST_WIDE_INT frame_pointer_offset; @@ -8937,9 +8936,9 @@ ix86_builtin_setjmp_frame_value (void) static void ix86_compute_frame_layout (struct ix86_frame *frame) { - unsigned int stack_alignment_needed; + unsigned HOST_WIDE_INT stack_alignment_needed; HOST_WIDE_INT offset; - unsigned int preferred_alignment; + unsigned HOST_WIDE_INT preferred_alignment; HOST_WIDE_INT size = get_frame_size (); HOST_WIDE_INT to_allocate;