diff --git a/gcc/cobol/genapi.cc b/gcc/cobol/genapi.cc
index 5951f2f50e967c4a4720af8e0fbd435691f80da6..140d1f88638841ba6c8c957fc97c4727865c6cd5 100644
--- a/gcc/cobol/genapi.cc
+++ b/gcc/cobol/genapi.cc
@@ -15090,8 +15090,8 @@ move_helper(tree size_error,        // This is an INT
 
   static tree stash = gg_define_variable(UCHAR_P, "..mh_stash", vs_file_static);
 
-  tree st_data;
-  tree st_size;
+  tree st_data = NULL_TREE;
+  tree st_size = NULL_TREE;
 
   if( restore_on_error )
     {
diff --git a/gcc/cobol/util.cc b/gcc/cobol/util.cc
index 662a17ca8c42b47296d651021a03eff8a70f4c6c..141ce1dbb1bb6a3d2c553e2ef5ed20dcc326e815 100644
--- a/gcc/cobol/util.cc
+++ b/gcc/cobol/util.cc
@@ -1985,14 +1985,17 @@ class unique_stack : public std::stack<input_file_t>
     }
     size_t n = c.size();
     if( n > 1 || yydebug ) {
-      static char wd[PATH_MAX];
-      getcwd(wd, sizeof(wd));
-      warnx( "depth line copybook filename\n"
-             "        "
-             "----- ---- --------"
-             "----------------------------------------");
-      for( const auto& v : c ) {
-        warnx( " %4zu %4d %s", c.size() - --n, v.lineno, no_wd(wd, v.name) );
+      char *wd = get_current_dir_name();
+      if( wd ) {
+	warnx( "depth line copybook filename\n"
+	       "        "
+	       "----- ---- --------"
+	       "----------------------------------------");
+	for( const auto& v : c ) {
+	  warnx( " %4zu %4d %s", c.size() - --n, v.lineno, no_wd(wd, v.name) );
+	}
+      } else {
+	warnx("warning: %s:%d: %m", __func__, __LINE__);
       }
     }
     return false;