[llvm-commits] [llvm-gcc-4.2] r46381 - in /llvm-gcc-4.2/trunk/gcc: llvm-abi.h llvm-internal.h llvm-types.cpp

Evan Cheng evan.cheng at apple.com
Sun Jan 27 16:13:21 PST 2008



On Jan 27, 2008, at 1:03 AM, Duncan Sands <baldrick at free.fr> wrote:

> Hi Evan,
>
>> Can you get me a test case? I need to see what gcc is doing. Thanks,
>
> Sure.  Zero sized fields in structs may not be very useful, but it is
> still legal to use them, in particular you can take their address,
> like this:
>
> struct Z {};
>
> struct Y {
>        int i;
>        struct Z z;
> };
>
> void *f(struct Y *y) {
>  return &y->z;
> }
>
> This used to work before your patch.  For that matter, llvm-gcc-4.2
> itself fails to build here (linux x86-32; crashes compiling  
> libgcov.c) for
> what looks to be the same reason.  Also, don't forget that Ada can  
> have
> fields of variable size in various places in a struct, and these can  
> be
> represented by zero-size LLVM fields (this kind of struct doesn't get
> passed to functions by copy though).
>
> Can you please explain why you made this change (a testcase would be
> good)

I did check in two test cases in a subsequent commit. Those used to  
choke llvm-gcc. I'll look at this today. It's obvious not all zero  
sized aggregates are not created equal.

Evan

>
>
> Best wishes,
>
> Duncan.



More information about the llvm-commits mailing list