From patchwork Sun May 11 18:28:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 347812 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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 28787140084 for ; Mon, 12 May 2014 04:28:40 +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 :message-id:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=K57IRTUX0GXv4XQR5DWuEwSWZO1DoabeWDzZuq2GWEqS56 Q+ebf+sXCNXKuV9aug/VskURAIn+zgXALrMeWkjrbRazUSeUY5zN3Mp/633a3j84 uAsmVuy4Rd8mXa1b5LZyJtVjPOvzPI1fJlFlYbphaZhO6tNPtb1y7+BCDP6y4= 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 :message-id:date:from:mime-version:to:subject:content-type; s= default; bh=OfF5HwLMlw8UumRWDozjQwKQbk0=; b=JifGFYTamfOzJov3ltds BOWbn/vu7HFrMvPDUnR+XW7gxrl+LrkQUE692RN1l9zIF2HpAXj0kXFBxEY+yM4o qbTv6eHHlirYUII2tJgaMCVKpQz2qqsfr6Va/35MyS1WpMILYuOlsNoJB0MefI5I DnTcsPABZN7EYFqMDXP4SQg= Received: (qmail 6737 invoked by alias); 11 May 2014 18:28:18 -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 6615 invoked by uid 89); 11 May 2014 18:28:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx01.qsc.de Received: from mx01.qsc.de (HELO mx01.qsc.de) (213.148.129.14) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Sun, 11 May 2014 18:28:16 +0000 Received: from tux.net-b.de (port-92-194-125-118.dynamic.qsc.de [92.194.125.118]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx01.qsc.de (Postfix) with ESMTPSA id 517A33CCA0; Sun, 11 May 2014 20:28:13 +0200 (CEST) Message-ID: <536FC13C.2080708@net-b.de> Date: Sun, 11 May 2014 20:28:12 +0200 From: Tobias Burnus User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: gcc-patches , gfortran , Jakub Jelinek Subject: [Patch, Fortran] Reject OpenMP parallelization for DO CONCURRENT While it would be nice to support "!$OMP do" for "do concurrent" loops, the OpenMP spec does not support it, yet. (Syntactically, it is a not a that simple feature as do concurrent can optionally have a MASK=, which has to be evaluated before the loop.) Thus, this patch avoids an ICE by simply rejecting this feature. That's also in line with the other compilers I tried: they either ICE or reject it with an error message. Note: The patch is based on Jakub's OpenMP4 patch (i.e. it uses "name" instead of the hard-coded "!$omp do"). Build and regtested on x86-64-gnu-linux. OK for the trunk? (When/if OpenMP4 support is backported, I think this patch should also be included.) Tobias 2014-05-11 Tobias Burnus PR fortran/60127 * openmp.c (resolve_omp_do): Reject do concurrent loops. 2014-05-11 Tobias Burnus PR fortran/60127 * gfortran.dg/gomp/omp_do_concurrent.f90: New. diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c index 16c7774..a578ad9 100644 --- a/gcc/fortran/openmp.c +++ b/gcc/fortran/openmp.c @@ -2169,6 +2169,12 @@ resolve_omp_do (gfc_code *code) "at %L", name, &do_code->loc); break; } + if (do_code->op == EXEC_DO_CONCURRENT) + { + gfc_error ("%s cannot be a DO CONCURRENT loop at %L", name, + &do_code->loc); + break; + } gcc_assert (do_code->op == EXEC_DO); if (do_code->ext.iterator->var->ts.type != BT_INTEGER) gfc_error ("%s iteration variable must be of type integer at %L", diff --git a/gcc/testsuite/gfortran.dg/gomp/omp_do_concurrent.f90 b/gcc/testsuite/gfortran.dg/gomp/omp_do_concurrent.f90 new file mode 100644 index 0000000..8320479 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/omp_do_concurrent.f90 @@ -0,0 +1,13 @@ +! { dg-do compile } +! { dg-options "-fopenmp" } +! +! PR fortran/60127 +! +! OpenMP 4.0 doesn't permit DO CONCURRENT (yet) +! + +!$omp do +do concurrent(i=1:5) ! { dg-error "OMP DO cannot be a DO CONCURRENT loop" } +print *, 'Hello' +end do +end