Dear Tom Many thanks for asking my question so quickly. After your answer, I downloaded brand new versions of PostgreSQL 13.2, PostGIS 2.5.5, and compiled/installed with the standard parameters. I didn't get any error messages in the build. I then recompiled again MobilityDB and got the same error message.
When debugging the function with gdb, I noticed that the rsinfo variable of the PostgreSQL function ExecMakeFunctionResultSet is modified in the macro SRF_RETURN_NEXT causing the problem. Any idea how to solve this? 4353 SRF_RETURN_NEXT(funcctx, Int32GetDatum(result)); (gdb) up #1 0x000055b8a871fc56 in ExecMakeFunctionResultSet (fcache=0x55b8a8e6d9a0, econtext=0x55b8a8e6cfa0, argContext=0x55b8a9d00dd0, isNull=0x55b8a8e6d930, isDone=0x55b8a8e6d988) at /home/esteban/src/postgresql-13.2/build_dir/../src/backend/executor/execSRF.c:614 614 result = FunctionCallInvoke(fcinfo); (gdb) p rsinfo $5 = {type = T_ReturnSetInfo, econtext = 0x55b8a8e6cfa0, expectedDesc = 0x55b8a8e6e8f0, allowedModes = 3, returnMode = SFRM_ValuePerCall, isDone = ExprSingleResult, setResult = 0x0, setDesc = 0x0} (gdb) n 4354 } (gdb) ExecMakeFunctionResultSet (fcache=0x55b8a8e6d9a0, econtext=0x55b8a8e6cfa0, argContext=0x55b8a9d00dd0, isNull=0x55b8a8e6d930, isDone=0x55b8a8e6d988) at /home/esteban/src/postgresql-13.2/build_dir/../src/backend/executor/execSRF.c:615 615 *isNull = fcinfo->isnull; (gdb) p rsinfo $6 = {type = T_ReturnSetInfo, econtext = 0x55b8a8e6cfa0, expectedDesc = 0x55b8a8e6e8f0, allowedModes = 3, returnMode = (SFRM_ValuePerCall | unknown: 256), isDone = ExprSingleResult, setResult = 0x0, setDesc = 0x0} (gdb)