This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug objc/47832] [4.6 Regression] ObjC errors on structures with flexible data members


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47832

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-02-21 12:02:58 UTC ---
As I said, I don't know ObjC, so if you could fix it, I'd appreciate it.

That said, ISO C99 allows:

struct A { int a; char b[]; };

struct A a; // Here sizeof (a) will be offsetof (struct A, b[0])

but doesn't allow:

struct B { struct A a; int i; };

So, for ObjC I guess it depends if in @interface there are variables (then
variables with flexible array members in theory could be treated there like ISO
C99 treats variables), or they are treated as struct fields, in which cases
fields with flex array members should be rejected.  And you're right that it is
weird to reject there pointers to structs with flexible array members, unless
ObjC somehow encodes all the types each pointer points to, transitively.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]