Basic fragment shader flickering if adding a clip plane if

Hi and thanks in advance.
First shaders but I have a strange problem. this piece of code in the shader, on a W11 GeForce RTX 4060 Laptop GPU, latest driver 572.16.

The if in the code works fine discarding contributes over the plane but it adds a bad flickering (eve if th clip variable is false).
Othe nvidia cards and my amd is working properly.
How can I fix it?

Thanks.

#version 430 core
uniform bool clip;
uniform vec4 clipPlaneEq;
in vec4 point3d;

void main() {

if(clip)
{
if( dot(point3d, clipPlaneEq) > 0.0f)
{
FragColor = colorO;
discard;
}
}

}

I’ve found the problem and it was in another part of the code.
it was an unitialized variable. hope this can help someone.