Date: Fri, 30 Dec 2011 18:04:59 +0100 From: Dimitry Andric <dim@FreeBSD.org> To: David Chisnall <theraven@theravensnest.org> Cc: Alexander Best <arundel@freebsd.org>, freebsd-toolchain@freebsd.org, current@freebsd.org, freebsd-arch@freebsd.org Subject: Re: [rfc] removing/conditionalising WERROR= in Makefiles Message-ID: <4EFDEF3B.4090200@FreeBSD.org> In-Reply-To: <DE9D56F1-6D30-42E1-AA07-535BFAB2509D@theravensnest.org> References: <20111226101040.GA6361@freebsd.org> <4EFDB76C.1030901@FreeBSD.org> <DE9D56F1-6D30-42E1-AA07-535BFAB2509D@theravensnest.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 2011-12-30 14:28, David Chisnall wrote: > On 30 Dec 2011, at 13:06, Dimitry Andric wrote: > >> sys/gnu/fs/xfs/xfs_dir2_block.c:1149:17: warning: array index of '1' indexes past the end of an array (that contains 1 element) [-Warray-bounds] > > I recall some discussion of this warning on the clang list a few months ago, and I believe that it should now only appear if you are compiling in a C99 or C11 dialect mode (the rationale is that any variable-length structures in C99 should be using a zero-sized array as the final element, while C89 lacked any ability to do this). Yes, that is perfectly fine, but the xfs code defines the struct in question as follows: /* * Active entry in a data block. Aligned to 8 bytes. * Tag appears as the last 2 bytes. */ typedef struct xfs_dir2_data_entry { xfs_ino_t inumber; /* inode number */ __uint8_t namelen; /* name length */ __uint8_t name[1]; /* name bytes, no null */ /* variable offset */ xfs_dir2_data_off_t tag; /* starting offset of us */ } xfs_dir2_data_entry_t; E.g there *is* an overrun, but maybe it was really supposed to be like that. Meanwhile, upstream has apparently caught on: http://oss.sgi.com/archives/xfs/2011-07/msg00024.html
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4EFDEF3B.4090200>