From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 4575E3858D1E; Sun, 13 Feb 2022 17:47:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4575E3858D1E From: "fortranfan at outlook dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/104520] New: Unexpected behavior with STORAGE_SIZE intrinsic with a dummy argument that is unlimited polymorphic Date: Sun, 13 Feb 2022 17:47:18 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: fortranfan at outlook dot com 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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: Sun, 13 Feb 2022 17:47:18 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104520 Bug ID: 104520 Summary: Unexpected behavior with STORAGE_SIZE intrinsic with a dummy argument that is unlimited polymorphic Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: fortranfan at outlook dot com Target Milestone: --- Consider the following: --- begin code --- module m use, intrinsic :: iso_fortran_env, only : character_storage_size contains subroutine sub( a ) class(*), intent(in) :: a print *, "storage_size(s) =3D ", storage_size(a) select type ( a ) type is ( character(len=3D*) ) print *, "expected is ", len(a)*character_storage_size end select end subroutine=20 end module use m=20 character(len=3D2) :: s call sub( s ) end --- end code --- And the program behavior using gfortran: --- begin console output --- C:\temp>gfortran -Wall y.f90 -o y.exe C:\temp>y.exe storage_size(s) =3D 8 expected is 16 C:\temp> --- end output --- On the other hand, consider the following: --- begin code --- character(len=3D2) :: s print *, storage_size(s) end --- end code --- The program behavior is --- begin output --- C:\temp>gfortran -Wall y.f90 -o y.exe C:\temp>y.exe 16 C:\temp> --- end output --- I failed to find anything in the Fortran standard that supports the above s= hown program behavior. Can the first case with the unlimited polymorphic dummy = be expected to the same as the second, meaning the storage size of the object = get determined as 16 bits? Thank you, Vipul Parekh=