Does somebody know a proof (or a reference) for the following statement:

Let $f:\mathbb{R} \rightarrow \mathbb{R}$ be an infinitely differentiable function. Suppose that for all $x$, $f^n(x)=0$ for almost all $n$ (i.e. for all but finitely many $n$), $f^n$ being the $n$-th derivative of $f$. Then $f$ is a polynomial function.

From what I remember, it is a result of Sunyer i Balaguer, and involves the use of Baire category theorem, but I cannot find any reference on the web.

Also, is the theorem still true if one replaces "almost all $n$" by "infinitely many $n$"?