From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 976DF385800C; Wed, 24 Feb 2021 10:46:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 976DF385800C From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/99226] [11 Regression] ICE in expand_expr_real_1, at expr.c:10279 Date: Wed, 24 Feb 2021 10:46:29 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: accepts-invalid, openmp X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P4 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.0 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Feb 2021 10:46:29 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99226 --- Comment #3 from Jakub Jelinek --- (In reply to Tobias Burnus from comment #2) > (In reply to Jakub Jelinek from comment #1) > > This is invalid and should have been rejected, when teams is nested in > > target, it must be the only thing nested in it, you can't have two teams > > directives nested in one target construct. >=20 > How is this enforceable at compile time for '!$omp target; call f(); call > g()" and then in f() and g() the teams? That will just fail or misbehave at runtime. The spec says that "A teams region can only be strictly nested within the implicit parallel re= gion or a target region. If a teams construct is nested within a target construc= t, that target construct must contain no statements, declarations or directives outside of the teams construct." The compiler considers teams not strictly nested inside of target as "host teams" which is lowered and expanded differently, and teams strictly nested inside of target as "target teams". And the construct nesting diagnostics then will warn if the "host teams" is nested in some other construct that i= t is not allowed to be nested in, but sure, this works only for lexical nesting. I think clang diagnoses the #c2 testcase, we don't, I think the reason was that it wasn't as clear what exactly is and is not allowed. E.g. #pragma omp target {{{{{{ #pragma omp teams ; }}}}}} should be allowed and some statements outside of the teams but in target mi= ght appear artificially during the parsing of e.g. teams clauses or during their gimplification etc. So, either we diagnose it early in the FEs somehow, or we add some less str= ict late diagnostics, e.g. allow code outside of the teams in target but require that that code doesn't contain any OpenMP directives (or just constructs?). I guess the latter would be far easier and could be done in check_omp_nesting_restrictions.=