Kicad-5 rc3 and rc2 debian has (I think) bug in pad clearance when gerbers are generated.
Square pads or square pads with rounded edges
are rendered with 0 clearance to the solder mask
in gerber files.
I tried to force pad-specific clearnce e.g. 0.1 mm.
it is correctly shown in PCB opengl view but it still
doesn’t appear at gerbers.
If the same pad is changed to oval or round shape,
then the clearance appears correctly in the gerbers.