bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 'static' in array-size func parm


From: Paul Eggert
Subject: Re: 'static' in array-size func parm
Date: Wed, 06 Aug 2014 09:16:48 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0

I'd be interested in getting this to work in gnulib, but unfortunately it doesn't work yet with RCS so let's fix that first.

Thien-Thi Nguyen wrote:

I recently learned that GCC 3.4.3 on Solaris 10 cannot compile:

  int
  last (int count, int all[static count])
  {
    return all[count - 1];
  }


Actually, GCC 3.4.3 *can* compile that. It just can't compile longer programs with that code in it. Which, unfortunately, means that bleeding-edge RCS won't build on Solaris 10's GCC, as the configure-time test case succeeds but the actual compilation fails. Please try the following program instead:

int
last (int count, int all[static count])
{
  return all[count - 1];
}
int
last1 (int count, int all[static count])
{
  return all[count - 1];
}

Perhaps I should also mention that the bug occurs with -O2 but does not occur when GCC is not optimizing. This should work with the configure-time test, though, as it's built with -O2.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]