From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 06FBD3858401; Thu, 11 Apr 2024 04:51:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 06FBD3858401 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1712811106; bh=kO967R5F312BS23gAjO52a0jdwP2Kn5bQN+7mZ7Mwx4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=QKpVKlFfEQLSAwPhUj/9+KHvwKgtyffYwrhl9TLDxT1mnXshrfe0v9oAbza0Jqasp /DWBAGS2O3gbUDOTB49BlWjYzKH9WDTAeQOpXk0oc99DQA0AOMuDsdeBwykivlxYn2 skIElvqRIj1Ujw2PWRNWd9aH7Zxcn/al7Cgxyvyw= From: "sandra 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: Thu, 11 Apr 2024 04:51:44 +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: sandra 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 #5 from sandra at gcc dot gnu.org --- Per TR12, these are the rules for the scoping/evaluation of these expressio= ns: "For the match clause of a declare variant directive, any argument of the b= ase function that is referenced in an expression that appears in the context selector is treated as a reference to the expression that is passed into th= at argument at the call to the base function. Otherwise, a variable or procedu= re reference in an expression that appears in a context selector is a referenc= e to the variable or procedure of that name that is visible at the location of t= he directive on which the context selector appears." C: "Any expressions in the match clause are interpreted as if they appeared= in the scope of arguments of the base function." C++: "any expressions in the match clause are interpreted as if they appear= ed at the scope of the trailing return type of the base function." Plus, confusingly, it also says: "All variables referenced by these expressions are considered to be referen= ced at the call site." "All variables that are referenced in an expression that appears in the con= text selector of a match clause must be accessible at each call site to the base function according to the base language rules." So maybe the intent is that the variables be parsed in the scope of the directive but then the expressions be inserted inline at the call site, rat= her than wrapping them with an internal function? :-S=