From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C1E9E3857C5B; Tue, 13 Feb 2024 20:29:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C1E9E3857C5B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1707856161; bh=t9z0I8Mj0Cz3SYNzEQ1xl2InnIRUyenWSlVqER5MO1g=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ukZ2BQWJDe9jpyJGy2B098BHLSF6/0vCL0risPhQzYvk0CjllQq+9KBxXJOcLP+Yi wb1OCvbXWkzi0ebBcNfc8dBjcaH2tDn2fncKNNL9grxvY3eOwGJwAkeS15jSThZUuD TqTT7tZzxqwhRmD3Kx1CS4PTVmpR6RuUXSZr12jk= From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/113904] [OpenMP][5.0][5.1] Dynamic context selector 'user={condition(expr)}' not handled Date: Tue, 13 Feb 2024 20:29:21 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: accepts-invalid, openmp, rejects-valid, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: burnus at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D113904 --- Comment #3 from Tobias Burnus --- See comment 1 for remaining to-do items. I also note that the Fortran resolution comes too early - during parsing - = as the following shows: module m implicit none contains subroutine test !$omp declare variant (foo) match(user=3D{condition(myTrue)}) !$omp declare variant (bar) match(user=3D{condition(myCond(1).and.myCond(= 2))}) logical, parameter :: myTrue =3D .true. end subroutine foo; end subroutine bar; end logical function myCond(i) integer :: i myCond =3D i < 3 end end module m This fails with the complete bogus: 5 | !$omp declare variant (foo) match(user=3D{condition(myTrue)}) | 1 Error: property must be a constant logical expression at (1) As 'myTrue' is a scalar logical PARAMETER. The problem is just that this is not known when parsing '!$omp' - for that reason, Fortran separates parsing and resolution, which the current code do= es not handle as it comes way too early. * * * Otherwise: It looks as if - except for simple variable names (and probablya= lso for functions calls w/o arguments) - we want to introduce an internal aux function like: logical function __m_MOD_test_DV_cond1() result(res) res =3D myCond(1).and.myCond(2) end which is then called when evaluating the run-time expression. With header files and, possibly, also C++ modules, we might be able to alwa= ys inline the condition - with Fortran modules probably not, such that an aux function would be needed for the generic case.=