diff --git a/gcc/web.c b/gcc/web.c
index ff91733..4b2ce36 100644
--- a/gcc/web.c
+++ b/gcc/web.c
@@ -123,7 +123,8 @@ union_match_dups (rtx insn, struct web_entry *def_entry,
 	if (DF_REF_LOC (*ref) == recog_data.operand_loc[op])
 	  break;
 
-      (*fun) (use_entry + DF_REF_ID (*dupref), entry + DF_REF_ID (*ref));
+      if (*ref)
+	(*fun) (use_entry + DF_REF_ID (*dupref), entry + DF_REF_ID (*ref));
     }
 }
 
