X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F13C6385DC2A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1586676485; bh=RBe8beGKctbtJLfMIyhlhlvPDVbPd3wJprFwKhfhgtk=; h=Date:Subject:To:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=oROIHb66GOxaeweZjNZN1XGu6H0CHTAUOKSNMACFj6p4tNOZkSi6jqFHTkKCASOUG b6U5q03jorvNd2yUomQ3mNv5PUWYuSWg0tmZ72PugMfHLlqSyqvKTmUXNXcG50SDLn o4WMZnXXhg4uoDsjl+6QrYM5H9hS3k1xxfocbtk8= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org DBFA3385DC0A X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=CxgOaVd39qZdg+HkRLY/27e4pKDEqKBp0QBfs+gvZDg=; b=ksyH/J1LpbQOU/f5NEGEOYrYpyNvgtq8NJxY2LWk+boEtsF4rN29D5fBY7D9hhjy59 +4mUHk/5+q7eUT5gnx/uvBvp6XqtQ7qTEIHBfZAassVYzibC3/67/6Ll1TX8NhQddFtW 2s36QZCktsezYajAENtHzCnRMPyekL68Ft+2tPVfT+74mtqDZrfiWf4ErBqVGLakDvZl Z2ux8wVfcfqxYnS0N3EDMsqrEsqvURQkvSYXmIJmSUfxBvEVzDqle1qL7MG/I9T2+c/O cwFI3s3iz4szK/ROh9bmOfjgnrXW+U4ob0FD06x4JD4Gq44MH48tSKXGa9MClv507Eoi em0g== X-Gm-Message-State: AGi0PuZX+E2o860EXbTMKUMpckif5rVb5yqwm7AXV4pusSEmc/MCK1Ug zm+VUrtb+RM64GpL/v7MymoEcTdDEMKKWwCCBKBTLIZezc0= X-Google-Smtp-Source: APiQypIXXA+mEeNy+2V1ZKSXAlAUWbtdIGdlmKxBo9j936N981uXTbz0h6F0rQYjprP04NFDVeFfzaF0/RVPOPWdnEE= X-Received: by 2002:a17:906:1584:: with SMTP id k4mr11399883ejd.355.1586676480047; Sun, 12 Apr 2020 00:28:00 -0700 (PDT) MIME-Version: 1.0 Date: Sun, 12 Apr 2020 00:27:49 -0700 Message-ID: Subject: 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=-3.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, HTML_MESSAGE, 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" 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? jrs -- 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