X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 454553950C4D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1586689176; bh=FBGzD/d6MEHXAyzN1jIuylsOcPQtFZWW2PiZn2OBN2g=; h=References:In-Reply-To:Date:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=e3yg+BvSug+ogdfzWP/aBICAWob7BZHXgMfzjYbPT+wmEmhqDjBi1JtcILqwvqkbF ZpsKoFr4fKDi4Q1Y5Ayh1s/gHpq4g1JjaERPDZcEhK6jlcWTIWKcqmiwHJaAsRzSGR RjLaNaY6Lq4aJ9/cGeEmINQEPfWZeNGf1kXIAA8g= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org EB92E385DC2E X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=5In4hdevv3VZXERKrQqhFbdRls/jxlZv6Evhj+IuA6E=; b=E5Tg8pYDU/D98u6H6NroOII0ZIgZduZiHg5eSPcbRBKHHytzB5eWu3Ov1c83LoaCCF ujnMwL1yFF9/9kQ/bMCM+fTh/Vq/U+AkFAOwbVwfSh/LvJptkvcJNy9Ye47+2cvTGs0s I5AQ8UO0sGgLKDomVStTSEZjmuKJ5UJUwL0A/X9pMkT5zGb6CeMD2kvqMnbBWYdo53Os vPnK+BTg01QDFdLlK/XGYUukRVeV38ngkI6gxCkwr6GKn7cfXS0lLoFpl0Wb4z7dADV7 c5RgV/r/QKEnGdsfDr1w7RkEYO6mDURV1KLwmN/gxI0WuoupZzeaNCyFMGgRhUmNfsak 5EyQ== X-Gm-Message-State: AGi0PubV26XoJjJiMPvUaYvogR0G9rFe2AwHN4YL9dWOSI2Ff6sLYJOz yB9/C9rHqUKo3uDD4mLuhilgjq7rY58JpCn6v1u+GrT+ X-Google-Smtp-Source: APiQypJrJ2zGGDfSYp7E2c79D9NuniXFuieb8XpSg6BXrM5G4Rgk1OqQmHSyy0Hkhj0vLRZtjtoaOJlcwbt4+PBqdEI= X-Received: by 2002:a50:d90c:: with SMTP id t12mr11818550edj.357.1586689171642; Sun, 12 Apr 2020 03:59:31 -0700 (PDT) MIME-Version: 1.0 References: <53361671-369b-0fac-039c-65150ea859ac AT gmail DOT com> In-Reply-To: <53361671-369b-0fac-039c-65150ea859ac@gmail.com> Date: Sun, 12 Apr 2020 03:59:20 -0700 Message-ID: Subject: Re: g++ with -fprofile-dir flag has a bug (backslash instead of forward-slash issue) To: cygwin AT cygwin DOT com X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, HTML_MESSAGE, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.29 List-Id: General Cygwin discussions and problem reports List-Archive: List-Post: List-Help: List-Subscribe: , From: John Selbie via Cygwin Reply-To: John Selbie Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Cygwin" Sure, but this bug is unique to cygwin. Why would that be there bug? On Sun, Apr 12, 2020 at 2:57 AM JonY via Cygwin wrote: > On 4/12/20 7:27 AM, John Selbie via Cygwin wrote: > > TLDR: With gcc/g++ 9.2.0 and 9.30 on Cygwin, when you use > > -fprofile-generate and -fprofile-dir together, the target path for the > > .gcda file is corrupted with a backslash instead of having a forward > slash > > used. > > > > Here's a sample run where profile guided optimization is getting enabled > > for a simple little C++ program: > > > > jselbie AT IRONMAIDEN ~/bench > > $ g++ bench.cpp -o bench -fprofile-generate > > -fprofile-dir=/home/jselbie/bench/profile -O3 > > > > jselbie AT IRONMAIDEN ~/bench > > $ ./bench.exe > > > > profiling:/home/jselbie/bench/profile/#home#jselbie#bench\bench.gcda:Skip > > > > That "profiling...Skip" line is an error indicating that the profiling > > library can't save the gcda file. If you look closely,there's backslash > > between the encoded path and the filename (bench.gcda). > > > > Doing a strings search on the binary reveals the same thing: > > > > jselbie AT IRONMAIDEN ~/bench > > $ strings bench.exe | grep jselbie > > /home/jselbie/bench/profile/#home#jselbie#bench\bench.gcda > > > > If I switch back to Linux and do the same steps, it not only works, but > you > > can see there is no backslash embedded into the binary either > > > > jselbie AT IRONMAIDEN:~/bench$ g++ bench.cpp -o bench > -fprofile-generate > > -fprofile-dir=/home/jselbie/bench/profile -O3 > > > > jselbie AT IRONMAIDEN:~/bench$ ./bench > > > > jselbie AT IRONMAIDEN:~/bench$ ls profile/ > > bench.gcda > > > > jselbie AT IRONMAIDEN:~/bench$ strings bench | grep jselbie > > /home/jselbie/bench/profile/bench.gcda > > > > > > The workaround is to just skip the -fprofile-dir flag altogether. > > > > Seems like there is a bug in Cygwin's build of gcc/g++ that puts the > wrong > > path separator into the executable > > > > Can this be fixed? Or a place where I can file a bug? > > > > Try filing the issue on https://gcc.gnu.org/bugzilla/, include a minimal > test case that shows the problem, thanks. > > > -- > Problem reports: https://cygwin.com/problems.html > FAQ: https://cygwin.com/faq/ > Documentation: https://cygwin.com/docs.html > Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple > -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple