Let $\lambda$ denote the Lebesgue measure on $\mathcal B(\mathbb R)$ and $f\in\mathcal L^1_{\text{loc}}(\lambda)$ with $$\int\varphi f\:{\rm d}\lambda=0\;\;\;\text{for all }\varphi\in C_c(\mathbb R)\tag1.$$
I want to conclude that $\lambda$-a.e. $f=0$.
Let $\mu$ denote the measure with density $|f|$ with respect to $\lambda$. By assumption $$\mu(K)<\infty\;\;\;\text{for all compact }K\subseteq\mathbb R\tag2$$ and hence we know that $C_c(\mathbb R)$ is dense in $L^1(\mu)$. Now, let $(K_n)_{n\in\mathbb N}$ be a nondecreasing of compact subsets of $\mathbb R$ with $\bigcup_{n\in\mathbb N}K_n=\mathbb R$. Obviously, it's sufficent to conclude $\mu(K_n)=0$ for all $n\in\mathbb N$.
How can we show that?
We may observe that $$\int\varphi\operatorname{sgn}f\:{\rm d}\mu=\int\varphi f\:{\rm d}\lambda\;\;\;\text{for all }\varphi\in C_c(\mathbb R)\tag3.$$ Fix $n\in\mathbb N$. Clearly, $1_{K_n}\operatorname{sgn}f\in\mathcal L^1(\mu)$ and hence there is a $(\varphi_m)_{m\in\mathbb N}\subseteq C_c(\mathbb R)$ with $$\left\|\varphi_m-1_{K_n}\operatorname{sgn}f\right\|_{L^1(\mu)}\xrightarrow{m\to\infty}0\tag4.$$ The idea should be now to multiplicate $\varphi_m-1_{K_n}\operatorname{sgn}f$ by $\operatorname{sgn}f$ and use $(3)$. However, is this legitimate? And we only have $\operatorname{x}\operatorname{x}=1$ if $x\ne 0$, which could be problematic ...