From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 329B9385DC06; Wed, 15 Apr 2020 08:32:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 329B9385DC06 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1586939535; bh=kBR6FyITwCOwQ6g7BgdO5XSiCwL3jwzlEPY6VzUPkIY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=LL7HMqdLphDWwvrRkUht0z8N40Khu6FpvdXKyCWVMhWmVQc9mYkcncyNbQB7VRZ4W ZGzZr5whaQlTOFj27guQyLTDxDYbmIPF3i9y7U6GoGiIzGF1BYS1/wB1paVDqmavUx vOvb4+ofKxWPFJPt82UTQZxSRfFuNHQmX3apKSSc= From: "john at selbie dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug gcov-profile/94570] -fprofile-dir is broken on Cygwin Date: Wed, 15 Apr 2020 08:32:15 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: gcov-profile X-Bugzilla-Version: 9.3.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: john at selbie dot com X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: marxin at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Apr 2020 08:32:15 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94570 --- Comment #3 from John Selbie --- I am not sure I agree. But I do defer to your expertise. The problem is that Cygwin is not really a DOS_BASED_FILE_SYSTEM. It's emulating Unix - including using forward-slashes everywhere. So I don't kn= ow why it's trying to embed backslashes in the code. Wouldn't the fix be this: @@ -1215,7 +1215,7 @@ coverage_init (const char *filename) of filename in order to prevent file path clashing. */ if (profile_data_prefix) { -#if HAVE_DOS_BASED_FILE_SYSTEM +#if HAVE_DOS_BASED_FILE_SYSTEM && !CYGWIN const char *separator =3D "\\"; #else const char *separator =3D "/"; There's so reason to use backslashes at all, even for native Win32. Windows= and DOS can't handle forward slashes at the command line, but absolutely can ha= ndle paths with forward slashes in code. So an even simpler fix: @@ -1215,12 +1215,7 @@ 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 =3D "\\"; -#else - const char *separator =3D "/"; -#endif - filename =3D concat (getpwd (), separator, filename, NULL); + filename =3D concat (getpwd (), "/", filename, NULL); filename =3D mangle_path (filename); len =3D strlen (filename); } But even then I'm skeptical. I had "hacked the binary" with a hex editor to change the backslash to a forward slash. Same error, even though the modif= ied path appears on the screen: profiling:profile/#home#jselbie#bench/anyprogram.gcda:Skip I even hacked it the other way to use forward slashes more consistently. S= ame thing: profiling:profile\#home#jselbie#bench\anyprogram.gcda:Skip So while I think forward-slash consistency is a key. It's not the only bug preventing the -fprofile-dir flag to work.=