From patchwork Tue Apr 10 13:17:56 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 151548 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 4A317B7006 for ; Tue, 10 Apr 2012 23:18:15 +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=1334668695; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Date: From:To:Subject:Message-ID:MIME-Version:Content-Type: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=lioMCfvWNsfok5wGT4u0 zxsXlE0=; b=pOTBZurHK6HQcEU9tOyvasMmxF0BqACT25EOqZLV8/uPP29w8zRn NuolvzHEu1UbuR9RPRtxY2QQXHSvKBVpIDYhC70uO4LR1yq6vpzi0kxKbyvXiXyI bNsLOLInpoLU/actaXFLSRY51MBV5tlbMvajR04p34u/j9u1CZbXvSg= 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:Date:From:To:Subject:Message-ID:MIME-Version:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=HUZs33d6oS66kHKSrXVcaWpG8qcwJMtQNWFKIwzhRN4gUEbl2RrxO9cn6EV7HH aS5yEZF3IITY7S3ehTmou8msCU2p7RgYbZRZx8HNf2Lr2AKE1zFOiE8uZc1I4AGT jXIrNzusuhEpE+VZsAhQJ7tKkn17CfNFAKACBl/47ybho=; Received: (qmail 5502 invoked by alias); 10 Apr 2012 13:18:11 -0000 Received: (qmail 5493 invoked by uid 22791); 10 Apr 2012 13:18:10 -0000 X-SWARE-Spam-Status: No, hits=-5.3 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 10 Apr 2012 13:17:57 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 3EF73935A1 for ; Tue, 10 Apr 2012 15:17:56 +0200 (CEST) Date: Tue, 10 Apr 2012 15:17:56 +0200 (CEST) From: Richard Guenther To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix PR52888 Message-ID: MIME-Version: 1.0 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 This fixes the gimple_check_call_args routine to properly check for compatible aggregate types, something fold_convertible (which is otherwise more forgiving) does not handle. Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk. Richard. 2012-04-10 Richard Guenther PR middle-end/52888 * gimple-low.c (gimple_check_call_args): Properly account for compatible aggregate types. Index: gcc/gimple-low.c =================================================================== --- gcc/gimple-low.c (revision 186273) +++ gcc/gimple-low.c (working copy) @@ -240,15 +240,17 @@ gimple_check_call_args (gimple stmt, tre i < nargs; i++, p = DECL_CHAIN (p)) { + tree arg; /* We cannot distinguish a varargs function from the case of excess parameters, still deferring the inlining decision to the callee is possible. */ if (!p) break; + arg = gimple_call_arg (stmt, i); if (p == error_mark_node - || gimple_call_arg (stmt, i) == error_mark_node - || !fold_convertible_p (DECL_ARG_TYPE (p), - gimple_call_arg (stmt, i))) + || arg == error_mark_node + || (!types_compatible_p (DECL_ARG_TYPE (p), TREE_TYPE (arg)) + && !fold_convertible_p (DECL_ARG_TYPE (p), arg))) return false; } } @@ -256,15 +258,17 @@ gimple_check_call_args (gimple stmt, tre { for (i = 0, p = parms; i < nargs; i++, p = TREE_CHAIN (p)) { + tree arg; /* If this is a varargs function defer inlining decision to callee. */ if (!p) break; + arg = gimple_call_arg (stmt, i); if (TREE_VALUE (p) == error_mark_node - || gimple_call_arg (stmt, i) == error_mark_node + || arg == error_mark_node || TREE_CODE (TREE_VALUE (p)) == VOID_TYPE - || !fold_convertible_p (TREE_VALUE (p), - gimple_call_arg (stmt, i))) + || (!types_compatible_p (TREE_VALUE (p), TREE_TYPE (arg)) + && !fold_convertible_p (TREE_VALUE (p), arg))) return false; } }