diff --git a/gcc/cobol/symfind.cc b/gcc/cobol/symfind.cc
index 4b4deac1691de3ea600e5d7ab2cc4de39f6f075b..c31446c810054b05905a3511392df5d3487e3313 100644
--- a/gcc/cobol/symfind.cc
+++ b/gcc/cobol/symfind.cc
@@ -138,9 +138,8 @@ dump_symbol_map2( const field_key_t& key, const std::list<size_t>& candidates )
 
   for( auto candidate : candidates ) {
     char *tmp = fields;
-    asprintf(&fields, "%s%s %3zu", tmp? tmp : "", sep, candidate);
+    fields = xasprintf("%s%s %3zu", tmp? tmp : "", sep, candidate);
     sep[0] = ',';
-    assert(fields);
     free(tmp);
   }
 
@@ -171,9 +170,8 @@ dump_symbol_map_value( const char name[], const symbol_map_t::value_type& value
 
   for( ; p != value.second.end(); p++ ) {
     char *tmp = ancestry;
-    asprintf(&ancestry, "%s%s %3zu", tmp? tmp : "", sep, *p);
+    ancestry = xasprintf("%s%s %3zu", tmp? tmp : "", sep, *p);
     sep[0] = ',';
-    assert(ancestry);
     free(tmp);
   }
 
diff --git a/gcc/cobol/util.cc b/gcc/cobol/util.cc
index bd547aafe60f4f4dc5ff38cbf3679ebdbc313814..a91e1312613aaebd71a90f40a1b1e8c8cae9a855 100644
--- a/gcc/cobol/util.cc
+++ b/gcc/cobol/util.cc
@@ -2122,14 +2122,12 @@ yyerror( const char gmsgid[], ... ) {
 
 bool
 yywarn( const char gmsgid[], ... ) {
-  global_dc->begin_group();
+  auto_diagnostic_group d;
   va_list ap;
   va_start (ap, gmsgid);
-  rich_location richloc (line_table, token_location);
-  bool ret = global_dc->diagnostic_impl (&richloc, nullptr, option_id,
-					 gmsgid, &ap, DK_WARNING);
+  auto ret = emit_diagnostic_valist( DK_WARNING, token_location,
+				     option_id, gmsgid, &ap );
   va_end (ap);
-  global_dc->end_group();
   return ret;
 }
 
@@ -2319,6 +2317,7 @@ cbl_message(int fd, const char *format_string, ...)
 
 void
 cbl_internal_error(const char *gmsgid, ...) {
+  auto_diagnostic_group d;
   va_list ap;
   va_start(ap, gmsgid);
   emit_diagnostic_valist( DK_ICE, token_location, option_id, gmsgid, &ap );
@@ -2327,6 +2326,7 @@ cbl_internal_error(const char *gmsgid, ...) {
 
 void
 cbl_unimplementedw(const char *gmsgid, ...) {
+  auto_diagnostic_group d;
   va_list ap;
   va_start(ap, gmsgid);
   emit_diagnostic_valist( DK_SORRY, token_location, option_id, gmsgid, &ap );
@@ -2335,6 +2335,7 @@ cbl_unimplementedw(const char *gmsgid, ...) {
 
 void
 cbl_unimplemented(const char *gmsgid, ...) {
+  auto_diagnostic_group d;
   va_list ap;
   va_start(ap, gmsgid);
   emit_diagnostic_valist( DK_SORRY, token_location, option_id, gmsgid, &ap );
@@ -2349,6 +2350,7 @@ cbl_unimplemented(const char *gmsgid, ...) {
 
 void
 cbl_err(const char *fmt, ...) {
+  auto_diagnostic_group d;
   char *gmsgid = xasprintf("%m: %s", fmt);
   va_list ap;
   va_start(ap, fmt);
@@ -2361,6 +2363,7 @@ cbl_err(const char *fmt, ...) {
 
 void
 cbl_errx(const char *gmsgid, ...) {
+  auto_diagnostic_group d;
   va_list ap;
   va_start(ap, gmsgid);
   emit_diagnostic_valist( DK_FATAL, token_location, option_id, gmsgid, &ap );