[cfe-dev] Problem with struct arguments passed by value

Bill Wendling isanbard at gmail.com
Wed Apr 9 13:43:41 PDT 2008


On Wed, Apr 9, 2008 at 1:35 PM, Eli Friedman <eli.friedman at gmail.com> wrote:
> On Wed, Apr 9, 2008 at 1:06 PM, Shantonu Sen <ssen at apple.com> wrote:
>  > I have the following program that I'm trying to compile with clang on
>  >  Mac OS X on Intel, which clang fails to codegen correctly.
>  >
>  >  $ cat a.c
>  >
>  >  typedef struct {
>  >      long location;
>  >      long length;
>  >  } CFRange;
>  >
>  >  char CFArrayContainsValue(void *theArray, CFRange range, const void
>  >  *value);
>
>  llvm-gcc:
>  declare i8 @CFArrayContainsValue(i8*, i32, i32, i8*) signext
>
>  clang:
>  declare i8 @CFArrayContainsValue(i8*, %struct.anon*, i8*)
>
>  What the heck is llvm-gcc doing here?!
>
It looks as though llvm-gcc is assuming the Darwin function calling ABI:

http://developer.apple.com/documentation/DeveloperTools/Conceptual/LowLevelABI/Articles/IA32.html#//apple_ref/doc/uid/TP40002492-SW4

-bw



More information about the cfe-dev mailing list