$f\in L^1_{\textrm{loc}}(U)$ with $ \int_Ufg\ dx=0 $ for every $g\in C_c^\infty(U)$ implies $f=0$ a.e. 
Suppose $U$ is an open subset of $\mathbb{R}^n$, and $f:U\to\mathbb{R}$ is a measurable [Edited: locally integrable] function such that
  $$
\int_Ufg\ dx=0,\quad \textrm{for every } g\in C_c^\infty(U).
$$
   Then $f=0$ a.e.


Suppose otherwise $f\neq 0$ on some measurable subset $V$ of $U$ such that $V$ has positive Lebesgue measure. To get a contradiction, how shall I handle the sign of $f$ on $V$? 
[Added:] Could anyone come up with a handy theorem that gives the above proposition? 

[Added:] This argument is used in the proof of uniqueness of weak derivatives in Evans's Partial Differential Equations:

 A: When $f$ is locally integrable it suffices to show that $\int_R f=0$ for all bounded rectangles in $U$. Now there is a sequence $\psi_n \in C_c^\infty(R)$, $0\leq \psi_n\leq 1$ that converges to $1_R$ pointwise a.e.  So by dominated convergence
  $$ 0 = \int \psi_n f \rightarrow \int_R f $$ 
We used (among other things) that if ${\cal A}$ is a subalgebra (here the rectangles) that generate the Borel $\sigma$-algebra then the set of step functions over ${\cal A}$ is dense in $L^1(U)$.
More details on algebras: The set ${\cal R}$ consisting of finite union of rectangles form an algebra (it is stable under finite intersections, unions and differences). Any open set in ${\Bbb R}^n$ is a countable union of such. It follows that the smallest $\sigma$-algebra containing ${\cal R}$ is the Borel $\sigma$-algebra. Given a fixed rectangle $R$ and a measurable subset $Y\subset R$ we can find a sequence of step maps $\phi_n$ over ${\cal R}$ (i.e. sum of characteristic functions over rectangles) that converge a.e. (and in $L^1$) to $\chi_Y$. Repeating the above argument we conclude that $\int_Y f=0$ (for a proof regarding this approximation sequence, see e.g. Serge Lang, Real and Functional Analysis, section IV, corollary 6.4; or other books on integration theory).
