LWN.net Logo

Clang builds a working 2.6.36 Kernel

Clang builds a working 2.6.36 Kernel

Posted Oct 26, 2010 11:55 UTC (Tue) by jwakely (subscriber, #60262)
In reply to: Clang builds a working 2.6.36 Kernel by jwakely
Parent article: Clang builds a working 2.6.36 Kernel

http://clang.llvm.org/compatibility.html#vla
that's in the context of C++, apparently Clang defaults to C99 for C (which is correct as that's the current standard) so I wonder why VLAs are described as unsupported - maybe a mistake


(Log in to post comments)

Clang builds a working 2.6.36 Kernel

Posted Oct 26, 2010 23:07 UTC (Tue) by wash (guest, #70825) [Link]

Very much so a mistake, my apologizes. I meant to refer to the GNU extension that allows variable length arrays in structures.

Clang builds a working 2.6.36 Kernel

Posted Oct 26, 2010 23:45 UTC (Tue) by Trelane (subscriber, #56877) [Link]

by "VLAs in structs" are you referring to flexible array members?

Clang builds a working 2.6.36 Kernel

Posted Oct 30, 2010 12:32 UTC (Sat) by viro (subscriber, #7872) [Link]

Much worse than that. It allows (and kernel does *not* use, unless something has drastically and cretinously changed) things like that:

extern void g(int *);
void f(int m, int n)
{
struct foo {
int a[n];
int b[n][m + 69];
} x;
g(&x.b[1][1]);
}

Yes, gcc is that sick.

Clang builds a working 2.6.36 Kernel

Posted Oct 27, 2010 9:36 UTC (Wed) by jwakely (subscriber, #60262) [Link]

Flexible array members are also standard C99, and I assume supported by Clang. *zero* length array members are a GNU extension:
http://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds