[LLVMbugs] [Bug 3592] New: GCC warning is clang error, implicitly defined functions and different signature in the source file.

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Mon Feb 16 01:27:43 PST 2009


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

           Summary: GCC warning is clang error, implicitly defined functions
                    and different signature in the source file.
           Product: clang
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Semantic Analyzer
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: bolzoni at cs.unipr.it
                CC: llvmbugs at cs.uiuc.edu, bagnara at cs.unipr.it


Here a test case:
------>
static void* malloc(int);
static void* malloc(int size) {
  return ((void*)0); /*do not use heap in this file*/
}
------<
until I do not include stdlib.h we have:
$ gcc -c mall.c
mall.c:2: warning: conflicting types for built-in function ‘malloc’
$ clang mall.c 
mall.c:2:14: error: conflicting types for 'malloc'
static void* malloc(int);
             ^
mall.c:2:14: note: 'malloc' was implicitly declared here with type 'void
*(unsigned long)'
2 diagnostics generated.
$ 

While clang has this behaviour since long time, it seems sometime after r64376
the signature of malloc changed to void*(*)(unsigned long) and the linux-2.4.37
kernel can not compile any more for this error.


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