------- Additional Comments From redi at gcc dot gnu dot org 2005-08-19 22:06
-------
I see a similar problem with uninitialized elements of an array with a new
initializer, but on mainline and 4.0.
#include <iostream>
void f(int n)
{
int * a = new int [n] () ;
for (int i = 0; i < n; ++i)
{
std::cout << a[i]++ << ' ';
}
std::cout << '\n';
delete[] a;
}
int main()
{
f(5);
f(5);
f(5);
f(5);
}
With mainline build from today I see:
0 0 0 0 0
0 0 1 1 1
0 0 2 2 2
0 0 3 3 3
Each line should also be all 0s because the new initializer should default-init
all the elements, but some of the elements have not been reset after they were
set during the first function call.
Should I file a different bug, or is this the same problem but unseen until now
on 4.x?
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |redi at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20427