This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/14291] New: -fprofile-arcs fails (unresolved symbol)


C:\devel\gcc\testsuite>gcc -fprofile-arcs -o test test.c
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/ccE7aaaa.o(.text+0x38):test.c: undefined 
reference to `ftruncate'

The following patch correct the issue :

diff -u5 -rNdw gcc-cvs/gcc/gcc/gcov-io.h src/gcc/gcov-io.h
--- gcc-cvs/gcc/gcc/gcov-io.h	Fri Oct 10 17:04:45 2003
+++ src/gcc/gcov-io.h	Tue Feb 24 09:25:16 2004
@@ -585,11 +585,17 @@
 }
 
 static inline void
 gcov_truncate (void)
 {
+#ifndef __MINGW32__
   ftruncate (fileno (gcov_var.file), 0L);
+#else
+  /* ftruncate() is not available in msvcrt */
+  fpos_t pos = 0L;
+  fsetpos(gcov_var.file, &pos);
+#endif
 }
 #endif
 
 #endif /* IN_LIBGCOV >= 0 */
 
But maybe adding ftruncate to libiberty is preferable.

-- 
           Summary: -fprofile-arcs fails (unresolved symbol)
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: xtrochu at yahoo dot com
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: i686-pc-mingw32


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]