Is composition of surjective continuous function with discontinuous function discontinuous? Let $I_1,I_2,I_3$ be intervals $\subset \mathbb{R}$. Suppose $f:I_1 \to I_2$ is a surjective continuous function and $g: I_2 \to I_3$ is a discontinuous function. Must the composition $g \circ f$ be discontinuous?

There are some easy counter-examples if $f$ is not assumed to be surjective, e.g. taking $f$ to be a constant function, or in a way that "dodges" the discontinuous point(s) of $g$.

However if such "dodging" is prohibited, I fail to construct such functions nor find an answer from many similar questions on this site. So I am interested to know whether counter-examples exist? If not, is there a proof? Does it have something to do with intermediate value theorem?
If $g$ is discontinuous at $x=a$, then $gf$ cannot be continuous. Suppose $gf$ is continuous. For any sequence $\{x_n\}\in I_2, x_n\to a$, due to the surjectivity of $f$, $\exists \{y_n\}\in I_1, f(y_n)=x_n,\forall n$.

$y_n\in I_2$ which is compact, so there must be a subsequesce $y_{n_k}$ that converges. Let $\lim_{k\to \infty}y_{n_k}=L$. 

Since $f$ is continuous, $f(L)=\lim_{k\to \infty} f(y_{n_k})=\lim_{k\to \infty}x_{n_k}=\lim x_n=a$. Also, $gf(L)=g(a)$.

So, $\lim g(x_n)=\lim gf(y_{n_k})=gf(L)=g(a)$, thanks to the continuity of $gf$. 

The result is that we establish the continuity of $g$ from the continuity of $f$ and $gf$. So $gf$ cannot be continuous.
Given that $g$ is discontinuous there exists $x_0 \in I_2$ and a sequence $(x_n)_{n \in \mathbb{N}} \subseteq I_2$ such that $\lim\limits_{n \to \infty}x_n = x_0$ and $g(x_0) \neq \lim\limits_{n \to \infty}g(x_n)$. Now let $y_0 \in f^{-1}(x_0)$ and for any $n \in \mathbb{N}$ let $y_n \in f^{-1}(x_n)$ be given. It follows
\begin{align*}
(g \circ f)(y) = g(x_0) \neq \lim\limits_{n \to \infty} g(x_n) = \lim\limits_{n \to \infty} (g \circ f)(y_n).
\end{align*}
We have therefore shown that $g\circ f$ is discontinuous at $y$.