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

Duncan Sands baldrick at free.fr
Sun Jan 27 01:03:56 PST 2008


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).

Best wishes,

Duncan.



More information about the llvm-commits mailing list