It can be proven that
$X \equiv \{f \in {\cal C}^\infty_0(\mathbb R) \ | \ \exists \ g \in {\cal C}^\infty_0(\mathbb R)$ that verifies $ g' = f \}$ is isomorphic to $Y \equiv \{ f \in {\cal C}^\infty_0 (\mathbb R)\ | \ \int_\mathbb R f \ dx = 0\}$
so, in other words
Every derivative of a compactly supported function is compactly supported if and only if it's odd.
Question. Is there an example of a compactly supported function whose derivative is not compactly supported?
Having integral equal to $0$ is not what I would call "being odd": a function $f$ is odd if and only if $f(-x)=-f(x)$ for all $x\in\Bbb R$.
A function with compact support - say, such that it's constant $0$ on $U=(-\infty,a)\cup (b,\infty)$ - will have zero derivative on $U$ (regardless of the overall regularity of the function itself). Therefore, the derivative of a compactly supported differentiable function is compactly supported.