From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.smtpout.orange.fr (smtp07.smtpout.orange.fr [80.12.242.129]) by sourceware.org (Postfix) with ESMTPS id EEA913858C60 for ; Mon, 28 Feb 2022 15:54:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EEA913858C60 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=orange.fr Authentication-Results: sourceware.org; spf=none smtp.mailfrom=orange.fr Received: from [192.168.1.17] ([86.253.179.215]) by smtp.orange.fr with ESMTPA id OiLwngh9vzH5fOiM1nVZ6U; Mon, 28 Feb 2022 16:54:31 +0100 X-ME-Helo: [192.168.1.17] X-ME-Auth: MDU4MTIxYWM4YWI0ZGE4ZTUwZWZmNTExZmI2ZWZlMThkM2ZhYiE5OWRkOGM= X-ME-Date: Mon, 28 Feb 2022 16:54:31 +0100 X-ME-IP: 86.253.179.215 Message-ID: <3c2d161f-481a-b223-a855-cadee01a5679@orange.fr> Date: Mon, 28 Feb 2022 16:54:24 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 From: Mikael Morin Subject: Re: [PATCH] openmp, fortran: Check that event handles passed to detach clauses are not arrays [PR104131] To: Kwok Cheung Yeung , Jakub Jelinek , Tobias Burnus Cc: gscfq@t-online.de, gcc-patches , fortran References: <383792f1-a5c7-af10-c603-2f1332336648@codesourcery.com> Content-Language: fr In-Reply-To: <383792f1-a5c7-af10-c603-2f1332336648@codesourcery.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, FREEMAIL_FROM, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: fortran@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Fortran mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Feb 2022 15:54:34 -0000 Le 28/02/2022 à 15:27, Kwok Cheung Yeung a écrit : > On 28/02/2022 2:07 pm, Jakub Jelinek wrote: (...) >> Don't we usually test instead || (*expr)->rank != 0 when testing for >> scalars? >> (...) > > So (*expr)->rank is 0 here even with an array. I'm not sure why - is > rank updated later, or did we forget to call something on the event > handle expression? > > Testing against n->sym->as for an array check has been used elsewhere in > openmp.cc, to prevent reductions against arrays in OpenACC in > resolve_omp_clauses. > I can’t tell what openmp requires; it depends on your needs. Checking sym->as captures array variables which may include scalar expressions (arr(10) is a scalar expression even if arr is an array variable), while checking expr->rank only capture array expression, including scalar variable with array subcomponent (scal%array_comp(:) is an array expression, even if scal is a scalar variable). gfc_resolve_expr, through gfc_expression_rank takes care of properly setting expr->rank. If the check is done at resolution stage (somewhere in resolve_omp_clauses I guess?), the rank should be set. I hope it helps.