Re: [PATCH 16/16] fix handling of integer constant expressions

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Al Viro
Date: Tuesday, June 26, 2007 - 5:18 pm

On Wed, Jun 27, 2007 at 08:32:26AM +0900, Neil Booth wrote:

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 ;-/
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH 16/16] fix handling of integer constant expressions, Segher Boessenkool, (Sun Jun 24, 11:18 am)
Re: [PATCH 16/16] fix handling of integer constant expressions, Segher Boessenkool, (Sun Jun 24, 12:09 pm)
Re: [PATCH 16/16] fix handling of integer constant expressions, Segher Boessenkool, (Sun Jun 24, 12:40 pm)
Re: [PATCH 16/16] fix handling of integer constant expressions, Segher Boessenkool, (Sun Jun 24, 11:13 pm)
Re: [PATCH 16/16] fix handling of integer constant expressions, Segher Boessenkool, (Sun Jun 24, 11:16 pm)
Re: [PATCH 16/16] fix handling of integer constant expressions, Al Viro, (Tue Jun 26, 5:18 pm)
Re: [PATCH 16/16] fix handling of integer constant expressions, Segher Boessenkool, (Thu Jun 28, 2:08 am)