[cfe-commits] [cfe-dev][patch] Strange LLVM IR result on recursive type

Eli Friedman eli.friedman at gmail.com
Mon Nov 12 15:26:50 PST 2012


On Sat, Nov 10, 2012 at 3:56 PM, Jin Gu Kang <jaykang10 at imrc.kist.re.kr> wrote:
> I misunderstood something about ABI converting.
>
>> struct S1 { int x; };
>> struct S2 { struct S1 (*g)(void); };
>> struct S2 g;
>
> Above example, struct S1 is changed to shadow parameter as following.
>
> %struct.S2 = type { void (%struct.S1*)* }
> %struct.S1 = type { i32 }
> @g = common global %struct.S2 zeroinitializer, align 4
>
> I think ABI converter is based on AST node so incomplete function type is not problem. My previous patch seemed to include several problems and I modified patch. Clang of trunk with modified patch didn't generate error on above example. Please review this patch.

Still crashes.  Try compiling the following testcase:

struct S1 { int x; };
struct S2 { struct S1 (*g)(void); };
struct S2 g;

with the command-line:
clang -c test.c -target x86_64-apple-macosx10.8.0

-Eli




More information about the cfe-commits mailing list