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

Jin Gu Kang jaykang10 at imrc.kist.re.kr
Mon Nov 12 16:46:44 PST 2012


Thanks for your comment.

I am sorry. I didn't test many target triple. I saw that llvm IR type is used on ABI converting code such as X86_32ABIInfo and X86_64ABIInfo. This patch can't solve this case because codes about ABI need complete function type. If clang can't allow incomplete function type and my patch can't be applied to clang without modifying ABI converting codes. ABI converting codes is beyound my current focus and ability. I really appreciate for your help and guiding. :) If I get some ideas, I will make patch again.

Thanks for your help and guiding,
Jin-Gu Kang
________________________________________
From: Eli Friedman [eli.friedman at gmail.com]
Sent: Tuesday, November 13, 2012 8:26 AM
To: Jin Gu Kang
Cc: cfe-commits at cs.uiuc.edu
Subject: Re: [cfe-commits] [cfe-dev][patch] Strange LLVM IR result on recursive type

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