[LLVMbugs] [Bug 5365] New: __attribute__ ((__transparent_union__)) implementation is incomplete

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Sun Nov 1 15:49:03 PST 2009


http://llvm.org/bugs/show_bug.cgi?id=5365

           Summary: __attribute__ ((__transparent_union__)) implementation
                    is incomplete
           Product: clang
           Version: 2.6
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: harriman at acm.org
                CC: clattner at apple.com, llvmbugs at cs.uiuc.edu,
                    edwintorok at gmail.com, sharparrow1 at yahoo.com,
                    daniel at zuster.org, krj at rajaratnam.dk, dgregor at apple.com
        Depends on: 2015


Created an attachment (id=3738)
 --> (http://llvm.org/bugs/attachment.cgi?id=3738)
test case - works with gcc, error with clang

The fix for Bug #2015 implemented one aspect of 
__attribute__((__transparent_union__)); however, this test case shows that
clang still does not fully implement the gcc semantics.

  typedef union { struct s *sp; } u __attribute__ ((__transparent_union__));
  extern void g(u);
  extern void g(struct s *sp);

The above code is accepted by gcc, but rejected by clang, like this:

  clang -c clang091101a.c
  clang091101a.c:3:13: error: conflicting types for 'g'
  extern void g(struct s *sp);
              ^
  clang091101a.c:2:13: note: previous declaration is here
  extern void g(u);
              ^

The incompatibility causes trouble with the Gnu Autoconf macro
AC_SELECT_ARGTYPES, which attempts to determine suitable types
for definition of variables to be passed to the select() function.
The Autoconf macro guesses at the parameter types and tries to 
redeclare select().  If the compiler rejects the redeclaration, 
then the macro concludes that those types can't be passed to
select().  With clang, all of the guesses fail.  

The same technique is used in some other Autoconf macros and scripts.
For example, when trying to build PostgreSQL 8.4 on RHEL 5 Linux with
clang, the autoconf-generated 'configure' script fails because of this.


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list