From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 28D403858CD1; Wed, 22 May 2024 07:46:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 28D403858CD1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1716363968; bh=qsE3t72CNr2AguDtHx2PGPv8hxV2K20LN0nFMLpZPKE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=xgVu3viiR+qwyKJkZUcvD/MiGm4z2JD/oHfoEgdTJl/UnZ1FKlfqjSQA0+MdOs3dH 16nz+o/ofqPw02WcJ2eWBAo430B51jf9IdVcx1kcP5iSlW5+fnA3AqLHg7TZ0owXfn SubzzkHRbbFTO0rpeYlZuw/AfgeelbXA/czg79jc= From: "pault at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/59104] Wrong result with SIZE specification expression Date: Wed, 22 May 2024 07:46:07 +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: 4.9.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: pault 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: cc 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=3D59104 Paul Thomas changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |pault at gcc dot gnu.org --- Comment #4 from Paul Thomas --- The problem lies in gfc_conv_expr_descriptor, as the following demonstrates: module m1 implicit none integer, parameter :: dp =3D kind([double precision::]) contains function f(x) integer, intent(in) :: x real(dp) f(x/2) integer y(size(f)+1) write(*,*) 'size(f) =3D ',size(f) write(*,*) 'size(y) =3D ',my_size(y) f =3D 0 end function f integer function my_size (arg) integer :: arg(:) my_size =3D size(arg) end end module m1 program bug3 use m1 implicit none real y y =3D sum(f(2)) end program bug3 In both this and the original testcase, the result depends ultimately on a 'ubound.x' that has not been set. I am not sure that I understand why explicit shape arrays are being handled this way in size, when all the information needed is present in the array_s= pec. However, the passing of an incorrect descriptor to 'my_size' has to be fixe= d. Cheers Paul=