From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7E3363858C1F; Tue, 22 Nov 2022 21:01:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7E3363858C1F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669150895; bh=T02T9KwbgrMdLNpCzD4TNGdlfhVqk09lGETrVjBq2jo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=n3J1QLqbsj74e+L5XeiGWbypx2Fbc9ywmmHaikurJQQ5HeIR6dyA2ymbe+cMvguKi 6YM9v0YY4IaM/w8t5N+vIExINOgOlpKQNdTJLDvtoCCp+k8lIO6q93sk7G9qLVpiUn RJarvb8SnNhB+h2RpGzHHNLf0KMVLibqi1PyREys= From: "anlauf at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/107819] ICE in gfc_check_argument_var_dependency, at fortran/dependency.cc:978 Date: Tue, 22 Nov 2022 21:01:35 +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: 13.0 X-Bugzilla-Keywords: ice-on-invalid-code, ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: anlauf at gcc dot gnu.org X-Bugzilla-Status: NEW 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=3D107819 --- Comment #3 from anlauf at gcc dot gnu.org --- (In reply to anlauf from comment #2) > Potential patch: This regtests ok. However, > Note that we get a (correct) warning for z1 after this fix: >=20 > pr107819-z1.f90:4:10-16: >=20 > 4 | call s (a(n), a) > | 2 1 > Warning: INTENT(OUT) actual argument at (1) might interfere with actual > argument at (2). this comes from gfc_check_argument_var_dependency, where we see the INTENT(= OUT) argument a, we see a(n), and here 966 /* In case of elemental subroutines, there is no dependency 967 between two same-range array references. */ 968 if (gfc_ref_needs_temporary_p (expr->ref) 969 || gfc_check_dependency (var, expr, elemental =3D=3D NOT_ELEMENTAL)) gfc_ref_needs_temporary_p (expr->ref) correctly returns true. The comment sort of does not fit to what happens: the "range" is the same, but n generates a permutation which is detected by gfc_ref_needs_temporary_= p. But then no temporary is generated for a(n), which means we miss a corresponding check elsewhere. Could need help by some expert on this...=