[LLVMbugs] [Bug 10058] New: C standard incompatibility concerning untyped functions (and varargs)

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jun 1 00:31:08 PDT 2011


           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: unassignedclangbugs at nondot.org
        ReportedBy: hranac.bz at email.cz
                CC: llvmbugs at cs.uiuc.edu

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.

More information about the llvm-bugs mailing list