From patchwork Wed Aug 28 10:13:47 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 270427 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 "www.sourceware.org", Issuer "StartCom Class 1 Primary Intermediate Server CA" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 60B1C2C00B1 for ; Wed, 28 Aug 2013 20:14:01 +1000 (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:reply-to:mime-version:content-type; q=dns; s=default; b=UAWBmvOfc3uo/AyEbS3GQ/e6edtaEBWc1Xb3pTLpMog fwA8fvMIk4UTAI+Ui2G6QrK2T8REIRGbw1dm8Zcd7Xna2hrUdB53KREviBCG4EdP RhubryNIvb15rvuQ9cSkglhSTM+W6Ynjv3uiCbxSreJdl0aJ2pvaNI0EDuXRRKTk = 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:reply-to:mime-version:content-type; s=default; bh=0z9HJyEXtVY643KM6LLd1V6uY8M=; b=doVbKzeJSa0wpAyOU 2pdb/t97SjWiYhrRrhh1MGsGoC6eB/ivQksG1RzeF3Dkf3u27U1TvbfvOBPeE49y 1NGo1w475gykpnKuMEsHCpq5prjD/sNRAGfcls9vxPmJYwmMKxo4tlB5JlCDUZcs SrftRUkLk74NkuEjrP4PZMOHWU= Received: (qmail 27933 invoked by alias); 28 Aug 2013 10:13:53 -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 27921 invoked by uid 89); 28 Aug 2013 10:13:53 -0000 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 28 Aug 2013 10:13:53 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.5 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r7SADnAR022070 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 28 Aug 2013 06:13:50 -0400 Received: from tucnak.zalov.cz (vpn1-5-98.ams2.redhat.com [10.36.5.98]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r7SADmnj029462 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 28 Aug 2013 06:13:49 -0400 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.14.7/8.14.7) with ESMTP id r7SADliO024634 for ; Wed, 28 Aug 2013 12:13:47 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.14.7/8.14.7/Submit) id r7SADl2o024633 for gcc-patches@gcc.gnu.org; Wed, 28 Aug 2013 12:13:47 +0200 Date: Wed, 28 Aug 2013 12:13:47 +0200 From: Jakub Jelinek To: gcc-patches@gcc.gnu.org Subject: [committed] Fix bogus warning on OpenMP collapsed loops (PR middle-end/58257) Message-ID: <20130828101347.GR21876@tucnak.zalov.cz> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Hi! The .count.NN vars have TREE_NO_WARNING set on them, because they may be uninitialized if the loop body isn't executed at all (zero trip count), but copy_var_decl wasn't propagating the flag over to the parallel body ompfn function vars. Fixed thusly, tested on x86_64-linux, committed to trunk/4.8. 2013-08-28 Jakub Jelinek PR middle-end/58257 * omp-low.c (copy_var_decl): Copy over TREE_NO_WARNING flag. * c-c++-common/gomp/pr58257.c: New test. Jakub --- gcc/omp-low.c.jj 2013-08-28 11:27:54.000000000 +0200 +++ gcc/omp-low.c 2013-08-28 11:39:07.578948737 +0200 @@ -850,6 +850,7 @@ copy_var_decl (tree var, tree name, tree DECL_ARTIFICIAL (copy) = DECL_ARTIFICIAL (var); DECL_IGNORED_P (copy) = DECL_IGNORED_P (var); DECL_CONTEXT (copy) = DECL_CONTEXT (var); + TREE_NO_WARNING (copy) = TREE_NO_WARNING (var); TREE_USED (copy) = 1; DECL_SEEN_IN_BIND_EXPR_P (copy) = 1; --- gcc/testsuite/c-c++-common/gomp/pr58257.c.jj 2013-08-28 11:56:17.991343584 +0200 +++ gcc/testsuite/c-c++-common/gomp/pr58257.c 2013-08-28 11:58:24.616648066 +0200 @@ -0,0 +1,15 @@ +/* PR middle-end/58257 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fopenmp -Wall" } */ + +int +foo (int n) +{ + int a[10][10]; + int x, y; +#pragma omp parallel for collapse(2) /* { dg-bogus "may be used uninitialized in this function" } */ + for (x = 0; x < n; x++) /* { dg-bogus "may be used uninitialized in this function" } */ + for (y = 0; y < n; y++) + a[x][y] = x + y * y; + return a[0][0]; +}