[Bug fortran/100440] allocated() gives True for unallocated variable
kargl at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri May 7 21:09:51 GMT 2021
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
More information about the Gcc-bugs
mailing list