On Wed, Jun 27, 2007 at 08:32:26AM +0900, Neil Booth wrote: > Al Viro wrote:- > > > Hopefully correct handling of integer constant expressions. Please, review. > > Am I invoking sparse wrongly? ./sparse -W -Wall doesn't diagnose > the following TU, for example. > > extern int a; > extern int as1[(a = 2)]; sparse simply doesn't check that. We don't have anything resembling support of VLA. Note that check for integer constant expression has nothing to do with that; int x[(int)(0.6 + 0.6)]; is valid (if stupid). And yes, footnote in 6.6 contradicts 6.7.5.2(1); too bad... We certainly need to do checks on array sizes; however, that part ("if it has static storage duration, it should not be a VLA") is minor. And then there are gccisms: size_t foo(int n) { struct { int a[n]; char b; } x; return offsetof(typeof(x), b); } Yes, it's eaten up just fine. And yes, such structures are silently accepted even with -pedantic -std=c99, which is a bug. Sigh... We'll need to tackle VLAs at some point, but it certainly won't be fun ;-/ - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
- Follow-Ups:
- Re: [PATCH 16/16] fix handling of integer constant expressions
- From: Neil Booth <[email protected]>
- Re: [PATCH 16/16] fix handling of integer constant expressions
- From: Derek M Jones <[email protected]>
- Re: [PATCH 16/16] fix handling of integer constant expressions
- From: Linus Torvalds <[email protected]>
- Re: [PATCH 16/16] fix handling of integer constant expressions
- References:
- Re: [PATCH 16/16] fix handling of integer constant expressions
- From: Al Viro <[email protected]>
- Re: [PATCH 16/16] fix handling of integer constant expressions
- From: Linus Torvalds <[email protected]>
- Re: [PATCH 16/16] fix handling of integer constant expressions
- From: Al Viro <[email protected]>
- Re: [PATCH 16/16] fix handling of integer constant expressions
- From: Linus Torvalds <[email protected]>
- Re: [PATCH 16/16] fix handling of integer constant expressions
- From: Segher Boessenkool <[email protected]>
- Re: [PATCH 16/16] fix handling of integer constant expressions
- From: Al Viro <[email protected]>
- Re: [PATCH 16/16] fix handling of integer constant expressions
- From: Josh Triplett <[email protected]>
- Re: [PATCH 16/16] fix handling of integer constant expressions
- From: Al Viro <[email protected]>
- Re: [PATCH 16/16] fix handling of integer constant expressions
- From: Al Viro <[email protected]>
- Re: [PATCH 16/16] fix handling of integer constant expressions
- From: Neil Booth <[email protected]>
- Re: [PATCH 16/16] fix handling of integer constant expressions
- Prev by Date: Re: [patch, v2.6.22-rc6] sys_time() speedup
- Next by Date: Re: [PATCH] atl1: disable 64bit DMA
- Previous by thread: Re: [PATCH 16/16] fix handling of integer constant expressions
- Next by thread: Re: [PATCH 16/16] fix handling of integer constant expressions
- Index(es):