The problem is the main.f90 at line 66
do j = 1, 3
y = 20._dp ! mm top margin
do i = 1, 7
call hat%set(start=cmplx(x+10._dp, y, dp), hx_side=HX_SIDE)
If you call set within this loop with the allocation inside this is bound to happen as you are creating (mem allocation) the object and setting its values in the same procedure.
The easy fix would be to: in tile_class.f90, line 66: if(.not.allocated(self%vertex)) allocate(self%vertex(13)) that way you can keep your implementation as is.
Otherwise you should separate the memory allocation and the values setting as two distintic member procedures such that you force yourself to create the memory space just once and then play around with the actual values as you please.
A non-related note, make sure to implement also a final procedure
type, abstract :: Polygon
complex(dp), allocatable :: vertex(:)
contains
procedure, pass(self) :: draw => polygon_draw
procedure, pass(self) :: print => polygon_print
final :: polygon_clear
end type Polygon
...
subroutine polygon_clear(self)
class(polygon) :: self
if(allocated(self%vertex)) deallocate(self%vertex)
end subroutine
That way, as your objects become more complicated you’ll be sure that they’ll be properlly destroyed when their local scope ends.