Counterexample to Tonelli's theorem
Solution 1:
Yes. Define $f_0(x,y)=\exp\left(\frac{1}{(x-1/2)^2+(y-1/2)^2-1/16}\right)$ whenever $\small (x-1/2)^2+(y-1/2)^2<1/16$ and $f_0=0$ otherwise. Then $f(x,y)=\sum_{k\ge 0} (k+1) (f_0(x-k,y-k)-f_0(x-k-1,y-k))$ should do, since $\int f dx=0$ for all $y$ thus $\int dy \int f dx=0$, but $f_y(x)=\int fdy$ is a nonnegative period $1$ function with positive integral in $x\in(k+1/4,k+3/4)$ for all $k\in \mathbb N$ thus $\int dx \int fdy=\infty$. Since $f_0\in C_c^\infty$ and $\text{supp}f\in [0,1]^2$, one trivially have $f\in C^\infty$.