public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "David.Smith at lmu dot edu" <gcc-bugzilla@gcc.gnu.org>
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	[thread overview]
Message-ID: <bug-100440-4-ARxdLzdURH@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-100440-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100440

--- 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 <gcc-bugzilla@gcc.gnu.org>
Sent: Friday, May 7, 2021 2:09 PM
To: Smith, David
Subject: [Bug fortran/100440] allocated() gives True for unallocated variable

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100440

--- Comment #5 from kargl at gcc dot gnu.org ---
David,

On amd64-*-freebsd, I see

% gfcx -o z -O2 -fcheck=all allocate_error.f95
% ./z

 Sample 10.  Eigenvalue from matrix powers.

 Iteration    eigenvalue approximation

         0     1.000000000000000000000000000000000000000000000000000000000
 21 j=           1  allocated(FMMATMUL21_FM(J)%MFM%mp) =  F
  allocated(FMMATMUL21_FM(J)%MFM%mp) =  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) = F', and the print statement checking
size() is not protected by an 'if' statement.

valgrind shows

==8708== HEAP SUMMARY:
==8708==     in use at exit: 10,737 bytes in 68 blocks
==8708==   total heap usage: 170 allocs, 102 frees, 40,166 bytes allocated
==8708==
==8708== LEAK SUMMARY:
==8708==    definitely lost: 0 bytes in 0 blocks
==8708==    indirectly lost: 0 bytes in 0 blocks
==8708==      possibly lost: 0 bytes in 0 blocks
==8708==    still reachable: 10,737 bytes in 68 blocks
==8708==         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.

  parent reply	other threads:[~2021-05-08 17:21 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-05 23:11 [Bug fortran/100440] New: " dsmith at lmu dot edu
2021-05-06  0:22 ` [Bug fortran/100440] " kargl at gcc dot gnu.org
2021-05-06 21:31 ` David.Smith at lmu dot edu
2021-05-06 22:54 ` sgk at troutmask dot apl.washington.edu
2021-05-07 14:49 ` David.Smith at lmu dot edu
2021-05-07 21:09 ` kargl at gcc dot gnu.org
2021-05-07 21:12 ` anlauf at gcc dot gnu.org
2021-05-07 21:58 ` sgk at troutmask dot apl.washington.edu
2021-05-08 17:21 ` David.Smith at lmu dot edu [this message]
2021-05-08 18:49 ` anlauf at gcc dot gnu.org
2021-05-09  0:32 ` sgk at troutmask dot apl.washington.edu
2021-05-11 19:56 ` anlauf at gcc dot gnu.org
2021-05-11 20:23 ` anlauf at gcc dot gnu.org
2021-07-26 16:45 ` David.Smith at lmu dot edu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-100440-4-ARxdLzdURH@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).