From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 458913938C0E; Sat, 8 May 2021 17:21:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 458913938C0E From: "David.Smith at lmu dot edu" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/100440] allocated() gives True for unallocated variable Date: Sat, 08 May 2021 17:21:23 +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: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: David.Smith at lmu dot edu 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: 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: Sat, 08 May 2021 17:21:23 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100440 --- Comment #8 from David.Smith at lmu dot edu --- That is not good. The expected results from my test case with debug prints commented out should be this: Sample 10. Eigenvalue from matrix powers. Iteration eigenvalue approximation 0 1.000000000000000000000000000000000000000000000000000000000 1 24.238372093023255813953488372093023255813953488372093023260 2 23.913064457596406344892377530895927499788142161414894216110 3 23.912767173080067549422508320051584489821761621077098788510 4 23.912767172321328589362041859914215096468342615030281071820 5 23.912767172321328589357039228003304505549129411762921508580 6 23.912767172321328589357039228003304505549129195999272982170 7 23.912767172321328589357039228003304505549129195999272982160 David Smith ________________________________________ From: kargl at gcc dot gnu.org Sent: Friday, May 7, 2021 2:09 PM To: Smith, David Subject: [Bug fortran/100440] allocated() gives True for unallocated variab= le https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100440 --- Comment #5 from kargl at gcc dot gnu.org --- David, On amd64-*-freebsd, I see % gfcx -o z -O2 -fcheck=3Dall allocate_error.f95 % ./z Sample 10. Eigenvalue from matrix powers. Iteration eigenvalue approximation 0 1.000000000000000000000000000000000000000000000000000000000 21 j=3D 1 allocated(FMMATMUL21_FM(J)%MFM%mp) =3D F allocated(FMMATMUL21_FM(J)%MFM%mp) =3D F At line 2499 of file allocate_error.f95 Fortran runtime error: Allocatable argument 'fmmatmul21_fm' is not allocated with a number of different options. The runtime error is expected as 'allocated(FMMATMUL21_FM(J)%MFM%mp) =3D F', and the print statement checking size() is not protected by an 'if' statement. valgrind shows =3D=3D8708=3D=3D HEAP SUMMARY: =3D=3D8708=3D=3D in use at exit: 10,737 bytes in 68 blocks =3D=3D8708=3D=3D total heap usage: 170 allocs, 102 frees, 40,166 bytes al= located =3D=3D8708=3D=3D =3D=3D8708=3D=3D LEAK SUMMARY: =3D=3D8708=3D=3D definitely lost: 0 bytes in 0 blocks =3D=3D8708=3D=3D indirectly lost: 0 bytes in 0 blocks =3D=3D8708=3D=3D possibly lost: 0 bytes in 0 blocks =3D=3D8708=3D=3D still reachable: 10,737 bytes in 68 blocks =3D=3D8708=3D=3D suppressed: 0 bytes in 0 blocks which suggests that this might be a MacOS specific bug. Note, if I comment out your print statement for diagnostics, I see % ./z Sample 10. Eigenvalue from matrix powers. Iteration eigenvalue approximation 0 1.000000000000000000000000000000000000000000000000000000000 1 24.238372093023255813953488372093023255813953488372093023260 2 .889072890369341844887411185964338107009906299229814263038M+20 3 .102214801410512542129975983352534954405105702575200225476M+43 4 .133558489514054527062720546215032551914781174136345314241M+87 5 .321140870607048831918216893831115589158773657747578318060M+175 6 .205341864155723417152215792855218285040195823798023639691M+352 7 .667355770417440618516624449043958628107088436355045114363M+705 -- You are receiving this mail because: You reported the bug.=