From patchwork Wed Apr 3 10:36:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 233349 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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 90ABB2C009E for ; Wed, 3 Apr 2013 21:36:31 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=KBb7ZiUT/yGBAx6J9FV2t2/gLQlslMIyw9IKW+06TEeJI/68U6UHg juBB1vFoOOFTaLd78Ac/a0NDNw/Cohg3WP598shjEgW3FXJUNdHXuO84LAolppFe IfdPCXbOFDWdDHz9Hb0yNZazTmO/j4KFAqBJFzLkIT9azbfRkzsgQ8= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=CNiFG8R9t0rafb8wHDA03nAVzkA=; b=ifujset9aVcWHG7khikt RG5ZqDbZE+jzGendeXWTKG3d285rKMjiOBiMqnS7gn5FRxQLDu9bxBUdC2L81igl wvW7nEzWN0fCOS08rM+wYWxHa/Ponoh0czbtGRPdoDcbgSN8pZ+pU36/drFGAD+4 KyLtU2Bj46roLS0BJYnHFQQ= Received: (qmail 20604 invoked by alias); 3 Apr 2013 10:36:23 -0000 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 Received: (qmail 20592 invoked by uid 89); 3 Apr 2013 10:36:22 -0000 X-Spam-SWARE-Status: No, score=-6.7 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD autolearn=ham version=3.3.1 Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 03 Apr 2013 10:36:20 +0000 Received: from relay1.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 813DFA51BB for ; Wed, 3 Apr 2013 12:36:18 +0200 (CEST) Date: Wed, 3 Apr 2013 12:36:18 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] Testcase for PR55964 from PR56097 Message-ID: User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Slightly different and less arcane. Tested on x86_64-unknown-linux-gnu, applied to trunk and branch. Richard. 2013-04-03 Richard Biener PR tree-optimization/55964 * gcc.dg/torture/pr55964-2.c: New testcase. Index: gcc/testsuite/gcc.dg/torture/pr55964-2.c =================================================================== --- gcc/testsuite/gcc.dg/torture/pr55964-2.c (revision 0) +++ gcc/testsuite/gcc.dg/torture/pr55964-2.c (working copy) @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-ftree-loop-distribution -funswitch-loops" } */ + +struct test_struct { + int a, b[10], c[10], d[10]; +}; + +extern struct test_struct* new_struct; + +void testfunc(struct test_struct* old_struct) +{ + int i; + for (i = 0; i < 10; ++i) + { + new_struct->b[i] = old_struct ? old_struct->b[i] : -1; + new_struct->c[i] = old_struct ? old_struct->c[i] : 0; + new_struct->d[i] = old_struct ? old_struct->d[i] : 0; + } + if (old_struct) + old_struct->a++; +}