[Bug other/15174] New: [tree-ssa] libmudflap doesn't compile on Tru64 UNIX

gcc-bugzilla at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Tue Apr 27 19:17:00 GMT 2004


Even after the fix for c/14589

     http://gcc.gnu.org/ml/gcc-patches/2004-04/msg01046.html

a tree-ssa bootstrap on alpha-dec-osf4.0f fails in libmudflap:

$ /vol/gcc/obj/gcc-3.5-tree-ssa-20040416/4.0f-gcc/gcc/xgcc -B/vol/gcc/obj/gcc-3.5-tree-ssa-20040416/4.0f-gcc/gcc/ -B/vol/gcc/share/alpha-dec-osf4.0f/bin/ -B/vol/gcc/share/alpha-dec-osf4.0f/lib/ -isystem /vol/gcc/share/alpha-dec-osf4.0f/include -isystem /vol/gcc/share/alpha-dec-osf4.0f/sys-include -DHAVE_CONFIG_H -I. -I/vol/gnu/src/gcc/gcc-tree-ssa-dist/libmudflap -I. -O2 -g -O2 -mieee -Wall -O2 -g -O2 -mieee -Wp,-MD,.deps/mf-runtime.pp -c /vol/gnu/src/gcc/gcc-tree-ssa-dist/libmudflap/mf-runtime.c -o mf-runtime.o
In file included from /vol/gnu/src/gcc/gcc-tree-ssa-dist/libmudflap/mf-impl.h:41,
                 from /vol/gnu/src/gcc/gcc-tree-ssa-dist/libmudflap/mf-runtime.c:68:
