https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66578
Bug ID: 66578 Summary: [F2008] Invalid free on allocate(...,source=a(:)) in block Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: tkoenig at gcc dot gnu.org Target Milestone: --- $ cat a4.f90 program main integer :: n n = 42 block real, dimension(0:n) :: a real, dimension(:), allocatable :: c call random_number(a) allocate(c,source=a(:)) end block end program main $ gfortran -g a4.f90 $ ./a.out *** Error in `./a.out': free(): invalid pointer: 0x00000000020c2110 *** ======= Backtrace: ========= /lib64/libc.so.6(+0x7364f)[0x7fa5b086664f] /lib64/libc.so.6(+0x78eae)[0x7fa5b086beae] ./a.out[0x400b0d] ./a.out[0x400b6b] /lib64/libc.so.6(__libc_start_main+0xf5)[0x7fa5b0814be5] ./a.out[0x4007c9] ======= Memory map: ======== 00400000-00401000 r-xp 00000000 08:04 4731063 /home/ig25/Krempel/Andre/a.out 00601000-00602000 r--p 00001000 08:04 4731063 /home/ig25/Krempel/Andre/a.out 00602000-00603000 rw-p 00002000 08:04 4731063 /home/ig25/Krempel/Andre/a.out 020bf000-020e0000 rw-p 00000000 00:00 0 [heap]