From: Marc Glisse Date: Mon, 12 Jan 2015 17:08:04 +0000 (+0100) Subject: Avoid undefined behavior in gcc.target/i386/pr64291-1.c X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6c0fcb81dad4c8f2f9c687a40627db0442a475f4;p=gcc.git Avoid undefined behavior in gcc.target/i386/pr64291-1.c PR testsuite/64427 * gcc.target/i386/pr64291-1.c: Limit to lp64 tarrget. Avoid undefined behavior. * gcc.target/i386/pr64291-2.c: Updated. From-SVN: r219479 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e0ef2911a65..c8d9235799d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2015-01-12 Marc Glisse + + PR testsuite/64427 + * gcc.target/i386/pr64291-1.c: Limit to lp64 tarrget. Avoid + undefined behavior. + * gcc.target/i386/pr64291-2.c: Updated. + 2015-01-12 Richard Biener PR tree-optimization/64530 diff --git a/gcc/testsuite/gcc.target/i386/pr64291-1.c b/gcc/testsuite/gcc.target/i386/pr64291-1.c index 85253c0151a..1d3a3809242 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 2f3f9293cfb..7b7e88a7996 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 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; +}