diff --git a/ChangeLog b/ChangeLog
index 6605beb206b5d8f07e0c244a3083ea4ee118b8e5..6cbf28a7f2985eb74dae30d183035ba8798ba377 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2020-04-17  Martin Liska  <mliska@suse.cz>
+	    Jonathan Yong <10walls@gmail.com>
+
+	PR gcov-profile/94570
+	* ltmain.sh: Do not define HAVE_DOS_BASED_FILE_SYSTEM
+	for CYGWIN.
+
 2020-04-14  Martin Jambor  <mjambor@suse.cz>
 
 	* MAINTAINERS (Reviewers): Add myself as callgraph (IPA) reviewer.
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 53413e7b9437dd9eeac83ab7272d2a7436ae81a5..80a37618d75346943c6a85ac84143aab8cd262d0 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2020-04-17  Martin Liska  <mliska@suse.cz>
+	    Jonathan Yong <10walls@gmail.com>
+
+	PR gcov-profile/94570
+	* coverage.c (coverage_init): Use separator properly.
+
 2020-04-16  Peter Bergner  <bergner@linux.ibm.com>
 
 	PR rtl-optimization/93974
diff --git a/gcc/coverage.c b/gcc/coverage.c
index 45c0278f44f883b8d87121ea8ee983660f459107..7d82e44c1524c001b670574a814d387d6c4ea889 100644
--- a/gcc/coverage.c
+++ b/gcc/coverage.c
@@ -1200,6 +1200,11 @@ coverage_obj_finish (vec<constructor_elt, va_gc> *ctor)
 void
 coverage_init (const char *filename)
 {
+#if HAVE_DOS_BASED_FILE_SYSTEM
+  const char *separator = "\\";
+#else
+  const char *separator = "/";
+#endif
   int len = strlen (filename);
   int prefix_len = 0;
 
@@ -1216,11 +1221,6 @@ coverage_init (const char *filename)
 	 of filename in order to prevent file path clashing.  */
       if (profile_data_prefix)
 	{
-#if HAVE_DOS_BASED_FILE_SYSTEM
-	  const char *separator = "\\";
-#else
-	  const char *separator = "/";
-#endif
 	  filename = concat (getpwd (), separator, filename, NULL);
 	  if (profile_prefix_path)
 	    {
@@ -1252,7 +1252,7 @@ coverage_init (const char *filename)
   if (profile_data_prefix)
     {
       memcpy (da_file_name, profile_data_prefix, prefix_len);
-      da_file_name[prefix_len++] = '/';
+      da_file_name[prefix_len++] = *separator;
     }
   memcpy (da_file_name + prefix_len, filename, len);
   strcpy (da_file_name + prefix_len + len, GCOV_DATA_SUFFIX);
diff --git a/include/ChangeLog b/include/ChangeLog
index ce2297a1eb42d84421d31565d89adaaa3153a702..bbfd6a674cfed4efffd946e72e9e7e20aab9aa17 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,3 +1,10 @@
+2020-04-17  Martin Liska  <mliska@suse.cz>
+	    Jonathan Yong <10walls@gmail.com>
+
+	PR gcov-profile/94570
+	* filenames.h (defined): Do not define HAVE_DOS_BASED_FILE_SYSTEM
+	for CYGWIN.
+
 2020-04-01 Maciej W. Rozycki <macro@linux-mips.org>
 
 	PR lto/94249
diff --git a/include/filenames.h b/include/filenames.h
index 1ed441221ac2122c2735ece829a63fdab5523e68..fcde22767de2a8aa57b5e89e5d799a524674e860 100644
--- a/include/filenames.h
+++ b/include/filenames.h
@@ -32,7 +32,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
 extern "C" {
 #endif
 
-#if defined(__MSDOS__) || defined(_WIN32) || defined(__OS2__) || defined (__CYGWIN__)
+#if defined(__MSDOS__) || (defined(_WIN32) && ! defined(__CYGWIN__)) || \
+    defined(__OS2__)
 #  ifndef HAVE_DOS_BASED_FILE_SYSTEM
 #    define HAVE_DOS_BASED_FILE_SYSTEM 1
 #  endif
diff --git a/ltmain.sh b/ltmain.sh
index 79f9ba89af5e3553359f3b16c65371cf138fd8d8..70990740b6c4719bc9393036ed2e94196daff86f 100644
--- a/ltmain.sh
+++ b/ltmain.sh
@@ -3425,8 +3425,8 @@ int setenv (const char *, const char *, int);
 # define PATH_SEPARATOR ':'
 #endif
 
-#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
-  defined (__OS2__)
+#if (defined (_WIN32) && ! defined(__CYGWIN__)) || defined (__MSDOS__) || \
+  defined (__DJGPP__) || defined (__OS2__)
 # define HAVE_DOS_BASED_FILE_SYSTEM
 # define FOPEN_WB "wb"
 # ifndef DIR_SEPARATOR_2