According to the GCC manual -fprofile-generate is equivalent to:

  -fprofile-arcs -fprofile-values -fvpt

Similarly -fprofile-use is equivalent to:

  -fbranch-probabilities -fvpt -funroll-loops -fpeel-loops -ftracer

However if I use -fprofile-generate the .gcda/.gcno files are not generated in
the local directory, but only with process number specific names in ~/.ccache.
Similarly if I use -fprofile-use, it searches unsuccessfully in ~/.ccache.

However if I use the explicit sets of component flags, the .gcda/.gcno files
are created in the correct place and subsequently found correctly.

The attached is a tiny (two source file) program and script which demonstrates
this Use this script as follows:
1) ./script -fprofile-generate
2) ./script -fprofile-arcs -fprofile-values -fvpt

Observe that these should be equivalent, but only 2) generates the .gcda and
.gcno files in the correct place. 1) generates them in ~/.ccache with names
derived from process numbers.

Having run 2), try:
3) ./script -fprofile-use
4) ./script -fbranch-probabilities -fvpt -funroll-loops -fpeel-loops -ftracer

Observe that these should be equivalent, but 3) looks in the wrong place
(~/.ccache) for the profile data.

I feel this is such an obvious problem that it should have been already
reported, or I am missing something in the user manual. However an afternoon's
searching has been fruitless. Perhaps it is a peculiarity of GCC 4.3.0 on
Fedora 9.

Platform details (uname -a):

Linux thomas 2.6.27.12-78.2.8.fc9.i686 #1 SMP Mon Jan 19 20:14:35 EST 2009 i686
i686 i386 GNU/Linux

Compiler details (gcc -v):

Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla
--enable-bootstrap --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk
--disable-dssi --enable-plugin
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre
--enable-libgcj-multifile --enable-java-maintainer-mode
--with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib
--with-cpu=generic --build=i386-redhat-linux
Thread model: posix
gcc version 4.3.0 20080428 (Red Hat 4.3.0-8) (GCC)


-- 
           Summary: -fprofile-generate and -fprofile-use are not equivalent
                    to their component flags. Get directories wrong
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: gcov-profile
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jeremy at jeremybennett dot com
 GCC build triplet: i386-redhat-linux
  GCC host triplet: i386-redhat-linux
GCC target triplet: i386-redhat-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39220

Reply via email to