From patchwork Wed Jul 13 20:37:22 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Pinski X-Patchwork-Id: 104594 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 B234AB6F54 for ; Thu, 14 Jul 2011 06:37:59 +1000 (EST) Received: (qmail 23609 invoked by alias); 13 Jul 2011 20:37:58 -0000 Received: (qmail 23600 invoked by uid 22791); 13 Jul 2011 20:37:57 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-iw0-f175.google.com (HELO mail-iw0-f175.google.com) (209.85.214.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 13 Jul 2011 20:37:23 +0000 Received: by iwn4 with SMTP id 4so7160459iwn.20 for ; Wed, 13 Jul 2011 13:37:22 -0700 (PDT) MIME-Version: 1.0 Received: by 10.42.168.133 with SMTP id w5mr1499878icy.118.1310589442313; Wed, 13 Jul 2011 13:37:22 -0700 (PDT) Received: by 10.42.220.201 with HTTP; Wed, 13 Jul 2011 13:37:22 -0700 (PDT) Date: Wed, 13 Jul 2011 13:37:22 -0700 Message-ID: Subject: [Patch] Fix PR 49309, ICE with mudflap From: Andrew Pinski To: GCC Patches , Richard Guenther 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, The problem here is that the type of the POINTER_PLUS_EXPR is incorrect and also the non folded version leaks to the IR. This patch fixes those two problems and fixes the ICE. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. Thanks, Andrew Pinski 2011-07-13 Andrew Pinski PR tree-opt/49309 * tree-mudflap.c (mf_xform_derefs_1 ): Use fold_build2_loc instead of build2. Use the correct type for the new tree. 2011-07-13 Andrew Pinski PR tree-opt/49309 * g++.dg/torture/pr49309.C: New testcase. Index: ChangeLog =================================================================== --- ChangeLog (revision 176249) +++ ChangeLog (working copy) @@ -1,3 +1,10 @@ +2011-07-13 Andrew Pinski + + PR tree-opt/49309 + * tree-mudflap.c (mf_xform_derefs_1 ): + Use fold_build2_loc instead of build2. + Use the correct type for the new tree. + 2011-07-13 Ulrich Weigand * config/spu/spu.c (spu_init_libfuncs): Install __clrsbdi2. Index: testsuite/ChangeLog =================================================================== --- testsuite/ChangeLog (revision 176249) +++ testsuite/ChangeLog (working copy) @@ -1,3 +1,8 @@ +2011-07-13 Andrew Pinski + + PR tree-opt/49309 + * g++.dg/torture/pr49309.C: New testcase. + 2011-07-13 Janne Blomqvist PR libfortran/49296 Index: testsuite/g++.dg/torture/pr49309.C =================================================================== --- testsuite/g++.dg/torture/pr49309.C (revision 0) +++ testsuite/g++.dg/torture/pr49309.C (revision 0) @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-fmudflap" } */ +struct A +{ + int i; + + A(); + A(const A&); +}; + +inline void foo(A a) { a = A(); } + +void bar() { foo(A()); } + Index: tree-mudflap.c =================================================================== --- tree-mudflap.c (revision 176218) +++ tree-mudflap.c (working copy) @@ -869,7 +869,7 @@ mf_xform_derefs_1 (gimple_stmt_iterator break; case MEM_REF: - addr = build2 (POINTER_PLUS_EXPR, TREE_TYPE (TREE_OPERAND (t, 1)), + addr = fold_build2_loc (location, POINTER_PLUS_EXPR, TREE_TYPE (TREE_OPERAND (t, 0)), TREE_OPERAND (t, 0), fold_convert (sizetype, TREE_OPERAND (t, 1))); base = addr;