I have found the solution! In gfortran is necessary to add the following if statement in all five expressions:
allocate( vec_auxreal( 1:(elemsize+size(elem_all) ) ) )
if (j/=1) vec_auxreal(1:size(elem_all))=elem_all
vec_auxreal(size(elem_all)+1:)=elem(1:elemsize)
call MOVE_ALLOC(vec_auxreal,elem_all)
This happens because, in gfortran if the vector is still empty, it is not recognized that nothing is to be added. In ifort (tested in version 12.0), this if statement is not necessary to the program work.