From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10937 invoked by alias); 2 Nov 2010 16:57:41 -0000 Received: (qmail 10924 invoked by uid 22791); 2 Nov 2010 16:57:40 -0000 X-SWARE-Spam-Status: No, hits=-5.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,TW_KN,TW_NX,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from cantor.suse.de (HELO mx1.suse.de) (195.135.220.2) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 02 Nov 2010 16:57:35 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.221.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.suse.de (Postfix) with ESMTP id D97ED93F46 for ; Tue, 2 Nov 2010 17:57:33 +0100 (CET) Date: Tue, 02 Nov 2010 17:08:00 -0000 From: Richard Guenther To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix PR46216 Message-ID: User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2010-11/txt/msg00168.txt.bz2 Bootstrapped and teste don x86_64-unknwon-linxug-nu, applied. RIchard. 2010-11-02 Richard Guenther PR tree-optimization/46216 * tree-ssa-forwprop.c (tree_ssa_forward_propagate_single_use_vars): Check if we can propagate from a POINTER_PLUS_EXPR before doing so. * gcc.dg/torture/pr46216.c: New testcase. Index: gcc/tree-ssa-forwprop.c =================================================================== *** gcc/tree-ssa-forwprop.c (revision 166172) --- gcc/tree-ssa-forwprop.c (working copy) *************** tree_ssa_forward_propagate_single_use_va *** 1983,1989 **** else gsi_next (&gsi); } ! else if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR) { if (TREE_CODE (gimple_assign_rhs2 (stmt)) == INTEGER_CST /* ??? Better adjust the interface to that function --- 1983,1990 ---- else gsi_next (&gsi); } ! else if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR ! && can_propagate_from (stmt)) { if (TREE_CODE (gimple_assign_rhs2 (stmt)) == INTEGER_CST /* ??? Better adjust the interface to that function Index: gcc/testsuite/gcc.dg/torture/pr46216.c =================================================================== *** gcc/testsuite/gcc.dg/torture/pr46216.c (revision 0) --- gcc/testsuite/gcc.dg/torture/pr46216.c (revision 0) *************** *** 0 **** --- 1,24 ---- + /* { dg-do compile } */ + + typedef int Embryo_Cell; + int + embryo_program_run(Embryo_Cell *cip) + { + unsigned char op; + Embryo_Cell offs; + static const void *switchtable[256] = { + &&SWITCHTABLE_EMBRYO_OP_NONE, &&SWITCHTABLE_EMBRYO_OP_LOAD_PRI + }; + for (;;) + { + op = *cip++; + while (1) { + goto *switchtable[op]; + SWITCHTABLE_EMBRYO_OP_LOAD_PRI: + offs = *(Embryo_Cell *)cip++; + SWITCHTABLE_EMBRYO_OP_NONE: + break; + }; + } + return offs; + }