  In this paper we prove a higher differentiability result for the solutions to
a class of obstacle problems in the form
  \begin{equation*} \label{obst-def0} \min\left\{\int_\Omega F(x,Dw) dx : w\in
\mathcal{K}_{\psi}(\Omega)\right\} \end{equation*} where $\psi\in
W^{1,p(x)}(\Omega)$ is a fixed function called obstacle and
$\mathcal{K}_{\psi}=\{w \in W^{1,p(x)}_{0}(\Omega)+u_0: w \ge \psi \,\,
\textnormal{a.e. in $\Omega$}\}$ is the class of the admissible functions, for
a suitable boundary value $ u_0 $. We deal with a convex integrand $F$ which
satisfies the $p(x)$-growth conditions
\begin{equation*}\label{growth}|\xi|^{p(x)}\le F(x,\xi)\le
C(1+|\xi|^{p(x)}),\quad p(x)>1 \end{equation*}
