https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98342
Paul Thomas <pault at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |pault at gcc dot gnu.org Ever confirmed|0 |1 Status|UNCONFIRMED |NEW Last reconfirmed| |2020-12-17 Assignee|unassigned at gcc dot gnu.org |pault at gcc dot gnu.org --- Comment #2 from Paul Thomas <pault at gcc dot gnu.org> --- Googling on munmap_chunk(): invalid pointer reveals that this is quite a frequent problem. It originates from the call out = sel_rank(get_tuple(x)) rather than what happens in either function. Somewhere a free is bein done on memory that is not malloc'ed. Bizarrely, out = sel_rank([get_tuple(x)]) as does z = get_tuple(x) ! z appropriately declared of course! out = sel_rank(z) valgrind confirms this: ....snip.... ==535157== Invalid free() / delete / delete[] / realloc() ==535157== at 0x483A9F5: free (vg_replace_malloc.c:538) ==535157== by 0x40343A: MAIN__ (pr98342.f90:48) ==535157== by 0x4035BA: main (pr98342.f90:40) ==535157== Address 0x1ffeffede0 is on thread 1's stack ==535157== in frame #1, created by MAIN__ (pr98342.f90:39) ==535157== ....snip.... The problem arises somewhere in trans-expr.c(gfc_conv_procedure_call). I am on to it :-) Paul