the composition of two functions that have primitives has primitives 
It is common sense that the composition of two continuous
functions is continuous.
It is also widely known that the composition of two derivable
functions is derivable.

Is it true that the composition of two functions that have primitives has primitives?
If it is true that I would be grateful to have a demonstration, otherwise, if it is false then I need a counterexample.
Note: the two functions are defined over $\mathbb R$.
 A: Take $g(x) = x^2$, which clearly has a primitive.  If the assertion were true then for any function $f$ with a primitive it would follow that $g\circ f = f^2$ would have a primitive.
A counterexample is given by
$$f(x) = \begin{cases}\sin(x^{-1}), & 0 < x \leqslant   1 \\ 0, & x= 0 \end{cases}$$
which has a primitive $F(x) = \int_0^x \sin (t^{-1}) \, dt$ since $F'(x) = \sin (x^{-1})$ for all $0 < x \leqslant 1$ by the FTC and it can be shown that
$$F'(0) = \lim_{x \to 0+}\frac{1}{x} \int_0^x \sin (t^{-1}) \, dt = 0$$
However,
$$f^2(x) =\begin{cases}\sin^2(x^{-1}) , & 0 < x \leqslant   1 \\ 0, & x= 0 \end{cases}$$
and it can be shown that $f^2$ does not have a primitive using a similar argument as given here.
A: Suppose f is a bounded derivative,  and g is strictly convex. Then gof will be a derivative if and only if  f is approximately continuous.[1].
Thus , for f(x)= sin(1/x)+2, (f(0)=2), neither f^2 nor 1/f will be a derivative.
[1]Differentiation of Real functions,CRM Monograph Series, vol. 5
Ch.9 , Thm.4.3
