[llvm-bugs] [Bug 25009] New: Function pointer type in struct converted to {}*

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Sep 30 18:25:44 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=25009

            Bug ID: 25009
           Summary: Function pointer type in struct converted to {}*
           Product: clang
           Version: 3.7
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: tarunprabhu at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Input code: 

struct BaseT {
   void (*f)(struct BaseT** pot);
};

void foo(struct BaseT** in) {

}

When I emit llvm for this code, I get the following definition for struct BaseT

%struct.BaseT = type { {}* }


If I change the double pointer (BaseT**) in the definition of foo() to a single
pointer i.e.

void foo(BaseT*) {

}

then I get the expected output which is:

%struct.BaseT = type { void (%struct.BaseT**)* }

As far as I can tell, the code for the function bodies (in the complete code
which I have not provided) is correct because all the casts are added
correctly. However, I am writing an LLVM-based tool which needs to know the
types of the various user-defined structs and it breaks because the function
pointer in the type disappears and is replaced with what looks like an empty
anonymous struct.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20151001/bb553313/attachment.html>


More information about the llvm-bugs mailing list