From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9125F3858D37; Mon, 6 Jul 2020 15:01:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9125F3858D37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1594047685; bh=gONPvOnDIfBNieD0qQM6QySAyA+CZiYG08aZaAx3nnY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=cGQz+X6etfX+dyd89505V7WYR+CkkuZ83ueXnmdu342WIN+yjd1aSt9dfXUlUfwzQ k2325pGRfs56cO7ZXODrEACV+pEnAhOqs37eLpefPtQTdn9VVyUpDaiGuh4pmI4tPi Dw1zBedfhQ/sE/1jVH6TeL6ZVAW5truG/qTmwvu4= From: "tkoenig at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/96018] [9/10/11 Regression] Optimization issue with external HDF5 library Date: Mon, 06 Jul 2020 15:01:25 +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: 10.0 X-Bugzilla-Keywords: needs-bisection, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: tkoenig at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P4 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 9.4 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: Mon, 06 Jul 2020 15:01:25 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96018 --- Comment #12 from Thomas Koenig --- I don't have a debuggable source here at the moment, but I think there may be a problem with implicit_pure, which was either introduced by a patch in the range that Dominique provided (maybe for PR 85599?), or exposed by something in the middle end. The problem can be seen with -fdump-tree-original (in my case, with 9.3.0): Namespace: A-Z: (UNKNOWN 0) procedure name =3D wrapper symtree: 'call_side_effect'|| symbol: 'call_side_effect' type spec : (INTEGER 4) attributes: (PROCEDURE MODULE-PROC FUNCTION) result: ierr symtree: 'inner_3d' || symbol: 'inner_3d' type spec : (INTEGER 4) attributes: (PROCEDURE MODULE-PROC FUNCTION) result: ierr Formal arglist: array symtree: 'inner_4d' || symbol: 'inner_4d' type spec : (INTEGER 4) attributes: (PROCEDURE MODULE-PROC FUNCTION IMPLICIT_PURE) result: ierr Formal arglist: array IMPLICIT_PURE should not be set on inner_4d, because it evaluates the function call_side_effect (and marking is as PURE is correctly rejected because of that). It is also strange that inner_3d is not also wrongly marked as IMPLICIT_PURE, I do not really see a significant difference between integer function inner_3d(array) result(ierr) real, intent(in) :: array(:,:,:) integer dimensions(3) dimensions =3D shape(array) ierr =3D call_side_effect() end function inner_3d and integer function inner_4d(array) result(ierr) real, intent(in) :: array(:,:,:,:) integer dimensions(4) dimensions =3D shape(array) ierr =3D call_side_effect() end function inner_4d=