+2004-04-05 Paul Brook <paul@codesourcery.com>
+
+ PR2123
+ * g++.gd/expr/anew1.C: XFAIL and make reproducible. Call abort on
+ failure and exit(0) on success.
+ * g++.gd/expr/anew2.C: Ditto.
+ * g++.gd/expr/anew3.C: Ditto.
+ * g++.gd/expr/anew4.C: Ditto.
+
2004-04-05 Nathan Sidwell <nathan@codesourcery.com>
PR c++/3518
-// { dg-do run }
+// { dg-do run { xfail *-*-* } }
+// XFAILed until PR2123 is fixed
// PR 11228: array operator new, with zero-initialization and a variable sized array.
// Regression test for PR
// Author: Matt Austern <austern@apple.com>
+#include <new>
+#include <stdlib.h>
+#include <string.h>
+
int* allocate(int n)
{
- return new int[n]();
+ void *p;
+ p = malloc(n * sizeof (int));
+ memset (p, 0xff, n * sizeof(int));
+ return new (p) int[n]();
}
int main()
int* p = allocate(n);
for (int i = 0; i < n; ++i)
if (p[i] != 0)
- return 1;
- return 0;
+ abort ();
+ exit (0);
}
-// { dg-do run }
+// { dg-do run { xfail *-*-* } }
+// XFAILed until PR2123 is fixed
// PR 11228: array operator new, with zero-initialization and a variable sized array.
// Regression test for PR
// Author: Matt Austern <austern@apple.com>
+#include <new>
+#include <stdlib.h>
+#include <string.h>
+
double* allocate(int n)
{
- return new double[n]();
+ void *p;
+ p = malloc(n * sizeof (double));
+ memset (p, 0xff, n * sizeof(double));
+ return new (p) double[n]();
}
int main()
double* p = allocate(n);
for (int i = 0; i < n; ++i)
if (p[i] != 0.0)
- return 1;
- return 0;
+ abort ();
+ exit (0);
}
-// { dg-do run }
+// { dg-do run { xfail *-*-* } }
+// XFAILed until PR2123 is fixed
// PR 11228: array operator new, with zero-initialization and a variable sized array.
// Regression test for PR
// Author: Matt Austern <austern@apple.com>
+#include <new>
+#include <stdlib.h>
+#include <string.h>
+
struct X
{
int a;
X* allocate(int n)
{
- return new X[n]();
+ void *p;
+ p = malloc(n * sizeof (X));
+ memset (p, 0xff, n * sizeof(X));
+ return new (p) X[n]();
}
int main()
X* p = allocate(n);
for (int i = 0; i < n; ++i)
if (p[i].a != 0 || p[i].b != 0.0)
- return 1;
- return 0;
+ abort ();
+ exit (0);
}
-// { dg-do run }
+// { dg-do run { xfail *-*-* } }
+// XFAILed until PR2123 is fixed
// PR 11228: array operator new, with zero-initialization and a variable sized array.
// Regression test for PR
// Author: Matt Austern <austern@apple.com>
+#include <new>
+#include <stdlib.h>
+#include <string.h>
+
struct B
{
B();
D* allocate(int n)
{
- return new D[n]();
+ void *p;
+ p = malloc(n * sizeof (D));
+ memset (p, 0xff, n * sizeof(D));
+ return new (p) D[n]();
}
int main()
D* p = allocate(n);
for (int i = 0; i < n; ++i)
if (p[i].n != 137 || p[i].x != 0)
- return 1;
- return 0;
+ abort ();
+ exit (0);
}