/vol/gcc/obj/gcc-3.5-tree-ssa-20040416/4.0f-gcc/gcc/include/pthread.h:877: error: field `_Pfield' declared as a function
[...]

This happens due to what seems to be a fundamental problem in libmudflap:
currently, mf-runtime.c (and several other files) include a long list of
various feature macros to enable many API definitions on various platforms.

I fear this is fundamentally flawed (at least for the platforms I know
about): with very few exceptions, when not defining any feature test
macros, you get all API definitions available on the platform that don't
conflicts (or where different standards don't prescribe different
signatures).  As soon as you start defining feature test macros, the set of
API definitions is restricted to what is prescribed by those standards.
Those sets are often different on various platforms.

E.g. on Tru64 UNIX, when I remove all the feature test macros in
mf-runtime.c, the file compiles cleanly.

The following hacky patch allowed me to compile all of libmudflag on Tru64
UNIX V4.0F.  I call it hacky for two reasons: 

* I don't like the fundamental approach.  It seems to be much cleaner to
  leave the feature test macros undefined and only define them on platforms
  where they are known to be necessary, with a comment why they are
  necessary.  An example of this is the definition of _POSIX_PII_SOCKET in
  mf-hooks2.c: it is necessary to get a definition of recvfrom (and others)
  that uses socklen_t instead of int for the address_len parameter, as
  required by libmudflap.  Of course this should be commented appropriately
  and only activated if __osf__ or (better) if found necessary by an
  autoconf test.

* The duplication of those lists of feature test macros in mf-hooks*.c and
  mf-runtime.c is a considerable maintenance burden.  They should be
  consolidated in one place instead.

Index: libmudflap/mf-hooks1.c
===================================================================
RCS file: /vol/gnu/src/gcc/.gcc-cvs/gcc/libmudflap/Attic/mf-hooks1.c,v
retrieving revision 1.1.2.7
diff -u -p -r1.1.2.7 mf-hooks1.c
--- libmudflap/mf-hooks1.c	20 Mar 2004 12:33:41 -0000	1.1.2.7
+++ libmudflap/mf-hooks1.c	19 Apr 2004 22:56:15 -0000
@@ -39,9 +39,10 @@ Software Foundation, 59 Temple Place - S
 
 /* These attempt to coax various unix flavours to declare all our
    needed tidbits in the system headers.  */
-#if !defined(__FreeBSD__)  && !defined(__APPLE__)
+#if !defined(__FreeBSD__)  && !defined(__APPLE__) && !defined(__osf__)
 #define _POSIX_SOURCE
 #endif /* Some BSDs break <sys/socket.h> if this is defined. */
+#if !defined(__osf__)
 #define _GNU_SOURCE 
 #define _XOPEN_SOURCE
 #define _BSD_TYPES
@@ -49,6 +50,7 @@ Software Foundation, 59 Temple Place - S
 #define _ALL_SOURCE
 #define _LARGE_FILE_API
 #define _XOPEN_SOURCE_EXTENDED 1
+#endif
 
 #include <string.h>
 #include <stdio.h>
Index: libmudflap/mf-hooks2.c
===================================================================
RCS file: /vol/gnu/src/gcc/.gcc-cvs/gcc/libmudflap/Attic/mf-hooks2.c,v
retrieving revision 1.1.2.9
diff -u -p -r1.1.2.9 mf-hooks2.c
--- libmudflap/mf-hooks2.c	20 Mar 2004 12:33:41 -0000	1.1.2.9
+++ libmudflap/mf-hooks2.c	19 Apr 2004 23:00:54 -0000
@@ -38,9 +38,10 @@ Software Foundation, 59 Temple Place - S
 
 /* These attempt to coax various unix flavours to declare all our
    needed tidbits in the system headers.  */
-#if !defined(__FreeBSD__) && !defined(__APPLE__)
+#if !defined(__FreeBSD__) && !defined(__APPLE__) && !defined(__osf__)
 #define _POSIX_SOURCE
 #endif /* Some BSDs break <sys/socket.h> if this is defined. */
+#if !defined(__osf__)
 #define _GNU_SOURCE 
 #define _XOPEN_SOURCE
 #define _BSD_TYPES
@@ -48,6 +49,8 @@ Software Foundation, 59 Temple Place - S
 #define _ALL_SOURCE
 #define _LARGE_FILE_API
 #define _XOPEN_SOURCE_EXTENDED 1
+#endif
+#define _POSIX_PII_SOCKET
 
 #include <string.h>
 #include <strings.h>
Index: libmudflap/mf-hooks3.c
===================================================================
RCS file: /vol/gnu/src/gcc/.gcc-cvs/gcc/libmudflap/Attic/mf-hooks3.c,v
retrieving revision 1.1.2.7
diff -u -p -r1.1.2.7 mf-hooks3.c
--- libmudflap/mf-hooks3.c	20 Mar 2004 12:33:41 -0000	1.1.2.7
+++ libmudflap/mf-hooks3.c	19 Apr 2004 22:54:22 -0000
@@ -38,9 +38,10 @@ Software Foundation, 59 Temple Place - S
 
 /* These attempt to coax various unix flavours to declare all our
    needed tidbits in the system headers.  */
-#if !defined(__FreeBSD__) && !defined(__APPLE__)
+#if !defined(__FreeBSD__) && !defined(__APPLE__) && !defined(__osf__)
 #define _POSIX_SOURCE
 #endif /* Some BSDs break <sys/socket.h> if this is defined. */
+#if !defined(__osf__)
 #define _GNU_SOURCE 
 #define _XOPEN_SOURCE
 #define _BSD_TYPES
@@ -48,6 +49,7 @@ Software Foundation, 59 Temple Place - S
 #define _ALL_SOURCE
 #define _LARGE_FILE_API
 #define _XOPEN_SOURCE_EXTENDED 1
+#endif
 
 #include <string.h>
 #include <stdio.h>
Index: libmudflap/mf-runtime.c
===================================================================
RCS file: /vol/gnu/src/gcc/.gcc-cvs/gcc/libmudflap/Attic/mf-runtime.c,v
retrieving revision 1.1.2.49
diff -u -p -r1.1.2.49 mf-runtime.c
--- libmudflap/mf-runtime.c	20 Mar 2004 12:33:41 -0000	1.1.2.49
+++ libmudflap/mf-runtime.c	19 Apr 2004 22:49:44 -0000
@@ -33,9 +33,10 @@ Software Foundation, 59 Temple Place - S
 
 /* These attempt to coax various unix flavours to declare all our
    needed tidbits in the system headers.  */
-#if !defined(__FreeBSD__)
+#if !defined(__FreeBSD__) && !defined(__osf__)
 #define _POSIX_SOURCE
 #endif /* Some BSDs break <sys/socket.h> if this is defined. */
+#if !defined(__osf__)
 #define _GNU_SOURCE 
 #define _XOPEN_SOURCE
 #define _BSD_TYPES
@@ -43,6 +44,7 @@ Software Foundation, 59 Temple Place - S
 #define _ALL_SOURCE
 #define _LARGE_FILE_API
 #define _XOPEN_SOURCE_EXTENDED 1
+#endif
 
 #include <stdio.h>
 #include <stdlib.h>

Anyway, I won't push this patch (or even an improved version thereof)
because it is useless: currently there's no way libmudflap can be used on
Tru64 UNIX since the native ld doesn't support the --wrap option.  I'll
report this problem separately.

Environment:
System: OSF1 rimsky V4.0 1229 alpha
Machine: alpha
	
host: alpha-dec-osf4.0f
build: alpha-dec-osf4.0f
target: alpha-dec-osf4.0f
configured with: /vol/gnu/src/gcc/gcc-tree-ssa-dist/configure --prefix=/vol/gcc --with-local-prefix=/vol/gcc --disable-nls --enable-languages=c++,java,objc --host alpha-dec-osf4.0f --build alpha-dec-osf4.0f --target alpha-dec-osf4.0f

How-To-Repeat:
Bootstrap the tree-ssa branch as above.

-- 
           Summary: [tree-ssa] libmudflap doesn't compile on Tru64 UNIX
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ro at techfak dot uni-bielefeld dot de
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: alpha-dec-osf4.0f
  GCC host triplet: alpha-dec-osf4.0f
GCC target triplet: alpha-dec-osf4.0f


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



More information about the Gcc-bugs mailing list