------- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-20 
02:37 -------
3.2.3 and 3.0.4 rejected the code:
t.cc: In function `void f(int)':
t.cc:4: variable-sized object of type `int[n]' may not be initialized

No recent (from 2.95.3 and above) GCC version got this right (well at least the 
versions I tested).

Here is a self contained testcase which fails and should not:
extern "C" void abort ();
void f(int n)
{
    int * a = new int [n] () ;
    for (int i = 0; i < n; ++i)
    {
        if (a[i])
                abort ();
        a[i]++;
    }
    delete[] a;
}
int main()
{
    f(5);
    f(5);
    f(5);
    f(5);
}

Even ICC 8.1 gets this wrong :).

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |wrong-code
      Known to fail|                            |3.3.3 3.4.0 4.0.0 4.1.0
                   |                            |2.95.3
   Last reconfirmed|0000-00-00 00:00:00         |2005-08-20 02:37:17
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23480

Reply via email to