aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorpbrook <pbrook@138bc75d-0d04-0410-961f-82ee72b054a4>2004-04-11 23:18:25 +0000
committerpbrook <pbrook@138bc75d-0d04-0410-961f-82ee72b054a4>2004-04-11 23:18:25 +0000
commite79c900c3c4d198a5e967044c29eda7eb7b8985b (patch)
treed300674db786057c29ff4986148601dfc82e1c54 /gcc
parent76c168ddb31819eaa0c57af958cdbc5609a60758 (diff)
PR 2123
* g++.dg/expr/anew1.C: XFAIL and make reproducible. Call abort on failure and exit(0) on success. * g++.dg/expr/anew2.C: Ditto. * g++.dg/expr/anew3.C: Ditto. * g++.dg/expr/anew4.C: Ditto. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-3_4-branch@80610 138bc75d-0d04-0410-961f-82ee72b054a4
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 ba282871f2e..e16fba9c8d5 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,12 @@
+2004-04-05 Paul Brook <paul@codesourcery.com>
+
+ PR 2123
+ * g++.dg/expr/anew1.C: XFAIL and make reproducible. Call abort on
+ failure and exit(0) on success.
+ * g++.dg/expr/anew2.C: Ditto.
+ * g++.dg/expr/anew3.C: Ditto.
+ * g++.dg/expr/anew4.C: Ditto.
+
2004-04-09 Zack Weinberg <zack@codesourcery.com>
* lib/target-supports.exp (check_named_sections_available): New.
diff --git a/gcc/testsuite/g++.dg/expr/anew1.C b/gcc/testsuite/g++.dg/expr/anew1.C
index a14408ace0a..9e0d0ec601f 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 b8681897577..aa11eef149c 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 3223546d4c8..c8ab44183ca 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 8999ffb53c6..d86d5251412 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);
}