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. > 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 Thanks for your help, David Smith ________________________________________ From: kargl at gcc dot gnu.org <gcc-bugzi...@gcc.gnu.org> Sent: Wednesday, May 5, 2021 5:22 PM To: Smith, David Subject: [Bug fortran/100440] allocated() gives True for unallocated variable https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100440 kargl at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kargl at gcc dot gnu.org --- Comment #1 from kargl at gcc dot gnu.org --- With neither access to the actual code nor a reduced testcase, it will be virtually impossible to debug this problem. Does the code run with the following compiler options: -O0 -fno-frontend-optimize -fcheck=all Does the code compile without warning if you use -Wall -Wextra? -- You are receiving this mail because: You reported the bug.