diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 46a89c220620aa56c64cf28cade3f3a5fc758576..a942946f2cdbc85342c384f535da8afde77afd8d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,8 @@
 2000-05-10  Zack Weinberg  <zack@wolery.cumb.org>
 
+	* cppexp.c (lex): Use %.*s to print non-NUL-terminated string.
+	Make error message friendlier.
+
 	* cpphash.h (struct hashnode): Use struct hack for name
 	member.
 	* cpphash.c (struct hashdummy): New.
diff --git a/gcc/cppexp.c b/gcc/cppexp.c
index 00eaea73aa251e6784be98131e6c10a8d093cbcb..7e99292f9a104534f93ae83d7a40498a410d0fad 100644
--- a/gcc/cppexp.c
+++ b/gcc/cppexp.c
@@ -466,8 +466,8 @@ lex (pfile, skip_evaluation)
 		&& tok_start[1] == toktab->operator[1])
 		break;
 	  if (toktab->token == ERROR)
-	    cpp_error (pfile, "'%s' not allowed in operand of #if",
-		       tok_start);
+	    cpp_error (pfile, "'%.*s' is not allowed in #if expressions",
+		       (int) (tok_end - tok_start), tok_start);
 	  op.op = toktab->token; 
 	  return op;
 	}
diff --git a/gcc/testsuite/gcc.dg/cpp-if4.c b/gcc/testsuite/gcc.dg/cpp-if4.c
new file mode 100644
index 0000000000000000000000000000000000000000..84764fbf0f62d93a2de0124b789aeb537880df59
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp-if4.c
@@ -0,0 +1,8 @@
+/* Regression test for proper error message.  The token name isn't
+   NUL terminated, so we would print garbage after it.  */
+/* { dg-do compile } */
+
+#if 1 += 2   /* { dg-error "'\\+=' is not allowed" "+= in if" } */
+syntax_error
+#endif
+int foo;