[LLVMbugs] [Bug 14920] New: incomplete conversion of recursive (function) types

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jan 11 03:17:14 PST 2013


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

             Bug #: 14920
           Summary: incomplete conversion of recursive (function) types
           Product: clang
           Version: 3.1
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: flbr at imm.dtu.dk
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 9861
  --> http://llvm.org/bugs/attachment.cgi?id=9861
The preprocessed newlib stdio.c

When converting from clang types to LLVM types a pointer to an empty struct is
inserted instead of the correct (function) pointer type.

In the test case this involves a function pointer, it is not clear whether this
also applies to other pointer types (probably not).

The problem starts when the global declaration of the function '__sread' is
processed (see blow). This leads to the construction of the type for 'struct
_reent' and subseuqntly 'struct __sFILE', which finally contains to a function
pointer '_read' matching the definition of '__sread'.

here the prototype of '__sread' and the member '_read' (skipping other
members):
int __sread(struct _reent *ptr, void *cookie, char *buf, int n)

struct __sFILE {
  ...
  int (*_read)(struct _reent *, void *, char *, int);
  ...
}

here the resulting LLVM type of 'struct __sFILE' (skipping members after
'_read'):
%struct.__sFILE = type { i8*, i32, i32, i16, i16, %struct.__sbuf, i32, i8*,
{}*,  ...


The problem occures when compiling newlib stdio.c (see the attached file).

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