[LLVMbugs] [Bug 4506] New: clang incorrectly searches lib/clang/1.0/include/ before system headers

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Sun Jul 5 05:33:18 PDT 2009


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

           Summary: clang incorrectly searches lib/clang/1.0/include/ before
                    system headers
           Product: new-bugs
           Version: unspecified
          Platform: PC
        OS/Version: OpenBSD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: jsg at openbsd.org
                CC: llvmbugs at cs.uiuc.edu


Created an attachment (id=3154)
 --> (http://llvm.org/bugs/attachment.cgi?id=3154)
preprocessed output

clang seems to prefer $PREFIX/lib/clang/1.0/include to /usr/include 
leading to problems like clang stddef.h defining
typedef __typeof__(sizeof(int)) size_t;
where on OpenBSD i386/amd64 size_t is an unsigned long.

ie

#include <stdio.h>
#include <stddef.h>

int
main(void)
{
        return 0;
}

gives the preprocessed output shown in the attached file.
$ /usr/llvm/bin/clang -Wall -v test.c                                
clang version 1.0 (http://llvm.org/svn/llvm-project/cfe/trunk 74792)
Target: i386-unknown-openbsd4.6
Thread model: posix
 "/usr/llvm/bin/../libexec/clang-cc" -triple i386-unknown-openbsd4.6 -S
-disable-free -main-file-name test.c --relocati
on-model static --disable-fp-elim --unwind-tables=0 --mcpu=pentium4
--fmath-errno=1 -v -Wall -fdiagnostics-show-option 
-o /tmp/cc-TiXrxs.s -x c test.c
clang-cc version 1.0 based upon llvm 2.6svn hosted on i386-unknown-openbsd4.6
ignoring nonexistent directory "/System/Library/Frameworks"
ignoring nonexistent directory "/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
 /usr/llvm/lib/clang/1.0/include
 /usr/local/include
 /usr/include
End of search list.
In file included from test.c:2:
/usr/llvm/lib/clang/1.0/include/stddef.h:30:33: error: typedef redefinition
with different types
      ('typeof (sizeof(int))' (aka 'unsigned int') vs '__size_t' (aka 'unsigned
long'))
typedef __typeof__(sizeof(int)) size_t;
                                ^
In file included from test.c:1:
In file included from /usr/include/stdio.h:45:
/usr/include/sys/types.h:180:18: note: previous definition is here
typedef __size_t        size_t;
                        ^
2 diagnostics generated.

$ /usr/llvm/bin/llc -version
Low Level Virtual Machine (http://llvm.org/):
  llvm version 2.6svn
  DEBUG build with assertions.
  Built Jul  5 2009(13:30:51).

$ /usr/llvm/bin/clang -v
clang version 1.0 (http://llvm.org/svn/llvm-project/cfe/trunk 74792)
Target: i386-unknown-openbsd4.6
Thread model: posix


-- 
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