From patchwork Fri Nov 12 11:31:51 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 70955 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 38C76B711C for ; Fri, 12 Nov 2010 22:32:02 +1100 (EST) Received: (qmail 15280 invoked by alias); 12 Nov 2010 11:32:00 -0000 Received: (qmail 15271 invoked by uid 22791); 12 Nov 2010 11:32:00 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 12 Nov 2010 11:31:55 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oACBVsVX027559 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 12 Nov 2010 06:31:54 -0500 Received: from tyan-ft48-01.lab.bos.redhat.com (tyan-ft48-01.lab.bos.redhat.com [10.16.42.4]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id oACBVq3j001432 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 12 Nov 2010 06:31:53 -0500 Received: from tyan-ft48-01.lab.bos.redhat.com (localhost.localdomain [127.0.0.1]) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4) with ESMTP id oACBVqOh008443 for ; Fri, 12 Nov 2010 12:31:52 +0100 Received: (from jakub@localhost) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4/Submit) id oACBVp7T008441 for gcc-patches@gcc.gnu.org; Fri, 12 Nov 2010 12:31:51 +0100 Date: Fri, 12 Nov 2010 12:31:51 +0100 From: Jakub Jelinek To: gcc-patches@gcc.gnu.org Subject: Backported patches to 4.4 Message-ID: <20101112113151.GP29412@tyan-ft48-01.lab.bos.redhat.com> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) 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! I've backported these 2 patches to 4.4 branch after bootstrap/regtest on x86_64-linux and i686-linux. Jakub 2010-11-12 Jakub Jelinek Backport from mainline 2010-11-03 Jakub Jelinek PR tree-optimization/46107 * cfgloopmanip.c (loop_version): Set irred_flag back into entry->flags if cfg_hook_duplicate_loop_to_header_edge failed. * gcc.c-torture/compile/pr46107.c: New test. 2010-11-12 Jakub Jelinek Backport from mainline 2010-11-05 Jakub Jelinek PR middle-end/43690 * gimplify.c (gimplify_asm_expr): If a "m" input is a {pre,post}{in,de}crement, fail. * c-c++-common/pr43690.c: New test. --- gcc/gimplify.c (revision 166353) +++ gcc/gimplify.c (revision 166354) @@ -5066,6 +5066,13 @@ gimplify_asm_expr (tree *expr_p, gimple_ /* If the operand is a memory input, it should be an lvalue. */ if (!allows_reg && allows_mem) { + tree inputv = TREE_VALUE (link); + STRIP_NOPS (inputv); + if (TREE_CODE (inputv) == PREDECREMENT_EXPR + || TREE_CODE (inputv) == PREINCREMENT_EXPR + || TREE_CODE (inputv) == POSTDECREMENT_EXPR + || TREE_CODE (inputv) == POSTINCREMENT_EXPR) + TREE_VALUE (link) = error_mark_node; tret = gimplify_expr (&TREE_VALUE (link), pre_p, post_p, is_gimple_lvalue, fb_lvalue | fb_mayfail); mark_addressable (TREE_VALUE (link)); --- gcc/testsuite/c-c++-common/pr43690.c (revision 0) +++ gcc/testsuite/c-c++-common/pr43690.c (revision 166354) @@ -0,0 +1,13 @@ +/* PR middle-end/43690 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +void +foo (char *x) +{ + asm ("" : : "m" (x++)); /* { dg-error "is not directly addressable" } */ + asm ("" : : "m" (++x)); /* { dg-error "is not directly addressable" } */ + asm ("" : : "m" (x--)); /* { dg-error "is not directly addressable" } */ + asm ("" : : "m" (--x)); /* { dg-error "is not directly addressable" } */ + asm ("" : : "m" (x + 1)); /* { dg-error "is not directly addressable" } */ +} --- gcc/cfgloopmanip.c (revision 166233) +++ gcc/cfgloopmanip.c (revision 166234) @@ -1538,7 +1538,10 @@ loop_version (struct loop *loop, /* Duplicate loop. */ if (!cfg_hook_duplicate_loop_to_header_edge (loop, entry, 1, NULL, NULL, NULL, 0)) - return NULL; + { + entry->flags |= irred_flag; + return NULL; + } /* After duplication entry edge now points to new loop head block. Note down new head as second_head. */ --- gcc/testsuite/gcc.c-torture/compile/pr46107.c (revision 0) +++ gcc/testsuite/gcc.c-torture/compile/pr46107.c (revision 166234) @@ -0,0 +1,16 @@ +/* PR tree-optimization/46107 */ + +int foo (void) __attribute__ ((noreturn)); + +void +bar (int x, int *y, int z) +{ + static void *j[] = { &&l1, &&l2 }; +l1: + if (*y) + goto *j[z]; + foo (); +l2: + *y ^= (x & 1) ? -1 : 0; + goto *j[x]; +}