public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "sgk at troutmask dot apl.washington.edu" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/100440] allocated() gives True for unallocated variable Date: Thu, 06 May 2021 22:54:57 +0000 [thread overview] Message-ID: <bug-100440-4-7eW3c4uHxq@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 #3 from Steve Kargl <sgk at troutmask dot apl.washington.edu> --- On Thu, May 06, 2021 at 09:31:49PM +0000, David.Smith at lmu dot edu wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100440 > > --- Comment #2 from David.Smith at lmu dot edu --- > > With neither access to the actual code nor a reduced testcase, > > it will be virtually impossible to debug this problem. > > Right, I have enclosed a small program pulled out of my real application > that displays the error. Thanks for reduce this to a testcase. I don't see it attached to this email or in bugzilla. gcc.gno.org may have stripped the attachment (for some dumb reason). Feel free to send the test case to me, and I make sure it gets attached to the bug report. > > > Does the code run with the following compiler options: > > > -O0 -fno-frontend-optimize -fcheck=all > > Yes, it compiles and runs, giving the allocate error. > > > Does the code compile without warning if you use -Wall -Wextra? > > There are many warnings, and I think they may all be ignored for this > program: > > IUNKNO = -HUGE(I_TWO)/18 > Warning: Integer division truncated to constant ‘119304647’ > > (Yes, that is what we want) > > IF (MB%MP(2) /= MUNKNO .OR. MB%MP(3) /= 1) THEN > Warning: Inequality comparison for REAL(8) > > (This is a numerical analysis application -- it knows what it is > doing when it compares reals) > > KT1 = MWA%MP(J+1) > Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) > > (ditto) > > TYPE(MULTI), SAVE, DIMENSION(LMBERN) :: MBERN > Warning: Array ‘mbern’ at (1) is larger than limit set by > ‘-fmax-stack-var-size=’, > moved from stack to static storage. > > (That's fine here) > > INTEGER :: J,JMA,JMW,N1,N2 > Warning: Unused variable ‘jma’ declared > > (I removed most of the routines in the full program to make a small > version that gives the error. Also removed some test code that uses > these 'unused' variables) > > IF (KRESLT /= 0) THEN > Warning: ‘kreslt’ may be used uninitialized in this function > > (ditto) > > > > I have attached the file "allocate_error.f95". Output (without the warnings): > > > gfortran allocate_error.f95 -o allocate_error -Wall -Wextra -O0 > -fno-frontend-optimize -fcheck=all > $ allocate_error > > > > Sample 10. Eigenvalue from matrix powers. > > Iteration eigenvalue approximation > > 0 1.000000000000000000000000000000000000000000000000000000000 > 21 j= 1 allocated(FMMATMUL21_FM(J)%MFM%mp) = T > size(FMMATMUL21_FM(J)%MFM%mp) = 1 > allocate_error(29813,0x108292dc0) malloc: *** error for object > 0xb000000000000000: pointer being freed was not allocated > allocate_error(29813,0x108292dc0) malloc: *** set a breakpoint in > malloc_error_break to debug > > Program received signal SIGABRT: Process abort signal. > > Backtrace for this error: > #0 0x104c1ad3d > #1 0x104c1a16d > #2 0x7fff6f56042c > zsh: abort allocate_error The above malloc error suggests to me that you're possibly stepping off the end of an array. -fcheck=all should have caught that. :(
next prev parent reply other threads:[~2021-05-06 22:54 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 [this message] 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 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-7eW3c4uHxq@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: linkBe 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).