Question on variable_size and function-at-a-time
Richard Kenner
kenner@vlsi1.ultra.nyu.edu
Sun Apr 11 13:58:00 GMT 2004
I'm trying to understand who is supposed to evaluate any SAVE_EXPRs
inside the sizes of a type in function-at-a-time mode, so I'm looking at
C and found that nobody seems to be doing it, which looks like a clear
bug to me. Consider the simple test case
int
sub1 (int i, int j)
{
typedef int c[i+2];
if (j == 2)
{
sub2 ();
return sizeof (c);
}
else
return sizeof (c)* 3;
}
It looks to me that the SAVE_EXPR for the size of C is computed inside the
"if (j == 2)" context so that if J is not 2, it will return undefined junk.
How is this supposed to work?
Perhaps cases like this are uncommon in C (I'd assume so since this bug
has been around for quite a while), but it happens all the time in Ada.
More information about the Gcc
mailing list