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

           Summary: C standard incompatibility concerning untyped
                    functions (and varargs)
           Product: clang
           Version: 2.8
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]


Created an attachment (id=6668)
 --> (http://llvm.org/bugs/attachment.cgi?id=6668)
The C source file.

Pre-standard function definitions (with untyped parameters - e.g. "foo(a,b)
{...}") are processed in a wrong and inconsistent way.

Translate the attached C file with the following command:
clang example.c -emit-llvm -S
When you look at the resulting ll file (in the second attachment), you will see
that the definitions of the functions f1-f6 are all right and as expected
(everything defaults to integer). However, they are used (in the function main)
as if they were variadic. This behaviour is in contradiction with C standard
(functions are variadic only if explicitly declared and/or defined as such).

This (probably) happens during the LLVM IR generation (hence the component
"LLVM Codegen" was set instead of "Frontend").

Note: I understand that this is probably a "feature".
Also, it is easy for a backend to deal with this. However, let's say that you
are using clang for something else (let's say, semantics extraction) and you
need a correct result.

-- 
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to