This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Question on variable_size and function-at-a-time


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]