From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 82107 invoked by alias); 20 Jun 2018 11:54:56 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 82097 invoked by uid 89); 20 Jun 2018 11:54:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_PASS autolearn=ham version=3.3.2 spammy=HContent-Transfer-Encoding:8bit X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 20 Jun 2018 11:54:54 +0000 Received: from relay1.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id F2C3BADE3; Wed, 20 Jun 2018 11:54:51 +0000 (UTC) Subject: Re: [PATCH] When using -fprofile-generate=/some/path mangle absolute path of file (PR lto/85759). From: =?UTF-8?Q?Martin_Li=c5=a1ka?= To: Jakub Jelinek , Martin Sebor Cc: GCC Patches , Richard Biener , Jan Hubicka References: <41f0b7e4-1a6b-3f5e-1e3a-750502e73043@suse.cz> <08c9b11b-6420-f056-ae27-38394662deca@gmail.com> <20171220174525.GK2353@tucnak> <3b996c3b-6dc5-12d3-26bf-0aa27977dc66@suse.cz> Message-ID: Date: Wed, 20 Jun 2018 11:54:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2018-06/txt/msg01220.txt.bz2 PING^1 On 05/16/2018 01:53 PM, Martin Liška wrote: > On 12/21/2017 10:13 AM, Martin Liška wrote: >> On 12/20/2017 06:45 PM, Jakub Jelinek wrote: >>> Another thing is that the "/" in there is wrong, so >>> const char dir_separator_str[] = { DIR_SEPARATOR, '\0' }; >>> char *b = concat (profile_data_prefix, dir_separator_str, pwd, NULL); >>> needs to be used instead. >> >> This looks much nicer, I forgot about DIR_SEPARATOR. >> >>> Does profile_data_prefix have any dir separators stripped from the end? >> >> That's easy to achieve.. >> >>> Is pwd guaranteed to be relative in this case? >> >> .. however this is absolute path, which would be problematic on a DOC based FS. >> Maybe we should do the same path mangling as we do for purpose of gcov: >> >> https://github.com/gcc-mirror/gcc/blob/master/gcc/gcov.c#L2424 > > Hi. > > I decided to implement that. Which means for: > > $ gcc -fprofile-generate=/tmp/myfolder empty.c -O2 && ./a.out > > we get following file: > /tmp/myfolder/#home#marxin#Programming#testcases#tmp#empty.gcda > > That guarantees we have a unique file path. As seen in the PR it > can produce a funny ICE. > > I've been testing the patch. > Ready after it finishes tests? > > Martin > >> >> What do you think about it? >> Regarding the string manipulation: I'm not an expert, but work with string in C >> is for me always a pain :) >> >> Martin >> >