PATCH: PR testsuite/64427: gcc.target/i386/pr64291-1.c is invalid
H.J. Lu
hjl.tools@gmail.com
Mon Jan 12 17:30:00 GMT 2015
Hi,
gcc.target/i386/pr64291-1.c has 2 issues:
1. Stack variables, n and d, aren't initialized.
2. dnp[dn - 1] |= 1UL<<63; doesn't work with 32-bit long.
I am checking this patch from
https://gcc.gnu.org/bugzilla/attachment.cgi?id=34342
as an obvious fix.
H.J.
2015-01-12 Marc Glisse <marc.glisse@inria.fr>
PR testsuite/64427
* gcc.target/i386/pr64291-1.c: Limit to lp64 tarrget. Avoid
undefined behavior.
* gcc.target/i386/pr64291-2.c: Updated.
diff --git a/gcc/testsuite/gcc.target/i386/pr64291-1.c b/gcc/testsuite/gcc.target/i386/pr64291-1.c
index 85253c0..1d3a380 100644
--- a/gcc/testsuite/gcc.target/i386/pr64291-1.c
+++ b/gcc/testsuite/gcc.target/i386/pr64291-1.c
@@ -1,6 +1,6 @@
/* { dg-options "-O2" } */
/* { dg-additional-sources pr64291-2.c } */
-/* { dg-do run } */
+/* { dg-do run { target lp64 } } */
void f(void*,...);
void g(void*,long,long);
int nnn=0;
@@ -12,6 +12,7 @@ typedef struct
unsigned long *_mp_d;
} __mpz_struct;
typedef __mpz_struct mpz_t[1];
+void h(mpz_t);
int main ()
{
@@ -21,7 +22,7 @@ int main ()
long alloc, itch;
f (n);
- f (d);
+ h (d);
qp = (unsigned long*)__builtin_alloca(4099*8) + 1;
dnp = (unsigned long*)__builtin_alloca (2049*8);
alloc = 1;
diff --git a/gcc/testsuite/gcc.target/i386/pr64291-2.c b/gcc/testsuite/gcc.target/i386/pr64291-2.c
index 2f3f929..7b7e88a 100644
--- a/gcc/testsuite/gcc.target/i386/pr64291-2.c
+++ b/gcc/testsuite/gcc.target/i386/pr64291-2.c
@@ -1,4 +1,14 @@
/* { dg-do compile } */
-extern void abort (void);
+#include <assert.h>
void f(void*p,...){}
-void g(void*p,long a,long b){if (a!=8) abort();}
+void g(void*p,long a,long b){assert(a==8);}
+typedef struct
+{
+ int _mp_size;
+ unsigned long *_mp_d;
+} __mpz_struct;
+typedef __mpz_struct mpz_t[1];
+void h(mpz_t x) {
+ x->_mp_d=0;
+ x->_mp_size=0;
+}
More information about the Gcc-patches
mailing list