In order to control the spectrum of singularities of the generalized Riemann function, we need to find sharp bounds for certain kind of Gauss sums with frequencies on polynomials. This can be achieved by Weil bounds on completely irreducible algebraic curves, which lead us to prove some theorems on irreducibility of polynomials in two variables. We will prove a general theorem in this field. An example of the theorem is the absolute irreducibility of p(x)-p(y)+1, for any p(x) with integer coefficients.