Ping ---A bug with -fprofile-dir? Profile directory concatenated with object file path

2019-10-02 Thread Qing Zhao
Ping on:

https://gcc.gnu.org/ml/gcc-patches/2019-09/msg01554.html 


Anyway, I filed an gcc bug on this issue as:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91971 


If you think that this is NOT a bug, please let me know.

thanks.

Qing

A bug with -fprofile-dir? Profile directory concatenated with object file path

2019-09-26 Thread Qing Zhao
Hi,

we noticed that the profile directory will be concatenated with object file 
path.

the following small example explain this behavior:

[qinzhao@localhost small]$ cat t
#! /bin/bash
CC=/home/qinzhao/Install/latest/bin/gcc
opt="-O3 -fprofile-generate"
opt="$opt -fprofile-dir=/home/qinzhao/prof_dir" 
opt="$opt -c -o /home/qinzhao/obj_dir/t.o"
tf="t.c"

echo $CC $opt $tf
$CC $opt $tf
strings /home/qinzhao/obj_dir/t.o | grep prof_dir
[qinzhao@localhost small]$ sh t
/home/qinzhao/Install/latest/bin/gcc -O3 -fprofile-generate 
-fprofile-dir=/home/qinzhao/prof_dir -c -o /home/qinzhao/obj_dir/t.o t.c
/home/qinzhao/prof_dir//home/qinzhao/obj_dir/t.gcda
[qinzhao@localhost small]$ 


From the above, we can see:

when specifying the profiling directory with -fprofile-dir as 
“/home/qinzhao/prof_dir”,  the user expects that the profiling data will 
be stored in this specific directory.  However, GCC concatenates  the profiling 
directory “/home/qinzhao/prof_dir” with the path for the 
object file “/home/qinzhao/obj_dir” together. As a result, the profiling data 
will be stored to:

/home/qinzhao/prof_dir/home/qinzhao/obj_dir/

instead of 

/home/qinzhao/prof_dir

This looks like a bug to me.

any comment for this?

thank you!

Qing