An alternative:
r.mapcalc temp=if(b,a,0)
/* keep a if b > 0; otherwise assign 0 (which means
"no-data" in a will be still "no-data" in temp) */
then
r.mapcalc result=a-temp
/* minus ZERO doesn't change anything. but the overlapped
area between a and b is 0 ("no-data") now. */
--Xin Zhuang
zhuang@access.digex.com