updated for version 7.0c12
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index bf03721..790b30e 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -4287,6 +4287,13 @@
     if (eap->skip)	    /* not executing commands, only parsing */
 	return;
 
+    if (!do_count && !curbuf->b_p_ma)
+    {
+	/* Substitusion is not allowed in non-'modifiable' buffer */
+	EMSG(_(e_modifiable));
+	return;
+    }
+
     if (search_regcomp(pat, RE_SUBST, which_pat, SEARCH_HIS, &regmatch) == FAIL)
     {
 	if (do_error)