diff --git a/gcc/cobol/scan.l b/gcc/cobol/scan.l
index b3e55f9b06499b241e397b6a835a77f9297b0c76..12846708b74560c02f47b4a0a5fcc70d3be2ceb1 100644
--- a/gcc/cobol/scan.l
+++ b/gcc/cobol/scan.l
@@ -1839,7 +1839,7 @@ COPY		{
 			penultimate_once(final_token);
 			auto name = cobol_filename_restore();
 	   		if( yy_flex_debug ) warnx("restoring line %4d of %s",
-						  yylineno, name? name : "<none>g"); }
+						  yylineno, name? name : "<none>"); }
 }
 
 
diff --git a/gcc/cobol/scan_ante.h b/gcc/cobol/scan_ante.h
index d71b229657f351520d6b3df4e5a713084a8d266b..3fa4086c718c850b4ec84bd579a38d1334e35583 100644
--- a/gcc/cobol/scan_ante.h
+++ b/gcc/cobol/scan_ante.h
@@ -43,6 +43,19 @@
 #include "symbols.h"
 #include "copybook.h"
 
+/*
+ * Flex override
+ */
+static void /* yynoreturn */ yy_fatal_error ( const char* msg  );
+
+static void inline
+die_fatal_error( const char msg[] ) {
+  yyerrorv("scan.o: %s",  msg); 
+  yy_fatal_error(msg);
+}
+
+#define YY_FATAL_ERROR(msg) die_fatal_error((msg))
+
 /*
  * External functions
  */