aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPaul Brook <paul@codesourcery.com>2004-04-05 23:02:22 +0000
committerPaul Brook <pbrook@gcc.gnu.org>2004-04-05 23:02:22 +0000
commit67c55b229337d388a9f583e4b1e5e95392c7f01f (patch)
tree910c2dbd54068ad191baa0fd53802f0a8dfdbf83 /gcc
parent268d3b183239c33181a6531b86b3ad911d56147d (diff)
downloadgcc-67c55b229337d388a9f583e4b1e5e95392c7f01f.zip
gcc-67c55b229337d388a9f583e4b1e5e95392c7f01f.tar.gz
gcc-67c55b229337d388a9f583e4b1e5e95392c7f01f.tar.bz2
re PR c++/2123 (Array initializer)
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. From-SVN: r80440
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/ChangeLog9
-rw-r--r--gcc/testsuite/g++.dg/expr/anew1.C16
-rw-r--r--gcc/testsuite/g++.dg/expr/anew2.C16
-rw-r--r--gcc/testsuite/g++.dg/expr/anew3.C16
-rw-r--r--gcc/testsuite/g++.dg/expr/anew4.C16
5 files changed, 57 insertions, 16 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 2d088b6..0fcc366 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,12 @@
+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
diff --git a/gcc/testsuite/g++.dg/expr/anew1.C b/gcc/testsuite/g++.dg/expr/anew1.C
index a14408a..9e0d0ec 100644
--- a/gcc/testsuite/g++.dg/expr/anew1.C
+++ b/gcc/testsuite/g++.dg/expr/anew1.C
@@ -1,12 +1,20 @@
-// { 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()
@@ -15,6 +23,6 @@ int main()
int* p = allocate(n);
for (int i = 0; i < n; ++i)
if (p[i] != 0)
- return 1;
- return 0;
+ abort ();
+ exit (0);
}
diff --git a/gcc/testsuite/g++.dg/expr/anew2.C b/gcc/testsuite/g++.dg/expr/anew2.C
index b868189..aa11eef 100644
--- a/gcc/testsuite/g++.dg/expr/anew2.C
+++ b/gcc/testsuite/g++.dg/expr/anew2.C
@@ -1,12 +1,20 @@
-// { 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()
@@ -15,6 +23,6 @@ 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);
}
diff --git a/gcc/testsuite/g++.dg/expr/anew3.C b/gcc/testsuite/g++.dg/expr/anew3.C
index 3223546..c8ab441 100644
--- a/gcc/testsuite/g++.dg/expr/anew3.C
+++ b/gcc/testsuite/g++.dg/expr/anew3.C
@@ -1,8 +1,13 @@
-// { 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;
@@ -11,7 +16,10 @@ struct X
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()
@@ -20,6 +28,6 @@ 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);
}
diff --git a/gcc/testsuite/g++.dg/expr/anew4.C b/gcc/testsuite/g++.dg/expr/anew4.C
index 8999ffb..d86d525 100644
--- a/gcc/testsuite/g++.dg/expr/anew4.C
+++ b/gcc/testsuite/g++.dg/expr/anew4.C
@@ -1,8 +1,13 @@
-// { 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();
@@ -23,7 +28,10 @@ struct D : public 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()
@@ -32,6 +40,6 @@ 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);
}